JuliaOpt / MathProgBase.jl

DEPRECATED: Solver-independent functions (i.e. linprog and mixintprog) and low-level interface for Mathematical Programming
Other
80 stars 38 forks source link

Implementing Ipopts "new_x" feature #195

Closed GravityAssisted closed 6 years ago

GravityAssisted commented 6 years ago

Ipopt has a boolean argument in all of its user supplied functions, called new_x, defined here. For example for eval_f:

virtual bool eval_f(Index n, const Number* x,  bool new_x, Number& obj_value)

new_x: (in), false if any evaluation method was previously called with the same values in x, true otherwise.
The boolean variable new_x will be false if the last call to any of the evaluation methods (eval_*) used the same x values. This can be helpful when users have efficient implementations that calculate multiple outputs at once. IPOPT internally caches results from the TNLP and generally, this flag can be ignored.

This allows a user to remove computations from eval_f computation if any eval_* method has already been called, saving a ton a runtime in some cases (my) . Is this feature available via the MathProgBase interface ? if not, do you all think that this can be implemented ?

thanks, Nitin

mlubin commented 6 years ago

We do not and will not support this. The recommended workaround is to store the x vector in your evaluator and just check if you've been called again with the same vector. If the function is truly expensive then this check should have no performance implications.

GravityAssisted commented 6 years ago

Understood and thats what I am doing now, just wanted to check if this feature was hidden or on the horizon. thanks.