Page 1 of 1

gams error 409-257

Posted: Fri May 14, 2021 12:08 am
by Someone
hello.
the code i wrote is below i have two mistakes error 409 and 257 it is a planning model problem i'm a student and i'm trying to learn GAMS how can i fix that?
sets
i /1*48/
j /1*8/
k /1*6/
n(j) /1,2,3,4,5,6/;


variables
x(i,j,k)
z ;

binary variables
x(i,j,k) ;



parameters

p(i) i.alanın operasyon süresi
/1 10
2 15
3 20
4 25
6 30
7 35
8 40
9 45
10 55
11 10
12 10
13 15
14 20
15 25
16 30
17 35
18 10
19 20
20 30
21 40
22 5
23 10
24 15
25 20
26 25
27 10
28 20
29 30
30 40
31 50
32 10
33 20
34 30 / ;

equations
cost
alan
operationp
condition ;

cost.. z =e= sum((i,j,k),(p(i)*ord(k) - p(i)*ord(j) + p(i)+1)*x(i,j,k))
alanx(i,j,k).. sum(j,x(i,j,k)) =e= 1 *error 409 409 Unrecognizable item - skip to find a new statement
**** looking for a ';' or a key word to get started again
operationp(i) .. sum((j,k),x(i,j,k)) =e= 1
condition.. x(i,j,k) =e=1
condition.. x(i,j,k) =e= 0 ;

model cizelgeleme /all/;
solve cizelgeleme using MIP minimizing z; *error 257 257 Solve statement not checked because of previous errors

Re: gams error 409-257

Posted: Fri May 14, 2021 2:09 am
by abhosekar
Here are a few points (not all)
1. lines end with a semicolon in GAMS ";" there is a semicolon missing after cost equation (similarly after condition equation and operationp equation)
2. You define equation alan, but when writing the equation, you write alanx.
3. you define two equations with the same name. You have two equations named condition setting same quantity to 1 and 0. This will give you errors and later, infeasibilities.
4. why define alan(i, j, k)? You can simply write alan and get rid of the (i, j, k). Write (i, j ,k) only if you want the constraint to be repeated for each i, j, k

You can find models in the GAMS model library that you can refer and follow the syntax. You can also follow GAMS documentation where there are tutorials. Hope this helps.

- Atharv