clear
A=[-1 0 -1 0; 0 -1 0 -1; 1 1 0 0; 0 0 1 1];
b=[-50 -70 80 45];
f=[0.5; 0.6; 0.4; 0.55];
options = optimoptions('linprog','Algorithm','dual-simplex');
[x,fval,exitflag,output] = linprog(f,A,b,[],[],[],[],options);
上面显示的代码产生一个无界结果Problem is unbounded
,其中Lindo和Excel Solver找到最佳目标函数值62.5
答案 0 :(得分:0)
当我运行时:
clear
A=[-1 0 -1 0; 0 -1 0 -1; 1 1 0 0; 0 0 1 1];
b=[-50 -70 80 45];
f=[0.5; 0.6; 0.4; 0.55];
options = optimoptions('linprog','Algorithm','simplex','display','iter');
x0=[0 0 0 0]'
[x,fval,exitflag,output] = linprog(f,A,b,[],[],[],[],x0,options);
我明白了:
Phase 1: Compute initial basic feasible point.
Iter Infeasibility
0 120
1 70
2 40
3 -0
Phase 2: Minimize using simplex.
Iter Objective Dual Infeasibility
f'*x A'*y+z-w-f
0 63 0.111803
1 62.5 0.05
Exiting: The problem is unbounded; the constraints are not restrictive enough.
与你提到的解决方案相同。
但是没有什么能阻止求解器增加x
答案 1 :(得分:0)
这是正确的行为考虑了matlab的linprog
正在做什么。
观察的原因如下:
linprog
假设变量免费(( - inf,inf),如果没有给出约束),就像你的情况一样你的解决方案(用Lindo观察)就是那个解决方案 - 向量被限制为非负的。
这可以通过约束或使用边界来表达。文档给出了以下示例:
Example: To specify that all x-components are positive, lb = zeros(size(f))
# personal opinion: this should be called "nonnegative"
我不是Matlab用户,但使用我的工具,我可以验证:
备注:许多数学编程框架/求解器假设解决方案向量默认为非负,这与linprog
正在做的不同。前者是潜在算法理论的结果。