Search code examples
scipyopenmdao

Distinguishing between iterations and function evaluations in OpenMDAO SciPy SLSQP


I am using SLSQP through OpenMDAO to solve an optimization problem. The optimization is working adequately; the SLSQP output at the end reads:

Optimization terminated successfully.    (Exit mode 0)
            Current function value: [-0.07475851]
            Iterations: 44
            Function evaluations: 87
            Gradient evaluations: 44
Optimization Complete

I am now trying to post-process the results and examine the convergence of the optimization throughout iterations. When I access the iterations through the sqlite dictionary via

db = sqlitedict.SqliteDict('opt_record.sqlite','iterations')
db.keys()

then I see 87 records. So the "iterations" here are really referring to the function evaluations. Obviously this can give an idea of convergence as well, but is there any way to truly access the iteration information, either through some output mechanism or by back-calculating which function evaluations refer to the end of an iteration?


Solution

  • in SLSQP you can get function calls from one of two ways:

    1. iterations, or Major iterations
    2. line search's

    Both of those things get recorded by the case recorder, and there isn't any way for OpenMDAO to distinguish between them. You can filter them out though, becasuse major iterations will always come just before a derivative calculation. So cases that don't have any derivatives most likely came from the line-searches.