Variable in Conditional Statement

Problems with syntax of GAMS
Post Reply
paganini
User
User
Posts: 15
Joined: 5 years ago

Variable in Conditional Statement

Post by paganini »

Hi
I'm trying to model the below picture in gams:
Image

and the code that I used is something like:

Code: Select all

if(
off_time(j,k) <= a +b,
Cu(j,k)=e=hot(j);
elseif off_time(j,k) > a+ b,
Cu(j,k)=e=cool(j);
);
but it gives me many errors.
in y code Cu(j,k) and off_time(j,k) are both positive variables
and "a", "b", "hot(j)" and "cool(j)" are fixed value which are taken from a table.
so the question is how can I use the variable "off_time(j,k)" in a conditional statment ????
I would greatly appreciate any assistance or advice you could offer me.
Attachments
Picture
Picture
Fred
Posts: 372
Joined: 7 years ago

Re: Variable in Conditional Statement

Post by Fred »

Hi,

This has not so much to do with GAMS but is rather a general question on how to model logical conditions. If you manage to write down the logical condition in a way that fits with e.g. MIP, the implementation in GAMS will be easy. Perhaps you should look into some modeling book (e.g. HP Williams, Model building in mathematical programming) or at the following support wiki page: https://support.gams.com/gams:formulate ... _equations

I hope this helps!

Fred
Post Reply