关于MATLAB中的linprog函数[x,fval]=linprog(c,a,b,aeq,beq,lb,ub,x0,options)我想知道;1.x,fval是不是最优点与最优解c为求最小值函数的系数向量条件为:a*x
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 13:58:01
关于MATLAB中的linprog函数[x,fval]=linprog(c,a,b,aeq,beq,lb,ub,x0,options)我想知道;1.x,fval是不是最优点与最优解c为求最小值函数的系数向量条件为:a*x
关于MATLAB中的linprog函数
[x,fval]=linprog(c,a,b,aeq,beq,lb,ub,x0,options)
我想知道;
1.x,fval是不是最优点与最优解
c为求最小值函数的系数向量
条件为:a*x
关于MATLAB中的linprog函数[x,fval]=linprog(c,a,b,aeq,beq,lb,ub,x0,options)我想知道;1.x,fval是不是最优点与最优解c为求最小值函数的系数向量条件为:a*x
1.yep,you are right.
2.x0:starting point
options:
x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) minimizes with the optimization options specified in the structure options.Use optimset to set these options.
3.That's OK.Just let the coefficient of x1 to be zero.
4.I think that's fine.But I'm not sure.
Examples
Find x that minimizes
f(x) = –5x1 – 4x2 –6x3,
subject to
x1 – x2 + x3 ≤ 20
3x1 + 2x2 + 4x3 ≤ 42
3x1 + 2x2 ≤ 30
0 ≤ x1,0 ≤ x2,0 ≤ x3.
First,enter the coefficients
f = [-5; -4; -6]
A = [1 -1 1
3 2 4
3 2 0];
b = [20; 42; 30];
lb = zeros(3,1);
Next,call a linear programming routine.
[x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb);
Entering x,lambda.ineqlin,and lambda.lower gets
x =
0.0000
15.0000
3.0000
lambda.ineqlin =
0
1.5000
0.5000
lambda.lower =
1.0000
0
0
Nonzero elements of the vectors in the fields of lambda indicate active constraints at the solution.In this case,the second and third inequality constraints (in lambda.ineqlin) and the first lower bound constraint (in lambda.lower) are active constraints (i.e.,the solution is on their constraint boundaries).
傻子,哥来帮你吧
linprog你都能直接调用了,说明它已经有M文件了
去MATLAB目录下搜索一下linprog.m应该就能找到你要的M文件