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. :)Thank you in advance!!SETSi /a1, a2, a3, a4/j /A, B, C, D/;Table T(i,j) idoA B C Da1 6 7 5 5a2 7 4 8 6a3 3 4 2 6a4 5 7 7 5;VARIABLESX(I,J)Z;POSITIVE VARIABLES X(I,J);EQUATIONSOBJKORL1 (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;--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
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.
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);EQUATIONSOBJKORL1 (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/;
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.LA B C Da1 1.000a2 1.000a3 1.000a4 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.LA B C Da1 1.000a2 1.000a3 1.000a4 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:
SETSi /a1, a2, a3, a4/j /A, B, C, D/;Table T(i,j) idoA B C Da1 6 7 5 5a2 7 4 8 6a3 3 4 2 6a4 5 7 7 5;
parametersk/1/l/4/;Table bin(i,j)A B C Da1 0 1 1 1a2 1 1 1 1a3 1 1 1 1a4 1 1 1 1;SET FEAS(I,J);
FEAS(I,J)=YES$(bin(I,J)=1);
VARIABLESX(I,J)Z;POSITIVE VARIABLES X(I,J);EQUATIONSOBJKORL1 (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);EQUATIONSOBJKORL1 (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:
--
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.
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