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

2 views (last 30 days)
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 Comments
Torsten
Torsten on 8 Jan 2023
Can't you choose how to proceed depending on the linprog exitflag ?
Gustave X
Gustave X on 8 Jan 2023
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.

Sign in to comment.

Accepted Answer

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

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!