求数学建模高手——线性规划题,如何用MATLAB编程???~~~~紧急!!!
max=1.15*x4A+1.40*x2C+1.25*x3B+1.06*x5D;x1A+x1D=100000;-1.06*x1D+x2A+x2C+x2D=0;-1.15*...
max=1.15*x4A+1.40*x2C+1.25*x3B+1.06*x5D;
x1A+x1D=100000;
-1.06*x1D+x2A+x2C+x2D=0;
-1.15*x1A+x3A+x3B-1.06*x2D+x3D=0;
-1.15*x2A+x4A-1.06*x3D+x4D=0;
-1.15*x3A-1.06*x4D+x5D=0;
x2C<=30000;
x3B<=40000;
这是我的编程,请问怎样修改???
C=[0 0 0 -1.15 0 0 -1.14 0 0 0 0 0 -1.25 0 0 0 0 0 0 -1.06];
A=[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0;0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 -1.06 1 0 0 0;-1.15 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 -1.06 1 0 0;0 -1.15 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.06 1 0;0 0 -1.15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.06 1];
b=[100000;0;0;0;0];
Xlb=zeros(20,1);
Xub=inf*ones(20,1);
Xub(8)=40000;
Xub(12)=30000;
X0=0*ones(20,1)
neq=1;
X=linprog[C,A,b,Xlb,Xub.X0,neq] 展开
x1A+x1D=100000;
-1.06*x1D+x2A+x2C+x2D=0;
-1.15*x1A+x3A+x3B-1.06*x2D+x3D=0;
-1.15*x2A+x4A-1.06*x3D+x4D=0;
-1.15*x3A-1.06*x4D+x5D=0;
x2C<=30000;
x3B<=40000;
这是我的编程,请问怎样修改???
C=[0 0 0 -1.15 0 0 -1.14 0 0 0 0 0 -1.25 0 0 0 0 0 0 -1.06];
A=[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0;0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 -1.06 1 0 0 0;-1.15 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 -1.06 1 0 0;0 -1.15 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.06 1 0;0 0 -1.15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.06 1];
b=[100000;0;0;0;0];
Xlb=zeros(20,1);
Xub=inf*ones(20,1);
Xub(8)=40000;
Xub(12)=30000;
X0=0*ones(20,1)
neq=1;
X=linprog[C,A,b,Xlb,Xub.X0,neq] 展开
2个回答
展开全部
您的变量应该只有11个,不是20个,下面是我的编程,您看一下:
c=[0 0 0 -1.15 -1.25 -1.40 0 0 0 0 -1.06 ];
>> A=[0,0,0,0,0,1,0,0,0,0,0;0,0,0,0,1,0,0,0,0,0,0];
>> b=[30000;40000];
>> Aeq=[1,0,0,0,0,0,1,0,0,0,0;0,1,0,0,0,1,-1.06,1,0,0,0;-1.15,0,1,0,1,0,0,-1.06,1,0,0;0,-1.15,0,1,0,0,0,0,-1.06,1,0;0,0,-1.05,0,0,0,0,0,0,-1.06,1];
beq=[100000,0,0,0,0];
>> VLB=[0,0,0,0,0,0,0,0,0,0,0];
>> VUB=[];
>> [x,fval]=linprog(c,A,b,Aeq,beq,VLB,VUB)
Optimization terminated successfully.
x =
1.0e+004 *
5.7513
1.5036
0.0000
4.5000
4.0000
3.0000
4.2487
0.0000
2.6140
0.0000
0.0000
fval =
-1.4375e+005
>> 由于是用的求最小,而您的题目是求最大,所以我把您的目标函数的系数都改为了负值,这样只须将最后的函数值前加一个负号就行,即fval=1.4375e+005
c=[0 0 0 -1.15 -1.25 -1.40 0 0 0 0 -1.06 ];
>> A=[0,0,0,0,0,1,0,0,0,0,0;0,0,0,0,1,0,0,0,0,0,0];
>> b=[30000;40000];
>> Aeq=[1,0,0,0,0,0,1,0,0,0,0;0,1,0,0,0,1,-1.06,1,0,0,0;-1.15,0,1,0,1,0,0,-1.06,1,0,0;0,-1.15,0,1,0,0,0,0,-1.06,1,0;0,0,-1.05,0,0,0,0,0,0,-1.06,1];
beq=[100000,0,0,0,0];
>> VLB=[0,0,0,0,0,0,0,0,0,0,0];
>> VUB=[];
>> [x,fval]=linprog(c,A,b,Aeq,beq,VLB,VUB)
Optimization terminated successfully.
x =
1.0e+004 *
5.7513
1.5036
0.0000
4.5000
4.0000
3.0000
4.2487
0.0000
2.6140
0.0000
0.0000
fval =
-1.4375e+005
>> 由于是用的求最小,而您的题目是求最大,所以我把您的目标函数的系数都改为了负值,这样只须将最后的函数值前加一个负号就行,即fval=1.4375e+005
展开全部
很久没用matlab了,可参考下面一个例子:
求下面的优化问题
min
sub.to
解:
>>f = [-5; -4; -6];
>>A = [1 -1 1;3 2 4;3 2 0];
>>b = [20; 42; 30];
>>lb = zeros(3,1);
>>[x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb)
结果为:
x = %最优解
0.0000
15.0000
3.0000
fval = %最优值
-78.0000
exitflag = %收敛
1
output =
iterations: 6 %迭代次数
cgiterations: 0
algorithm: 'lipsol' %所使用规则
lambda =
ineqlin: [3x1 double]
eqlin: [0x1 double]
upper: [3x1 double]
lower: [3x1 double]
>> lambda.ineqlin
ans =
0.0000
1.5000
0.5000
>> lambda.lower
ans =
1.0000
0.0000
0.0000
表明:不等约束条件2和3以及第1个下界是有效的
求下面的优化问题
min
sub.to
解:
>>f = [-5; -4; -6];
>>A = [1 -1 1;3 2 4;3 2 0];
>>b = [20; 42; 30];
>>lb = zeros(3,1);
>>[x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb)
结果为:
x = %最优解
0.0000
15.0000
3.0000
fval = %最优值
-78.0000
exitflag = %收敛
1
output =
iterations: 6 %迭代次数
cgiterations: 0
algorithm: 'lipsol' %所使用规则
lambda =
ineqlin: [3x1 double]
eqlin: [0x1 double]
upper: [3x1 double]
lower: [3x1 double]
>> lambda.ineqlin
ans =
0.0000
1.5000
0.5000
>> lambda.lower
ans =
1.0000
0.0000
0.0000
表明:不等约束条件2和3以及第1个下界是有效的
追问
请问这个原题是??、、、???
‘min
sub.to
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询