hello all …
i am new to gams software … so please help me to solve the following problems.
-
i want to write a loop after the solve statement ( as shown in the program below) which uses one of the variables ( x(j) ) found through the solve statement. But i am getting error… (error coming in the portion marked in red.)
-
Is there any incrementing operator in gams like java or c (i++) …?? whether the line marked in blue is correct…???
Variable z total transportation costs in thousands of dollars ;
binary variable x(j)
p(i,j)
y(i,j) ;
scalar three /0/;
Equations cost
supply(i)
supply2(j)
supply1(j)
const1(i,j)
const2(i,j);
cost … z =e= sum (j, x(j))- .001*(sum((i,j), d(i,j)*x(j))) ;
supply(i) … sum(j, p(i,j)*d(i,j)*x(j)) + sum(j, (y(i,j)*c(j)*d(i,j))) =g= 1 ;
supply1(j) … sum(i, (d(i,j)*y(i,j))) =e= c(j);
supply2(j)… sum(i, (p(i,j))) =l= bb(j);
const1(i,j)(ord(i)=ord(j)).. (d(i,j)*p(i,j))=e= x(j);
const2(i,j)(ord(i)ord(j))… (d(i,j)*p(i,j))=l= x(j);
loop(j,
if(
(sum (i,d(i,j)) < 4),
bb(j) = 5;
elseif ((sum (i,d(i,j)) ge 4) and (sum (i,d(i,j)) < 7)),
bb(j) = 6;
else
bb(j)=7;
);
);
display bb;
Model elect /all/ ;
Solve elect using miqcp minimizing z ;
loop(j,
if(
((sum (i,d(i,j)) < 4) and (x(j) eq 1)),
three = three + 1 ;
);
);
display bb, three;
–
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.
For more options, visit https://groups.google.com/d/optout.