draw a convergence graph when using yalmip

12 views (last 30 days)
照旭
照旭 on 25 Oct 2023
Answered: Prathamesh on 3 Jun 2025
How to draw a convergence graph when using yalmip to solve optimization problems? And check the number of iterations and the results of each iteration.

Answers (1)

Prathamesh
Prathamesh on 3 Jun 2025
Hi @照旭,
I understand that you want to draw a convergence graph using yalmip to solve optimization problem and want to check the number of iterations as well as result of each iteration.
Below are steps to check the number of iterations:
  • Enable Verbode output after installing YALMIP in your system.
  • Use a solver that supports iteration info. Solver like “IPOPT” provide detail iteration logs. YALMIP itself does not track iterations.
  • Capture solver output using “optimize”
sol=optimize(constraints,objective,options);
And then check the solver status using “sol.info” and problem code using “sol.problem”.
  • Extract Iteration data
diaryon
optimize(constraints,objective,options);
diaryoff
  • Manually track object value and update the model or parameters using “optimize.
  • Plot the convergence graph using MATLAB “plot” function.
Please refer below documentation links for IPOPT” and “optimize”

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!