LP error the number of rows of A must be the same with b
Afficher commentaires plus anciens
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 commentaires
Torsten
le 23 Fév 2018
MATLAB doesnt't seem to agree that A[8x8] and b[8x1].
So we will have to see your code in order to clarify things.
Jan
le 23 Fév 2018
No. Without knowing any details and seeing the code, it is impossible to help.
Please edit the question and insert the required details. We need the relevant part of the code and a copy of the complete error message.
Nikolas Spiliopoulos
le 23 Fév 2018
Nikolas Spiliopoulos
le 23 Fév 2018
Réponses (1)
Jan
le 23 Fév 2018
[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 commentaires
Nikolas Spiliopoulos
le 23 Fév 2018
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.
Nikolas Spiliopoulos
le 26 Fév 2018
Catégories
En savoir plus sur Linear Programming and Mixed-Integer Linear Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!