Why does the [x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub) function return only integer numbers?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I'm doing an optimization problem where I use the [x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub) funtion. However, the results I get give me only integer numbers. For example, I'm expecting a result like 1.710, but I get 2.0. When I expect a value of 0.855, I get 1.0
How can I get the rational numbers with decimals, instead of only integer numbers?
8 comentarios
Torsten
el 28 de Oct. de 2022
If you know a solution you can live with, you don't need an optimizer, do you ?
Respuestas (1)
Sarthak
el 11 de Sept. de 2023
Hi Romeo,
I understand that you want to set the precision of the output variable.
You can use the format function to set the precision of the output.
format long
x,fval,exitflag,output,lambda = linprog(f,A,b,Aeq,beq,lb,ub);
To know more information about the “format” function, you can visit the documentation page of format.
I hope this solves your query.
0 comentarios
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!