Search code examples
iterationampl

How can I get the number of iterations in AMPL?


I can get the number of variables using _nvars. Then, I tried _niters and _niterations but don't work.

I have also searched it in the manual unsuccessfully.

Is there a simple way to get the number of iterations, other than extracting it from solve_message (e.g. with regular expressions)?


Solution

  • To the best of my knowledge there is no built-in parameter representing a number of iterations in AMPL. In fact, this is very solver specific and different solvers and even different algorithms within a single solver may have multiple different iteration counts, such as MIP iterations, Simplex iterations, master iterations when using decomposition, etc. Your best bet is probably to parse the solver message.