Originally posted by: NiuX-HNU
I am a new hand in this field. Now I'm doing some research on unit commitment scheduling. But I got some trouble when I tried to add minimum up- and down-time constraint to the model using OPL. I want to know how to translate the following sentences writing in YALMIP to OPL.
% Adding minimum up- and down-time
minup = [6;30;1];
mindown = [3;6;3];
for k = 2:Horizon
for unit = 1:Nunits
% indicator will be 1 only when switched on
indicator = onoff(unit,k)-onoff(unit,k-1);
range = k:min(Horizon,k+minup(unit)-1);
% Constraints will be redundant unless indicator = 1
Constraints = [Constraints, onoff(unit,range) >= indicator];
end
end
The following is my translation..(I don't know whether it is right or wrong.)
forall(k in 2..Horizon,unit in Nunits) //Horizon is the schedule time, Nunits is amount of the generators
{ range==minl(Horizon,k+minup[unit]-1);
indicator==onoff[unit][k]-onoff[unit][k-1]; //onoff[k][unit] is binary indicates whether the generator is on(1) or off(0)
low1==k;
forall(k in low1..range,unit in Nunits)
onoff[unit][k]>=indicator;
}
#CPLEXOptimizers#DecisionOptimization