matlab中linprog问题max f=0.15x1+0.1x2+0.08 x3+0.12 x4 s.t x1-x2- x3- x4≤0 x2+ x3- x4≥0 x1+x2+x3+ x4=1 xj≥0 j=1,2,3,4 这个应该怎么编呀?C=[-0.15 -0.1 -0.08 -0.12];Aeq=[1 1 1 1];beq=1;A=[1 -1 -1 -10 -1 -1 1];b=[0,0];vlb=[];vub=[];[x,fva
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 04:13:42
matlab中linprog问题max f=0.15x1+0.1x2+0.08 x3+0.12 x4 s.t x1-x2- x3- x4≤0 x2+ x3- x4≥0 x1+x2+x3+ x4=1 xj≥0 j=1,2,3,4 这个应该怎么编呀?C=[-0.15 -0.1 -0.08 -0.12];Aeq=[1 1 1 1];beq=1;A=[1 -1 -1 -10 -1 -1 1];b=[0,0];vlb=[];vub=[];[x,fva
matlab中linprog问题
max f=0.15x1+0.1x2+0.08 x3+0.12 x4
s.t x1-x2- x3- x4≤0
x2+ x3- x4≥0
x1+x2+x3+ x4=1
xj≥0 j=1,2,3,4
这个应该怎么编呀?
C=[-0.15 -0.1 -0.08 -0.12];
Aeq=[1 1 1 1];beq=1;
A=[1 -1 -1 -1
0 -1 -1 1];
b=[0,0];
vlb=[];vub=[];
[x,fval]=linprog(c,A,b,Aeq,beq,vlb,vub)
按照自己编的,运行以后出现这个:
Error using ==> linprog
The number of columns in A must be the same as the length of f.
matlab中linprog问题max f=0.15x1+0.1x2+0.08 x3+0.12 x4 s.t x1-x2- x3- x4≤0 x2+ x3- x4≥0 x1+x2+x3+ x4=1 xj≥0 j=1,2,3,4 这个应该怎么编呀?C=[-0.15 -0.1 -0.08 -0.12];Aeq=[1 1 1 1];beq=1;A=[1 -1 -1 -10 -1 -1 1];b=[0,0];vlb=[];vub=[];[x,fva
C=[-0.15 -0.1 -0.08 -0.12];
Aeq=[1 1 1 1];beq=1;
A=[1 -1 -1 -1
0 -1 -1 1];
b=[0,0];
vlb=[];vub=[];
[x,fval]=linprog(C,A,b,Aeq,beq,vlb,vub)
原程序中c应该是大写C
结果如下
x =
1.0e+015 *
0.0000
3.3256
-3.3256
-0.0000
fval =
-6.6512e+013