How to break the infeasibility of solution for the function linprog?

2 次查看(过去 30 天)
Hello everyone,
I'm working on some heuristic algorithm wich has to return to choose another random initial state and run again.
Inside I loop while I have to solve at each iteration a linear programming by using the functon linprog.
How can I break the programme and return it to the initial state choice when there is no feasible solution to the linear programming problem without stopping the whole program?.
Thank you.
  2 个评论
Gustave X
Gustave X 2023-1-8
sorry but I'm a new user of matlab. However, I know that the error is because of infeasibility reason. I read this https://fr.mathworks.com/help/optim/ug/linprog.html#buusznx-exitflag
but I don't know how to implement it on the program.
Thank you in advance.

请先登录,再进行评论。

采纳的回答

Torsten
Torsten 2023-1-8
移动:Matt J 2023-1-8
[x,fval,exitflag,output] = linprog(___)
if exitflag > 0 % linprog was successful
take action 1
else % linprog was not successful
take action 2
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by