电力调度优化理论与应用例题代码(1)
作者:互联网
P36 利用线性及整数规划方法求解经济调度模型
例题3-1
function [x,y]=Gurobi_LP
cons=[];
load K;
x=sdpvar(1,9);
y=41+K(1,1)*x(1)+K(1,2)*x(2)+K(1,3)*x(3)+K(1,4)*x(4)+47.2+K(2,1)*x(5)+K(2,2)*x(6)+58.6+K(3,1)*x(7)+K(3,2)*x(8)+K(3,3)*x(9);
cons=[cons,sum(x)+100+120+150==700];
cons=[cons,0<=x(1)<=25];
cons=[cons,0<=x(2)<=25];
cons=[cons,0<=x(3)<=25];
cons=[cons,0<=x(4)<=25];
cons=[cons,0<=x(5)<=100];
cons=[cons,0<=x(6)<=30];
cons=[cons,0<=x(7)<=50];
cons=[cons,0<=x(8)<=50];
cons=[cons,0<=x(9)<=50];
ops=sdpsettings('solver','gurobi','showprogress',1);
z=optimize(cons,y,ops);
x=double(x)
y=double(y)
if z.problem==0
-value(y)
else
disp('something wrong!');
end
标签:load,150,cons,代码,700,调度,例题 来源: https://blog.csdn.net/weixin_44082254/article/details/117306305