Condition in an equation
Posted: Fri Oct 12, 2018 2:52 pm
Hello everybody,
I am currently trying to establish my first GAMS model. However, I can't figure out a solution for my problem.
I have a variable x, which depends on a sector and a time: x (sector, time)
The goal is to find the optimal x for each hour of the year for my problem.
In my model I have the condition that if x(sector1, t) is 0 and for the next hour at x(sector1, t+1) is positiv, it has to be positiv for the next three hours.
My former solution to model this was to use an equation. It is in the following code:
equation1(t)$((x('sector1',t)=0)and(x('sector1',t+1)>0)) .. x('Cement',t+2) and x('Cement',t+3) and x('Cement',t+4) =g= 1;
Does anybody know a solution to my problem?
Any form of help is appreciated. Thank you in advance.
I am currently trying to establish my first GAMS model. However, I can't figure out a solution for my problem.
I have a variable x, which depends on a sector and a time: x (sector, time)
The goal is to find the optimal x for each hour of the year for my problem.
In my model I have the condition that if x(sector1, t) is 0 and for the next hour at x(sector1, t+1) is positiv, it has to be positiv for the next three hours.
My former solution to model this was to use an equation. It is in the following code:
equation1(t)$((x('sector1',t)=0)and(x('sector1',t+1)>0)) .. x('Cement',t+2) and x('Cement',t+3) and x('Cement',t+4) =g= 1;
Does anybody know a solution to my problem?
Any form of help is appreciated. Thank you in advance.