LP error the number of rows of A must be the same with b
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nikolas Spiliopoulos
el 23 de Feb. de 2018
Comentada: Nikolas Spiliopoulos
el 26 de Feb. de 2018
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 comentarios
Respuestas (1)
Jan
el 23 de Feb. de 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 comentarios
Jan
el 23 de Feb. de 2018
Editada: Jan
el 23 de Feb. de 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.
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!