Ooh, sorry, i was too tired maybe to recognize the change in the matrix

This works perfectly!

Thank you for your help, hope i can return the favor!

2013/5/3 Maxwell Brown

Any relationship defined in the table BIN(I,J) is either allowed [1] or forbidden [0]. It is up to the user to set feasible correlations - I put in one zero @ [a1, A] as an example but you can put in as many or as few as you would like.

–

You are very welcome, happy to help.

Best,

Max

On Friday, May 3, 2013 3:46:35 AM UTC-4, MÃ¡tyÃ¡s Lember wrote:

, but its still do the D.a1

The task is to prohibit that connection, and find another one. like a1.C and a2.D…

(a1,a2… the workers; A,B… the cities; and “a1” worker doesn’t want to go to the city “D”)

I have using this program for a few weeks, and i get this task .

I’m unable to find the solution.

I am really grateful to all of you!

2013/5/2 Maxwell Brown

Here ya go, Lember (see attached).

Main changes here:

OBJ… Z =E= SUM((I,J)$FEAS(I,J), T(I,J)*X(I,J));

KORL1(I)… SUM(J$FEAS(I,J), X(I,J)) =E= 1;

KORL2(J)… SUM(I$FEAS(I,J), X(I,J)) =E= 1;

Results:

---- 46 VARIABLE X.L

A B C D

a1 1.000

a2 1.000

a3 1.000

a4 1.000

---- 46 VARIABLE Z.L = 16.000

On Wednesday, May 1, 2013 3:49:25 PM UTC-4, MÃ¡tyÃ¡s Lember wrote:

Hi!

Unfortunately it skips the step, and the result is only 11. Counts only 3 worker - city connections, and the matrix is also looks bad.

Thank you very much guys for the trying!

---- 43 VARIABLE X.L

A B C D

a1 1.000

a2 1.000

a3 1.000

a4 1.000

---- 43 VARIABLE Z.L = 11.000

2013. Ã¡prilis 30., kedd 16:55:09 UTC+2 idÅ‘pontban Maxwell Brown a kÃ¶vetkezÅ‘t Ãrta:

OBJ… Z =E= SUM((I,J), T(I,J)*X(I,J));

SHOULD BE:

OBJ… Z =E= SUM((I,J)$FEAS(I,J), T(I,J)*X(I,J));

On Monday, April 29, 2013 5:01:24 PM UTC-4, Maxwell Brown wrote:

The table bin(i,j) below should work for your purposes. If the value is ‘1’ then it should be an allowed relationship, otherwise not. Let me know if it does what you would like:

SETS

i /a1, a2, a3, a4/

j /A, B, C, D/;

Table T(i,j) ido

A B C D

a1 6 7 5 5

a2 7 4 8 6

a3 3 4 2 6

a4 5 7 7 5;

parameters

k/1/

l/4/;

Table bin(i,j)

A B C D

a1 0 1 1 1

a2 1 1 1 1

a3 1 1 1 1

a4 1 1 1 1

;

SET FEAS(I,J);

FEAS(I,J)=YES$(bin(I,J)=1);

VARIABLES

X(I,J)

Z;

POSITIVE VARIABLES X(I,J);

EQUATIONS

OBJ

KORL1 (I)

KORL2 (J)

;

OBJ… Z =E= SUM((I,J), T(I,J)*X(I,J));

KORL1(I)… SUM(J, X(I,J)) =E= 1;

KORL2(J)… SUM(I, X(I,J)) =E= 1;

MODEL HOZZAR/ALL/;

SOLVE HOZZAR USING LP MINIMIZING Z;

DISPLAY X.L, Z.L;

On Monday, April 29, 2013 3:56:18 PM UTC-4, MÃ¡tyÃ¡s Lember wrote:

Dear Mohamad!

Thanksfor your answer, but unfortunately i get errors. (domain violation for element)

Put to the equations like this:

POSITIVE VARIABLES X(I,J);

EQUATIONS

OBJ

KORL1 (I)

KORL2 (J)

korl4

;

OBJ… Z =E= SUM((I,J), T(I,J)*X(I,J));

KORL1(I)… SUM(J, X(I,J)) =E= 1;

KORL2(J)… SUM(I, X(I,J)) =E= 1;

korl4 … x.fx(‘A’,‘a1’)=0 ;

MODEL HOZZAR/ALL/;

2013. Ã¡prilis 29., hÃ©tfÅ‘ 19:23:17 UTC+2 idÅ‘pontban Mohamad Dehghani a kÃ¶vetkezÅ‘t Ãrta:

maybe u can add this equation to the model.

x.fx(‘A’,‘a1’)=0 ;

see what happens

hope this helps

On Apr 30, 2013, at 12:05 AM, MÃ¡tyÃ¡s Lember wrote:

```
Hello,
i have searching for the solution for a days, but i can't find it.
Please help me!
So, my problem is that:
I need to prohibit to use D-a1 combination, when minimizing. (D is a city, a1 is a worker, so a1 worker can not go to city D)
Cant change the number 5 to a greater number. :slight_smile:
Thank you in advance!!
SETS
i /a1, a2, a3, a4/
j /A, B, C, D/;
Table T(i,j) ido
A B C D
a1 6 7 5 5
a2 7 4 8 6
a3 3 4 2 6
a4 5 7 7 5;
VARIABLES
X(I,J)
Z;
POSITIVE VARIABLES X(I,J);
EQUATIONS
OBJ
KORL1 (I)
KORL2 (J)
;
OBJ.. Z =E= SUM((I,J), T(I,J)*X(I,J));
KORL1(I).. SUM(J, X(I,J)) =E= 1;
KORL2(J).. SUM(I, X(I,J)) =E= 1;
MODEL HOZZAR/ALL/;
SOLVE HOZZAR USING LP MINIMIZING Z;
DISPLAY X.L, Z.L;
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
```

–

You received this message because you are subscribed to a topic in the Google Groups “gamsworld” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsworld/GftgcCJCn6A/unsubscribe?hl=en.

To unsubscribe from this group and all its topics, send an email to gamsworld+...@googlegroups.com.

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

\