sIpopt extension in JuMP?

Hi, is there a way to use the sIpopt extension to Ipopt ( within JuMP?

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.

1 Like

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:

    typedef std::map<std::string, std::vector<std::string> > StringMetaDataMapType;
    typedef std::map<std::string, std::vector<Index> > IntegerMetaDataMapType;
    typedef std::map<std::string, std::vector<Number> > NumericMetaDataMapType;

I do not know if sIpopt2 gives a better support. Nonetheless, the package looks a bit abandonned.

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.

1 Like

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:

# declare AMPL suffixes for sIPOPT code
suffix sens_state_0, IN;
suffix sens_state_1, IN;
suffix sens_state_value_1, IN;
suffix sens_init_constr, IN;
suffix sens_sol_state_1, OUT;

The inputs are then passed through the input suffixes, for example:

var x;
let x.sens_state_0 := 1;

Once the perturbed solution is found, the output can be accessed via, for example:


Could you give an example of how MOI variable and constraint attributes can be modified to mimic the AMPL suffixes? Thank you.

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.)