Skip to content

Unable to get speed up with FATROP compared to IPOPT #45

Description

@ruturajsambhusvt

Hello,

We are working on an NMPC problem in CasADi (C++). With IPOPT-ma57, I get ~5 ms solve time with max_iter = 10. We compile the solver to .so, and load the solver back to use it for our problem.

I updated the sparsity structure. Please find attached the plot showing the sparsity structure of the problem.

With FATROP, the system is stabilized, but the solve time is more than 20 ms for max_iter = 10. I am attaching a log with details of the evaluation and solve times. Further, it prints huge matrices in the terminal, and I couldn't find any option to stop that.

These are the options I am using-

  'opts["equality"] = equality_vec;
    opts["structure_detection"] = "manual";  // start with auto
    opts["debug"] = false;                 // generates debug_fatrop_*.mtx
    opts["print_time"] = true;
    opts["expand"] = false;
    opts["fatrop"] = Dict{
        {"max_iter", 10},   // try 1, then 2 or 3
        {"tol", 1e-2} ,     // loosen if needed
        {"print_level", 6},  // increase for more verbosity
        };

    // opts["jit"] = true;
    // opts["jit_temp_suffix"] = false;
    // // opts["compiler"] = "shell";
    // opts["jit_options"] = Dict{{"flags", "-O3"}, {"verbose", true}, {"compiler", "gcc"}};
    
     // Fatrop OCP structure parameters (required for manual structure detection)
    opts["N"] = static_cast<int>(params.N);
    
    std::vector<int> nx_vec(params.N + 1, n_states);
    opts["nx"] = nx_vec;
    
    std::vector<int> nu_vec(params.N, n_inputs);
    nu_vec.push_back(0);
    opts["nu"] = nu_vec;
    
    // ng: inequality constraints per stage (friction cones only, dynamics are handled separately)
    std::vector<int> ng_vec(params.N, 16);
    ng_vec.push_back(0);
    opts["ng"] = ng_vec;


    // Create an NLP solver instance
    Function solver = nlpsol("solver", "fatrop", nlp_prob, opts);`

log_fatprt.txt

Image

It will be great if you can guide us to achieve the performance gains of FATROP. Please let me know if you need any additional details.

Tagging my colleagues- @taizoonaliasgar @AliMMSadeghi @Ketan13294

Thank you,
Ruturaj

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions