New to GAMS ..Please help

hello all …
i am new to gams software … so please help me to solve the following problems.

  1. 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.)

  2. 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.

Hi
As x is a variable, you want to ask for the level of x in your loop by writing x.L.
++ is not possible (I believe) and your email is black and white…
Cheers
Renger



Sent from my Samsung Note 4


-------- Original message --------
From: JOICE PHILIP
Date: 9/18/2015 10:34 (GMT+01:00)
To: gamsworld
Subject: New to GAMS …Please help


hello all …
i am new to gams software … so please help me to solve the following problems.

  1. 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.)

  2. 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.


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.

Hi…

I want to select the select some values in x(j) {which are greater than one} and check whether the sum of the corresponding row in the matrix {d(i,j)} is less than a particular value
I think x.L which is used for display purposes, wont be useful in this case.

Is there any other way…?? If i am wrong can u please give me an example on how to do the same…


On Friday, September 18, 2015 at 4:09:55 PM UTC+5:30, Renger van Nieuwkoop wrote:

Hi
As x is a variable, you want to ask for the level of x in your loop by writing x.L.
++ is not possible (I believe) and your email is black and white…
Cheers
Renger



Sent from my Samsung Note 4


-------- Original message --------
From: JOICE PHILIP
Date: 9/18/2015 10:34 (GMT+01:00)
To: gamsworld
Subject: New to GAMS …Please help


hello all …
i am new to gams software … so please help me to solve the following problems.

  1. 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.)

  2. 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+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.


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.