BARON#

BARON is a general nonlinear optimizer capable of solving nonconvex optimization problems to global optimality. Decision variables may be continuous, integer, or a mixture of the two. BARON has been used for applications in the chemical process industries, pharmaceuticals, energy production, engineering design, and asset management.

An experimental version of the driver, BARONMP, supports the extended modeling capabilities of the MP library.

Product Page | Features | Options | BARONMP Options | Changes

Download BARON | Start a BARON Trial Now!

How to use it#

How to install using amplpy:

# Install Python API for AMPL:
$ python -m pip install amplpy --upgrade

# Install AMPL & solver modules:
$ python -m amplpy.modules install baron # install Baron

# Activate your license (e.g., free ampl.com/ce or ampl.com/academia licenses):
$ python -m amplpy.modules activate <your-license-uuid>

How to use:

from amplpy import AMPL
ampl = AMPL()
...
ampl.solve(solver="baron", baron_options="option1=value1 option2=value2")

Learn more about what we have to offer to implement and deploy Optimization in Python.

AMPL APIs give access to AMPL from a programming language:

ampl: option solver baron; # change the solver
ampl: option baron_options 'option1=value1 option2=value2'; # specify options
ampl: solve; # solve the problem

Resources#

Features#

Problem types and algorithms#

Problem types
  • NLP, MINLP, nonconvex, solved to global optimality

  • LP, MILP

Received natively by BARONMP: quadratic terms, exp, log, x^a, a^x, /. MP reformulates logical constraints; trigonometric functions are approximated piecewise-linearly.

All constructs: native constraints and expressions by driver.

Global search: branch-and-reduce

Stopping tolerances: epsr (relative) and epsa (absolute). Time limit: maxtime, in CPU seconds, default 1000. Local searches: numloc in preprocessing, dolocal during upper bounding. LP solver: lpsolver.

With BARONMP, the same controls are alg:epsr, alg:epsa, alg:numloc, alg:dolocal and lim:time; the LP algorithm is lp:alg.

Modeling with MP expressions#

MP expressions: logic and counting (MP2NL)

Natively, BARON solves algebraic models with continuous and integer variables (polynomials, exp, log, powers), and complementarity (complements); trigonometric functions reach it only through MP2NL, which approximates them piecewise-linearly. MP’s expressions (==>, or, atmost, count, alldiff, piecewise-linear terms, …) are not part of its native model type: through MP2NL, MP reformulates them into it first.

The BARON driver includes the MP2NL bridge: set mp2nl=1 in baron_options. MP’s own options (cvt:..., sol:chk:...) then go into the AMPL option mp_options.

MP reformulates logic with binary variables, which BARON handles as integer variables. Alternatively, BARONMP (baronmp) is built on MP and accepts these expressions directly.

ampl.solve(solver="baron", baron_options="mp2nl=1", mp_options="cvt:bigM=1e5")
ampl: option solver baron;
ampl: option baron_options 'mp2nl=1';
ampl: option mp_options 'cvt:bigM=1e5';
ampl: solve;

More: Meta-driver MP2NL.

Instrumentation (BARONMP)#

For a generic summary of the options and features used most often, see Important features in the MP documentation.

For all models

Model export

Option tech:writemodel. Details

Solution export

Option tech:writesolution. Details

Multiple solutions

Option sol:stub. Details

Multiple objectives

Emulated by MP. Option obj:multi. Details

Warm start

Option alg:start. Details

For MIP models

MIP gap

Option mip:return_gap. Details

Best dual bound

Option mip:bestbound. Details

Solver options#

Full list of solver options:

More details on the BARONMP options: MP solver options.

Retrieving solutions#

The outcome of the last optimization is stored in the AMPL parameter solve_result_num and the relative message in solve_result.

display solve_result_num, solve_result;

BARONMP solve result codes can be obtained by running baronmp -! or ampl: shell "baronmp -!";:

Solve result table for BaronMP 25.12.10
             -1 Unknown solution status returned from Baron
          0- 99 solved: optimal for an optimization problem,
                feasible for a satisfaction problem 
        100-199 solved? solution candidate returned but error likely 
            100 numerical difficulties but possibly optimal
            150 solved? MP solution check failed (option sol:chk:fail) 
        200-299 infeasible 
        300-349 unbounded, feasible solution returned 
        350-399 unbounded, no feasible solution returned 
        400-449 limit, feasible: stopped, e.g., on iterations or Ctrl-C 
        450-469 limit, problem is either infeasible or unbounded.
                Disable dual reductions or run IIS finder for definitive answer.
        470-499 limit, no solution returned 
            471 interrupted, no feasible solution
            472 time limit, without a feasible solution
            473 iteration limit, without a feasible soluton
            474 node limit, without a feasible soluton
        500-999 failure, no solution returned 
            500 licensing error
            501 BARON syntax error (should not happen)
            502 too little memory
            550 failure: numeric issue, no feasible solution

The classic BARON driver (baron) uses AMPL’s default ranges:

Solve result table (AMPL default ranges)
          0- 99 solved: optimal for an optimization problem, feasible for a satisfaction problem
        100-199 solved? solution candidate returned but error likely
        200-299 infeasible
        300-399 unbounded
        400-499 limit
        500-999 failure, no solution returned

For general information, see MP result codes guide.

Changelog#