我试图用MATLAB解决这个混合整数线性规划问题。但是,我在matlab中对线性目标函数和决策变量求和的定义存在问题。我在MATLAB中使用intlinprog函数。请在下面找到图片链接。
请同时找到我在MATLAB中编写的代码片段。我发现错误,因为我观察到了#34;有趣"不能与MATLAB intlinprog函数一起使用。
for i = 1: length(bt)
f(i,1) = bt(i) + nch*w;
f(i,2) = (w/nch) - st;
f(i,3:5) = 0;
end
M = [4,5,9,10,14,15,19,20,24,25,29,30,34,35,39,40,44,45,49,50,54,55,59,60,64,65,69,70,74,75];
e = 0.00001;
A = [0 0 0 1 1;
-nch 1/nch 1 0 0];
ACell = repmat({A}, 1, 15);
A = blkdiag(ACell{:});
B = [1; 0.7];
ub = ones(5,1);
ub(1:2,1) = 2.3;
ub = repmat(ub, length(bt),1);
lb = zeros(5,1);
lb(3,1) = 0.01;
lb = repmat(lb,length(bt),1);
f = reshape( f.' ,1,numel(f))';
B = repmat(B,length(bt),1);
Opt = opti('f',f,'ineq',[],[],'eq',A,B,'bounds',lb,ub,'xtype',M)
[x,fval,exitflag,info] = solve(Opt)