Baron giving worse solution than IPOPT


I am solving a nonlinear optimization problem in AMPL. When I use Baron as the solver, I get a worse solution than when I use Ipopt. The initial lower bound returned by Baron is worse than the optimal solution from Ipopt.

I am not sure what may be the reason for that.

Thank you,

Hi Daniela,

When solving a nonlinear problem, solvers can get stuck in a local optimum which is not global. Ipopt and Baron try to find the global optimum with their own algorithms. Your problem must be non-convex, otherwise, local optimum would be also global.

As Baron can use Ipopt internally, it might feel contradictory that Ipopt-only returns a better solution than Baron’s lower bound. The reason could be that Baron is not calling Ipopt, or if it is being called, the options and initial guesses are different from what you set up when using Ipopt directly.

If you want to find good solutions you could provide initial guesses, tune your solver options, tighten bounds for some variables or the objective… You could also try other solvers like Couenne (open source) or Knitro (commercial solver), and most likely you will end up with more different solutions.

Hope it helps!


Thank you for your answer. Baron says that the optimal solution was found during the preprocessing stage. Thus, it doesn’t do any iterations.
Is there anyway to get around that?

Thank you,


If the problem is solved optimally during presolve, it does not make sense that the lower bound provided by Baron is not the same as the optimal value. Is this related to your first question?

I don’t think it is possible for Baron to disable presolve. Ampl by itself runs presolve, you can disable it with option presolve 0; before sending it to the solver.

Maybe your message comes from AMPL instead of Baron. Could you provide the message you get? Maybe some other notes about your model or script could help to understand the issue.



I have copied here the message that I get with ipopt and with Baron.

I am solving an NMPC problem for a pH process: set-point tracking quadratic objective, nonlinear constraints

Thank you,

Ipopt 3.12.13: tol=1e-08

This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
For more information visit

This is Ipopt version 3.12.13, running with linear solver ma27.

Number of nonzeros in equality constraint Jacobian…: 10184
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian…: 7346

MA27BD returned iflag=-4 and requires more memory.
Increase liw from 157155 to 314310 and la from 251540 to 503438 and factorize again.
MA27BD returned iflag=-4 and requires more memory.
Increase liw from 314310 to 628620 and la from 503438 to 1012218 and factorize again.
Total number of variables…: 2702
variables with only lower bounds: 0
variables with lower and upper bounds: 2700
variables with only upper bounds: 0
Total number of equality constraints…: 2398
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 1.0414871e+05 5.79e+01 9.95e+01 -1.0 0.00e+00 - 0.00e+00 0.00e+00 0
1 1.0268759e+05 5.53e+01 9.58e+01 -1.0 5.89e+01 - 1.54e-02 4.54e-02f 1
MA27BD returned iflag=-4 and requires more memory.
Increase liw from 628620 to 1257240 and la from 1012218 to 2025450 and factorize again.
2 9.3983412e+04 4.77e+01 8.57e+01 -1.0 6.74e+01 - 4.24e-02 1.38e-01f 1
3 8.3913238e+04 4.28e+01 7.89e+01 -1.0 1.01e+02 - 5.79e-02 1.05e-01f 1
4 6.5188394e+04 3.47e+01 7.23e+01 -1.0 1.50e+02 - 2.74e-02 1.90e-01f 1
5 6.2570646e+04 3.45e+01 7.16e+01 -1.0 2.02e+03 - 5.82e-03 5.20e-03f 1
6 5.9526030e+04 3.43e+01 7.08e+01 -1.0 1.73e+03 - 3.60e-03 4.60e-03f 1
7 5.9193549e+04 3.43e+01 7.08e+01 -1.0 2.32e+05 -4.0 2.57e-05 5.73e-05f 1
8 5.8122272e+04 3.43e+01 7.05e+01 -1.0 8.48e+03 - 6.79e-04 1.10e-03f 1
9 4.9726329e+04 3.32e+01 6.62e+01 -1.0 4.43e+02 - 1.76e-02 3.10e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
10 4.4945553e+04 3.22e+01 6.40e+01 -1.0 3.05e+02 - 2.94e-02 3.08e-02f 1
11 4.1780161e+04 3.12e+01 6.21e+01 -1.0 3.19e+02 - 2.59e-02 2.81e-02f 1
12 4.0833474e+04 3.09e+01 6.15e+01 -1.0 5.51e+02 - 3.00e-02 9.48e-03f 1
13 3.9874463e+04 3.06e+01 6.09e+01 -1.0 5.43e+02 - 3.10e-02 9.97e-03f 1
14 3.8239728e+04 2.99e+01 5.98e+01 -1.0 4.70e+02 - 2.24e-02 1.81e-02f 1
15 3.4586496e+04 2.86e+01 5.70e+01 -1.0 1.58e+02 - 1.43e-02 4.50e-02f 1
16 3.1962072e+04 2.75e+01 5.49e+01 -1.0 6.72e+01 - 5.20e-02 3.74e-02f 1
17 2.8938090e+04 2.62e+01 5.22e+01 -1.0 6.36e+01 - 2.24e-02 4.76e-02f 1
18 2.7057487e+04 2.54e+01 5.05e+01 -1.0 5.25e+01 - 6.45e-02 3.30e-02f 1
19 2.4866431e+04 2.43e+01 4.84e+01 -1.0 3.68e+01 - 5.13e-02 4.19e-02f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
20 1.7115455e+04 2.03e+01 4.02e+01 -1.0 3.59e+01 - 3.99e-02 1.74e-01f 1
21 1.2218843e+04 1.72e+01 3.40e+01 -1.0 3.24e+01 - 1.13e-01 1.59e-01f 1
22 1.0097931e+04 1.56e+01 3.09e+01 -1.0 2.72e+01 - 1.32e-01 9.25e-02f 1
23 5.9829560e+03 1.19e+01 2.36e+01 -1.0 2.60e+01 - 1.26e-01 2.34e-01f 1
24 1.1190943e+03 5.02e+00 9.32e+00 -1.0 2.20e+01 - 1.15e-01 5.86e-01f 1
25 8.7799945e+01 2.91e-01 4.75e+00 -1.0 1.20e+01 - 3.33e-01 1.00e+00f 1
26 7.6154567e+01 6.26e-02 1.47e+00 -1.0 7.68e+00 - 6.54e-01 1.00e+00f 1
27 5.6496738e+01 3.51e-02 2.04e-01 -1.0 1.35e+01 - 8.30e-01 1.00e+00f 1
28 3.0014462e+01 2.97e-02 3.71e-01 -1.0 2.45e+01 - 9.47e-01 1.00e+00f 1
29 2.4923913e+01 4.03e-03 4.87e-02 -1.7 1.54e+01 - 9.33e-01 1.00e+00f 1
iter objective inf_pr inf_du lg(mu) ||d|| lg(rg) alpha_du alpha_pr ls
30 2.4656580e+01 2.57e-03 2.76e-02 -2.5 4.11e+00 - 9.26e-01 1.00e+00h 1
31 2.4654029e+01 9.12e-04 1.67e-02 -3.8 2.07e+00 - 9.27e-01 1.00e+00h 1
32 2.4687431e+01 9.74e-05 1.65e-03 -3.8 1.00e+00 - 1.00e+00 1.00e+00h 1
33 2.4717548e+01 9.63e-06 3.65e-04 -3.8 1.83e-01 - 1.00e+00 1.00e+00h 1
34 2.4749209e+01 3.75e-06 6.43e-04 -5.7 1.30e-01 - 1.00e+00 9.73e-01h 1
35 2.4760414e+01 3.91e-07 2.08e-05 -5.7 4.24e-02 - 1.00e+00 1.00e+00h 1
36 2.4764085e+01 6.69e-08 2.35e-06 -5.7 1.73e-02 - 1.00e+00 1.00e+00h 1
37 2.4765790e+01 2.72e-08 4.48e-05 -8.6 1.10e-02 - 1.00e+00 9.89e-01h 1
38 2.4765832e+01 2.07e-08 1.39e-03 -8.6 5.02e-03 - 1.00e+00 2.50e-01h 3
39 2.4765964e+01 6.41e-09 1.96e-07 -8.6 5.32e-03 - 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.4765976e+01 1.47e-10 5.30e-09 -8.6 8.17e-04 - 1.00e+00 1.00e+00h 1
41 2.4765977e+01 7.53e-12 8.10e-11 -9.0 9.62e-05 - 1.00e+00 1.00e+00h 1

Number of Iterations…: 41

                               (scaled)                 (unscaled)

Objective…: 2.2514524371369816e+01 2.4765976808506800e+01
Dual infeasibility…: 8.1030069954562380e-11 8.9133076950018625e-11
Constraint violation…: 7.5342925359700701e-12 7.5342925359700701e-12
Complementarity…: 1.0273551334487286e-09 1.1300906467936016e-09
Overall NLP error…: 1.0273551334487286e-09 1.1300906467936016e-09

Number of objective function evaluations = 44
Number of objective gradient evaluations = 42
Number of equality constraint evaluations = 44
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 42
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 41
Total CPU secs in IPOPT (w/o function evaluations) = 1.192
Total CPU secs in NLP function evaluations = 0.155

EXIT: Optimal Solution Found.

Ipopt 3.12.13: Optimal Solution Found

suffix ipopt_zU_out OUT;
suffix ipopt_zL_out OUT;

BARON 23.3.11 (2023.03.11): nlpsol=1
BARON version 23.3.11. Built: WIN-64 Sat Mar 11 18:01:20 EST 2023

BARON is a product of The Optimization Firm.
For information on BARON, see

If you use this software, please cite publications from
BARON publications | The Optimization Firm, such as:

Khajavirad, A. and N. V. Sahinidis,
A hybrid LP/NLP paradigm for global optimization relaxations,
Mathematical Programming Computation, 10, 383-421, 2018.
This BARON run may utilize the following subsolver(s)
Doing local search
Preprocessing found feasible solution with value 39.2260
Solving bounding LP
Starting multi-start local search
Done with local search
Iteration Open nodes Time (s) Lower bound Upper bound
1 0 93.92 39.2260 39.2260

Calculating duals

                     *** Normal completion ***

Wall clock time: 96.36
Total CPU time used: 94.64

Total no. of BaR iterations: 1
Best solution found at node: -1
Max. no. of nodes in memory: 1

All done
BARON 23.3.11 (2023.03.11): 1 iterations, optimal within tolerances.
Objective 39.22602615

Hi Marcos,

I have sent you an email with the input files to reproduce the problem.

Thank you,