How to add a condition to a variable - GAMS

Viewed 193

In the model I'm trying to build, I have a variable defined as:

Variables
    x(i,j)  number of motors produced in month i to be delivered in month j ;

In that variable, j must always be equal or greater than i for it to make sense (you can't produce something in this month to be delivered in the previous month). However, I have no clue as to how I can properly model this. I've searched and couldn't find an easy solution to this.

Any ideas?

2 Answers

So, I add this, right after declaring the variable:

x.fx(i,j)$(ord(i)>ord(j))=0; 

It is fixing the values of the variables you are not using to zero. In your model:

enter image description here

And the results are:

enter image description here

I believe that should do it :)

Related