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

2 vues (au cours des 30 derniers jours)
Gustave X
Gustave X le 8 Jan 2023
Commenté : Gustave X le 10 Jan 2023
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 commentaires
Torsten
Torsten le 8 Jan 2023
Can't you choose how to proceed depending on the linprog exitflag ?
Gustave X
Gustave X le 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.

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 8 Jan 2023
Déplacé(e) : Matt J le 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

Plus de réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by