Dear CVX Developers

# In this here, I have a optimization problem with three-dimensional matrix. It seems that there is a bug on solve *for loop* in the problem. Note that in the following code, the repetition is written for “number” (number = 1:20). Now in the fourth line we have the code, “sum (g (**1:20**, time, scenario))”. Here, if we write “**number**” instead of “**1:20**”, the problem will not be solved. If according to the for loop “**number**” will be the same as “**1:20**”. But with these conditions written “sum (g (**1:20**, time, scenario))” the problem is solved. This seems to be a bug in solving 3D loops in “cvx”.

# for number=1:20;

for time=1:24;

for scenario=1:2;

sum(g(1:20,time,scenario))==demand(time,scenario); % power balance

g(number,time,scenario)>=pmin(number)*s(number,time,scenario); % constraint of minimum production of generators

g(number,time,scenario)<=pmax(number)*s(number,time,scenario); % constraint of maximum production of generators

s(number,time,scenario)<=1;s(number,time,scenario)>=0; % constraint of binary variable of startup

u(number,time,scenario)<=1;u(number,time,scenario)>=0; % constraint of binary variable of shutdown

s(number,time,scenario)+u(number,time,scenario)==1; % constraint of relationship between binary variables

end

end

end

The full code is available at the link below, and you can run and see the results.

Thank you so much.

best regards

hossein