LP error the number of rows of A must be the same with b
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi again,
I am trying to run and LP optimization.
However, I am getting the following error
"The number of rows in A must be the same as the number of elements of b."
The problem is that the size of my matrices are: A [8X8] and b[8x1], so I don't really get where the error is
can you help?
thanks
Nikolas
댓글 수: 4
답변 (1개)
Jan
2018년 2월 23일
[x,fval] = linprog(f,A,b,Aeq,beq,lb,ub,options)
Your code:
[x,fval] = linprog(f,x0,A,b,Aeq,beq,lb,[],options)
What is x0? It seems to be misplaced here and linprog compare the sizes of x0 and A instead of A and b.
댓글 수: 3
Jan
2018년 2월 23일
편집: Jan
2018년 2월 23일
When I run it, I get: "The problem is infeasible. Linprog stopped because no point satisfies the constraints." Which Matlab version are you using?
I'm confused also. In doc linprog I find:
[x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub,options)
In the source of linprog.m it is:
[x,fval,exitflag,output,lambda] = linprog(f,A,B,Aeq,Beq,lb,ub,x0,options)
^^ ???
So try this (dangerous: PURE GUESSING!)
[x,fval]=linprog(f,x0,A,b,Aeq,beq,lb,[],[],options);
Sorry, I suggest a gunshot programming method.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!