Skip to content

Commit

Permalink
Gurobi: global=-1 needs acc:_expr=0 #237
Browse files Browse the repository at this point in the history
PL approximation only works for general constraints
  • Loading branch information
glebbelov committed Nov 18, 2024
1 parent 2305368 commit 07aef18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/source/modeling-expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,12 @@ these functions.
Gurobi 12 defaults to proper nonlinear handling of these functions.
Alternatively it allows their piecewise-linear approximation
as part of preprocessing. Gurobi :ref:`option <solver-options>` ``alg:global``
(``pre:funcnonlinear``) can be used to apply piecewise-linear approximation:
(``pre:funcnonlinear``) can be used to apply piecewise-linear approximation,
after disabling expression trees:

.. code-block:: ampl
ampl: option gurobi_options 'global=-1'; solve;
ampl: option gurobi_options 'global=-1 acc:_expr=0'; solve;
For individual constraints and objectives, the choice of global solving vs
piecewise-linear approximation can be performed via the ``.global`` suffix:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/modeling-tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Next subsection explains how a user can switch between
flat constraints and formulas, if available,
or force reformulation.

Reformulation options
Acceptance options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sometimes it is handy to disable all automatic reformulations,
Expand Down
3 changes: 2 additions & 1 deletion solvers/gurobi/gurobibackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,8 @@ void GurobiBackend::InitCustomOptions() {
"with their constraint's or objective's suffix .funcnonlinear "
"or, if not available, .global unset (or set to 0) are treated "
"(ATTENTION: different meaning than Gurobi FuncNonLinear "
"parameter and attribute):\n"
"parameter and attribute; ATTENTION: also set acc:_expr=0 "
"with pre:funcnonlinear=-1 to use 'general constraints'):\n"
"\n.. value-table::\n"
"Suffix values mean the same.",
storedOptions_.fFuncNonlinear_, values_funcnonlinear);
Expand Down

0 comments on commit 07aef18

Please sign in to comment.