User defined callback for early termination? #3684
Replies: 1 comment
-
The answer is 'yes.' At least through the Python API. You return a list from eval: [1] to continue, [0] to terminate early. Note: the documentation and examples for using the callback class correctly are not clear. For my use case, I had to override several of the built in methods, and figuring out what/how to override them correctly was a pretty tedious reverse engineering job. Also, if you don't pass back a correct datatype from your eval function, the solver will barf and give an error message that repeats something to the effect "function_call returned type with exception" many, many times without explaining which types were acceptable. Lots of trial and error and there, lol. |
Beta Was this translation helpful? Give feedback.
-
Reading through the examples of user-defined callbacks with nlpsol, I can't seem to find one which computes a custom early termination condition. Is this possible?
In particular, I'd be able to monitor the objective quality of the best primal-feasible iterate found so far, and return after that value has stabilized.
Vanilla IPopt has the ability to do something like this be defining a custom intermediate_callback method, wherein returning a 'false' value forces a user-defined return. Anything similar with the generic nlpsol interface?
Beta Was this translation helpful? Give feedback.
All reactions