LP error the number of rows of A must be the same with b
2 vues (au cours des 30 derniers jours)
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
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
Jan
le 23 Fév 2018
Modifié(e) : Jan
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.
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!