Matlab 不等式 线性方程式最优解

单价都是1000,X1到X4是4中原料占比,总和为100%,求解成本最低的最优解
答案(X1=26.26%,X2=0.00%,X3=58.15%,X4=15.25%)
Min s = 1000 * X1 + 1000 * X2 + 1000 * X3 + 1000 * X4;

14<= 13.9 * X1 + 13.0 * X2 + 13.6 * X3 + 15.7 * X4 <=16;
0.1<= 0.17 * X1 + 0.04 * X2 + 0.08 * X3 + 0.11 * X4 <= 0.9
0.4<= 0.41 * X1 + 0.39 * X2 + 0.48 * X3 + 0.92 * X4 <=0.8;
0<=0.13 * X1 + 0.21 * X2 + 0.14 * X3 + 0.24 * X4 <= 100;
0.1<=0.15 * X1 + 0.10 * X2 + 0.15 * X3 + 0.18 * X4 <= 0.5;
0.4<=0.3 * X1 + 0.44 * X2 + 0.52 * X3 + 0.58 * X4 <= 1.2;
0.32<=0.49 * X1 + 0.39 * X2 + 0.49 * X3 + 0.39 * X4 <=0.6;
3110<=3390 * X1 + 3240 * X2 + 3210 * X3 + 2240 * X4 =3310;

帮忙看看,我写的肯定有问题,这个方法(linprog)能这么用吗?还有更好的方法吗?
图片说明

4个回答

function linprog2_1
f=[1000,1000,1000,1000];
A=[13.9,13.0,13.6,15.7;
0.17,0.04,0.08,0.11;
0.41,0.39,0.48,0.92;
0.13,0.21,0.14,0.24;
0.15,0.10,0.15,0.18;
0.3,0.44,0.52,0.58;
0.49,0.39,0.49,0.39;
3390,3240,3210,2240;
-13.9,-13.0,-13.6,-15.7;
-0.17,-0.04,-0.08,-0.11;
-0.41,-6.39,-0.48,-0.92;
-0.13,-0.21,-0.14,-0.24;
-0.15,-0.10,-0.15,-0.18;
-0.3,-0.44,-0.52,-0.58;
-0.49,-0.39,-0.49,-0.39;
-3390,-3240,-3210,-2240;];%负号指把不等式两边同时乘以-1把大于等于号转化为小于等于号
b=[16,0.9,0.8,100,0.5,1.2,0.6,3310,-14,-0.1,-0.4,0,-0.1,-0.4,-0.32,-3110];
Aeq=[1,1,1,1];
beq=1;%组成之和为1
lb=[0,0,0,0];
ub=[];
[x,fval]=linprog(f,A,b,Aeq,beq,lb,ub)

end
图片说明

有大神帮忙给看看吗?这个怎么另加悬赏

function linprog2_1
f = [1000,1000,1000,1000];
A = [13.9,13.0,13.6,15.7;
0.17,0.04,0.08,0.11;
0.41,6.39,0.48,0.92;
0.13,0.21,0.14,0.24;
0.15,0.10,0.15,0.18;
0.3,0.44,0.52,0.58;
0.49,0.39,0.49,0.39;
3390,3240,3210,2240];
b = [16;0.9;0.8;100;0.5;1.2;0.6;3310];
Aeq=[];
beq=[];
lb = [0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000];
ub = [];
[x,fval]=linprog(f,A,b,Aeq,beq,lb,ub)
end

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐