PDA

查看完整版本 : [MATLAB数学相关] linprog解线性规划问题无可行解,但lindo能解出来


qinghuazhu
2009-08-28, 15:33
现在正做一篇论文的模拟实验,需要用到matlab解线性规划,但遇到了下面的问题:

f = [256; 256; 121; 225; 196; 196; 225; 121; 125; 144; 169; 225]
Aeq =
[1 0 0 0 0 0 0 0 0 0 0 0;
0 1 0 0 0 0 0 0 0 0 0 0;
-1 -1 0 0 0 0 0 0 0 0 0 0;
0 0 -1 0 1 0 0 0 0 0 0 0;
0 0 0 -1 0 1 0 0 0 0 0 0;
0 0 0 0 -1 -1 0 0 0 0 0 0;
0 0 1 0 0 0 -1 0 0 0 0 0;
0 0 0 0 0 0 0 -1 0 0 0 1;
0 0 0 0 0 0 1 0 -1 0 0 0;
0 0 0 0 0 0 0 0 0 1 1 0;
0 0 0 0 0 0 0 0 0 -1 0 0;
0 0 0 0 0 0 0 0 0 0 -1 0;
0 0 0 1 0 0 0 0 0 0 0 -1;
0 0 0 0 0 0 0 1 1 0 0 0]
beq = [1;0;-1;0;0;-1;0;0;0;1;0;-1;0;1]
lb=zeros(12,1)
ub=ones(12,1)
A=[]
b=[]
调用[x,fval,exitflag,output,lambda] = linprog(f,[],[],Aeq,beq,lb,ub)
得到结果为:
Exiting: The primal is infeasible; the equality constraints are dependent
but not consistent.

利用lindo解出的结果为:y = [1;0;1;0;1;0;1;0;1;0;1;0]

经验证Aeq * y = beq,说明lindo解出来的结果确实为可行解,但matlab提示不可行。希望大家花点时间看看,谢谢。