I can set up a JuMP model with a call to the AMPL sIpopt executable using AmplNLWriter.jl. However, storing sIpopt solutions requires AMPL suffixes, which don’t have an equivalent in JuMP. Is there a way around this?
As far as I know, there is no way to call directly sIpopt from JuMP currently. But I agree that would be a nice extension. I recommend you having a look at :
However ParameterJuMP.jl does not support pure NLP problems, as sIpopt. Last time I checked though, I did not find a C API available for sIpopt, so currently I think we should stick to AmplNLWriter.
My own opinion is that at some point it could be useful to have a MOI extension that supports parametric optimization. That would pave the road to a Julia equivalent of cvxpylayer.
Thank you, I mainly want to get NLP sensitivities through sIpopt.
Pyomo/AMPL/C have extensions to sIpopt and other platforms like Casadi have frameworks to directly access the NLP sensitivities. I agree it would be nice to have a Julia equivalent.
You are right. Looking at the code of the AMPL interface, it appears that sIpopt overloads the method get_var_con_metadata to pass the parameters to Ipopt (provided that sIpopt was compiled before).
I think it’s doable to mirror the behavior of the function get_var_con_metadata in Ipopt.jl, but this is not a trivial job though. One major difficulty is that the function get_var_con_metadata does not seem to be mirrored in Ipopt’s C interface.
Further, the signature of this function
virtual bool get_var_con_metadata(Index n,
StringMetaDataMapType& var_string_md,
IntegerMetaDataMapType& var_integer_md,
NumericMetaDataMapType& var_numeric_md,
Index m,
StringMetaDataMapType& con_string_md,
IntegerMetaDataMapType& con_integer_md,
NumericMetaDataMapType& con_numeric_md)
depends on non-trivial type, as the map structure of the std:
The equivalent of AMPL suffixes are variable and constraint attributes (see MathOptInterface docs). Could you explain how sIpopt uses AMPL suffixes? It’s likely a question of connecting the plumbing through AmplNLWriter.
sIpopt calculates parametric NLP sensitivities and provides perturbed solutions for perturbed parameters.
The AMPL model needs suffixes to communicate certain inputs to sIpopt - these inputs relate to nominal and perturbed values of the parameters, and some additional flags. The model also needs a suffix to store the perturbed solution from sIpopt. These suffixes are declared in AMPL as follows:
This is likely very non-trivial. How are the sensitivities returned by sIpopt? Programatically or via the .sol file? Either way, it’s probably easier to write a new sIpopt.jl package and to modify an existing one. (And that isn’t really that easy.)