It seems that MadNLP does not support general NLP problem

I recently used the solver MadNLP to solve the following NLP problem, but the terminal reported that it didn’t support this problem. Isn’t MadNLP a general NLP solver?

using MadNLP, JuMP
m = Model(() → MadNLP.Optimizer(print_level=MadNLP.INFO, max_iter=100))
@variable(m, 0 <= x1 <= 40, start=23.564546)
@variable(m, 0 <= x2 <= 40, start=33.235712480000004)
@objective(m, Min, x1^0.7 + x2^3)
optimize!(m)

ERROR: The solver does not support an objective function of type MathOptInterface.ScalarNonlinearFunction.

Hi,
Could it be the same symptom as NLP: Attribute ScalarNonlinearFunction is not supported by the model, that is that MadNLP doesn’t support the new simplified syntax for nonlinear problem (that your are using) introduced in JuMP 1.15 (Sept 2023).

Have you tried with NLopbjective instead?

Thanks, if I change the syntax to what you have said, it works.

Great! Just a quick question: MadNLP last release v0.8.3 is from May 2024, so 6 months after JuMP 1.15. I didn’t see something about supporting the new nonlinear syntax in the last few release notes. But on the other hand, I didn’t find a corresponding issue.

If you can confirm that your first example fails on their latest release, perhaps this would make a nice minimal reproducible example for opening a ticket?

Sorry, I have never report a issue with any code. But this is the latest version of MadNLP.

MadNLP started supporting the new nonlinear interface with v0.8 via Add support for MOI.ScalarNonLinearFunction by frapac · Pull Request #280 · MadNLP/MadNLP.jl · GitHub as detailed in their NEWS.md.

Edit: When I run your code snipped on MadNLP v0.8.3, it runs:

julia> optimize!(m)
This is MadNLP version v0.8.3, running with umfpack

Number of nonzeros in constraint Jacobian............:        0
Number of nonzeros in Lagrangian Hessian.............:        2

Total number of variables............................:        2
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        2
                     variables with only upper bounds:        0
Total number of equality constraints.................:        0
Total number of inequality constraints...............:        0
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  3.6721719e+04 0.00e+00 1.00e+02  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  5.0033422e+03 0.00e+00 2.56e+01  -1.0 1.61e+01    -  2.94e-01 1.00e+00f  1
   2  6.6380159e+02 0.00e+00 6.40e+00  -1.0 8.41e+00    -  9.90e-01 1.00e+00f  1
   3  9.5905322e+01 0.00e+00 1.60e+00  -1.0 1.02e+01    -  1.00e+00 1.00e+00f  1
   4  1.6480842e+01 0.00e+00 3.95e-01  -1.0 8.67e+00    -  1.00e+00 1.00e+00f  1
   5  3.1471060e+00 0.00e+00 9.98e-02  -1.7 3.78e+00    -  1.00e+00 1.00e+00h  1
   6  1.2258080e+00 0.00e+00 7.39e-02  -2.5 1.29e+00    -  1.00e+00 5.02e-01h  1
   7  5.8767314e-01 0.00e+00 3.23e-02  -2.5 4.55e-01    -  4.00e-02 1.00e+00h  1
   8  5.3770297e-01 0.00e+00 2.50e-02  -2.5 2.49e-02   0.0 1.00e+00 1.00e+00h  1
   9  1.8731414e-01 0.00e+00 2.61e-02  -3.8 3.59e+00    -  9.62e-01 5.96e-02h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  3.3918868e-02 0.00e+00 6.45e-03  -3.8 2.67e-01    -  1.00e+00 1.00e+00h  1
  11  1.2221136e-02 0.00e+00 1.47e-03  -3.8 1.27e-01    -  1.00e+00 1.00e+00h  1
  12  1.8567706e-03 0.00e+00 2.28e+00  -5.7 6.99e-02    -  1.00e+00 7.09e-01h  1
  13  1.7955573e-03 0.00e+00 1.63e+01  -5.7 5.11e-02    -  1.00e+00 2.42e-02h  2
  14  3.0429784e-04 0.00e+00 7.65e-01  -5.7 5.53e-02    -  1.00e+00 1.00e+00h  1
  15  1.5877900e-04 0.00e+00 1.10e+00  -5.7 2.67e-02    -  2.06e-01 1.00e+00h  1
  16  1.4912648e-04 0.00e+00 2.36e-02  -5.7 9.42e-03    -  1.00e+00 1.00e+00h  1
  17  1.0328040e-04 0.00e+00 5.47e-02  -5.7 2.47e-03    -  1.00e+00 1.00e+00h  1
  18  1.0740071e-04 0.00e+00 1.31e-03  -5.7 1.39e-04    -  1.00e+00 1.00e+00h  1
  19  1.0715355e-04 0.00e+00 3.71e-06  -5.7 3.32e-07    -  1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20  6.7240224e-05 0.00e+00 2.31e-01  -8.6 9.09e-03    -  1.00e+00 3.50e-01h  2
  21  4.0295309e-05 0.00e+00 1.69e-01  -8.6 9.92e-03    -  1.00e+00 4.29e-01h  2
  22  2.4032511e-05 0.00e+00 2.63e-01  -8.6 8.75e-03    -  1.00e+00 3.95e-01h  2
  23  1.4015849e-05 0.00e+00 3.06e-01  -8.6 7.50e-03    -  1.00e+00 4.04e-01h  2
  24  7.8921046e-06 0.00e+00 4.11e-01  -8.6 6.21e-03    -  1.00e+00 3.92e-01h  2
  25  4.0412565e-06 0.00e+00 5.49e-01  -8.6 5.08e-03    -  1.00e+00 3.76e-01h  2
  26  1.3875878e-06 0.00e+00 3.57e-01  -8.6 4.13e-03    -  1.00e+00 3.13e-01h  2
  27  9.0975161e-07 0.00e+00 2.10e+02  -8.6 3.22e-07   8.6 1.00e+00 4.82e-03h  4
  28  2.2812992e-07 0.00e+00 3.83e+00  -8.6 3.53e-03    -  1.00e+00 1.00e+00h  1
  29  1.4206589e-07 0.00e+00 2.40e+01  -8.6 5.10e-10  10.8 1.00e+00 2.50e-01h  3
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30  9.3339023e-08 0.00e+00 4.27e+01  -8.6 7.68e-10  11.2 1.00e+00 6.25e-02h  5
  31  8.5192234e-08 0.00e+00 5.45e+01  -8.6 2.05e-11  12.5 1.00e+00 2.50e-01h  3
  32  5.9706984e-08 0.00e+00 3.51e+01  -8.6 1.11e-03    -  1.00e+00 1.00e+00h  1
  33  3.7459299e-08 0.00e+00 6.25e+01  -8.6 6.15e-11  12.1 1.00e+00 2.50e-01h  3
  34  3.3223540e-08 0.00e+00 8.70e+01  -8.6 3.54e-12  13.4 1.00e+00 5.00e-01h  2
  35  3.1225842e-08 0.00e+00 1.22e+02  -8.6 2.40e-12  13.8 1.00e+00 2.50e-01h  3
  36  3.0490054e-08 0.00e+00 1.57e+02  -8.6 2.60e-12  14.2 1.00e+00 6.25e-02h  5
  37  2.9710386e-08 0.00e+00 3.52e+02  -8.6 1.84e-12  14.7 1.00e+00 6.25e-02h  5
  38  2.9641153e-08 0.00e+00 4.71e+02  -8.6 5.23e-15  16.9 1.00e+00 1.00e+00h  1
  39  2.9586595e-08 0.00e+00 8.78e+02  -8.6 2.79e-15  17.3 1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  40  2.7725525e-08 0.00e+00 5.66e+02  -8.6 6.74e-05    -  1.00e+00 1.00e+00h  1
  41  2.7699457e-08 0.00e+00 8.04e+02  -8.6 1.20e-15  17.8 1.00e+00 1.00e+00h  1
  42        NaN 0.00e+00    NaN  -8.6 7.52e-16  18.2 1.00e+00 1.00e+00h  1
  43r       NaN 0.00e+00 2.51e-01  -8.6    NaN    -  1.00e+00 1.00e+00h  1
EXIT: Restoration Failed

I suspect you might have have an older package version. You can check via

julia> ]

(@1.10) pkg> st

Thanks for the feedback. I missed that news because 0.8.0 is not listed in the Release page

Thanks for the feedback, it does work. I have used version 0.7.0 due to the compatibility issue.