Hi all,
I'm using CasADi to setup an optimization problem in C++ that I want to call repeatedly with different parameters, in a for loop.
To speed up the loop I would like to suppress the output of ipopt (solver I'm using for the nlp), saving only a return value each time the solver is called, for instance a boolean set to true if the optimal solution has been found, false otherwise.
Is this possible? I have tried reading both the CasADI C++ API docs and ipopt manual and it seems like i need to set the "print_level" option to 0, but I was unable to do it.
As an example:
//// C++ Code
SXDict nlp = {{"x",x},{"f",f},{"g",constraints}};
Dict opts_dict = Dict();
Function solver = nlpsol("solver","ipopt",nlp,opts);
If I try to do
//// C++ Code
opts_dict["print_level"] = 0;
I get an error at runtime:
Unknown option: print_level
Did you mean one of the following?
> "print_time" [OT_BOOL] "print information about execution time"
> "compiler" [OT_STRING] "Just-in-time compiler plugin to be used."
> "con_string_md" [OT_DICT] "String metadata (a dictionary with lists of strings) about constraints to be passed to IPOPT"
> "ipopt" [OT_DICT] "Options to be passed to IPOPT"
> "output_scheme" [OT_STRINGVECTOR] "Custom output scheme"
Use print_options() to get a full list of options.
Is there a way to achieve this? It seems a pretty useful thing to do (and it surprised me that I couldn't find on the web a solution). Probably it's trivial and I'm not getting it.
Thank you all in advance.
Best,
Danilo Caporale