用matlab求方程组的解,必须用矩阵知识。
w1=2000;w2=3000;w3=1000;w4=500;w5=4000;w6=2000;w7=1000;t1=48.7;t2=51.9;t3=61.2;t4=71....
w1=2000;
w2=3000;
w3=1000;
w4=500;
w5=4000;
w6=2000;
w7=1000;
t1=48.7;
t2=51.9;
t3=61.2;
t4=71.8;
t5=48.7;
t6=51.9;
t7=64.0;
w1*n11+w2*n21+w3*n31+w4*n41+w5*n51+w6*n61+w7*n71+w1*n12+w2*n22+w3*n32+w4*n42+w5*n52+w6*n62+w7*n72<=80000
t1*n11+t2*n21+t3*n31+t4*n41+t5*n51+t6*n61+t7*n71+t1*n12+t2*n22+t3*n32+t4*n42+t5*n52+t6*n62+t7*n72<=2040
lt<=302.7
n11+n12<=8
n21+n22<=7
n31+n32<=9
n41+n42<=6
n51+n52<=6
n61+n62<=4
n71+n72<=8
0<=n11,n12,n21,n22,n31,n32,n41,n42,n51,n52,n61,n62,n71,n72 且为整数
目标函数 max=t1*n11+t2*n21+t3*n31+t4*n41+t5*n51+t6*n61+t7*n71+t1*n12+t2*n22+t3*n32+t4*n42+t5*n52+t6*n62+t7*n72
答案满意,追加分!
Lt=t5*n51+t5*n52+t6*n61+t6*n62+t7*n71+t7*n72 展开
w2=3000;
w3=1000;
w4=500;
w5=4000;
w6=2000;
w7=1000;
t1=48.7;
t2=51.9;
t3=61.2;
t4=71.8;
t5=48.7;
t6=51.9;
t7=64.0;
w1*n11+w2*n21+w3*n31+w4*n41+w5*n51+w6*n61+w7*n71+w1*n12+w2*n22+w3*n32+w4*n42+w5*n52+w6*n62+w7*n72<=80000
t1*n11+t2*n21+t3*n31+t4*n41+t5*n51+t6*n61+t7*n71+t1*n12+t2*n22+t3*n32+t4*n42+t5*n52+t6*n62+t7*n72<=2040
lt<=302.7
n11+n12<=8
n21+n22<=7
n31+n32<=9
n41+n42<=6
n51+n52<=6
n61+n62<=4
n71+n72<=8
0<=n11,n12,n21,n22,n31,n32,n41,n42,n51,n52,n61,n62,n71,n72 且为整数
目标函数 max=t1*n11+t2*n21+t3*n31+t4*n41+t5*n51+t6*n61+t7*n71+t1*n12+t2*n22+t3*n32+t4*n42+t5*n52+t6*n62+t7*n72
答案满意,追加分!
Lt=t5*n51+t5*n52+t6*n61+t6*n62+t7*n71+t7*n72 展开
1个回答
展开全部
w=[2000,3000,1000,500,4000,2000,1000];
t=[48.7,51.9,61.2,71.8,48.7,51.9,64.0];
f=-[t,t]'; %求最大值,化成求负数的最小值
A=[
w,w;
t,t;
0,0,0,0,t(5),t(6),t(7),0,0,0,0,t(5),t(6),t(7); %t5*n51+t5*n52+t6*n61+t6*n62+t7*n71+t7*n72<=302.7
1,0,0,0,0,0,0,1,0,0,0,0,0,0; %n11+n12<=8
0,1,0,0,0,0,0,0,1,0,0,0,0,0; %n21+n22<=7
0,0,1,0,0,0,0,0,0,1,0,0,0,0; %n31+n32<=9
0,0,0,1,0,0,0,0,0,0,1,0,0,0; %n41+n42<=6
0,0,0,0,1,0,0,0,0,0,0,1,0,0; %n51+n52<=6
0,0,0,0,0,1,0,0,0,0,0,0,1,0; %n61+n62<=4
0,0,0,0,0,0,1,0,0,0,0,0,0,1; %n71+n72<=8
];
B=[80000;2040;302.7;8;7;9;6;6;4;8];
intlist=ones(14,1); %n全部都是整数
xmin=zeros(14,1); %n变量最小值都是0
xmax=inf*ones(14,1); %最大值不设置
ctype=-1*ones(10,1); %所有约束都是小于等于约束,这里有10个条件
[n,how]=ipslv_mex(f,A,B,intlist,xmax,xmin,ctype)
%如果how=0的话,说明找到最优解
fmax=-f'*n %这里还原负值
%%%%%%%%%%%%
ipslv_mex得去网上找
t=[48.7,51.9,61.2,71.8,48.7,51.9,64.0];
f=-[t,t]'; %求最大值,化成求负数的最小值
A=[
w,w;
t,t;
0,0,0,0,t(5),t(6),t(7),0,0,0,0,t(5),t(6),t(7); %t5*n51+t5*n52+t6*n61+t6*n62+t7*n71+t7*n72<=302.7
1,0,0,0,0,0,0,1,0,0,0,0,0,0; %n11+n12<=8
0,1,0,0,0,0,0,0,1,0,0,0,0,0; %n21+n22<=7
0,0,1,0,0,0,0,0,0,1,0,0,0,0; %n31+n32<=9
0,0,0,1,0,0,0,0,0,0,1,0,0,0; %n41+n42<=6
0,0,0,0,1,0,0,0,0,0,0,1,0,0; %n51+n52<=6
0,0,0,0,0,1,0,0,0,0,0,0,1,0; %n61+n62<=4
0,0,0,0,0,0,1,0,0,0,0,0,0,1; %n71+n72<=8
];
B=[80000;2040;302.7;8;7;9;6;6;4;8];
intlist=ones(14,1); %n全部都是整数
xmin=zeros(14,1); %n变量最小值都是0
xmax=inf*ones(14,1); %最大值不设置
ctype=-1*ones(10,1); %所有约束都是小于等于约束,这里有10个条件
[n,how]=ipslv_mex(f,A,B,intlist,xmax,xmin,ctype)
%如果how=0的话,说明找到最优解
fmax=-f'*n %这里还原负值
%%%%%%%%%%%%
ipslv_mex得去网上找
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询