Initializing a binary variable Topic is solved

Problems with syntax of GAMS
Post Reply
before2
User
User
Posts: 3
Joined: 3 years ago

Initializing a binary variable

Post by before2 »

Hello,

I have a problem regarding the assignment of an initial value to a binary variable in a lot sizing model.
Basically i want to assign the value 1 to the binary setup variable w for the dummyproduct k=0 in the dummy period s=0.

Code: Select all

sets
s 	microperiods  with s=0 being a dummy period
k 	products with k=0 being a dummy product...
;

binary variables
w(k,s)	machine state indicator
...
;
I tried to search for variable initialization in GAMS and i found the following syntax used as an equation:

Code: Select all

initialization(k)..
w('k0','s0') =e= 1;
If I use this syntax I always get the error 353:
The domain for this index position is unknown and the element cannot be checked at this point. Missing data statement.
I'm not sure how to fix it or what I'm doing wrong.

Alternatively I was wondering if it's possible to assign an initial value like that:

Code: Select all

initialization(k,s)$(ord (k)=0 and ord(s)=0)..
w(k,s) =e= 1;
Thanks for reading and I appreciate the help!
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Initializing a binary variable

Post by abhosekar »

It looks like you would want to fix the variable to 1. The way to do that is w.fx('k0', 's0') = 1;

Hope that helps.
Post Reply