Skip to content

Commit

Permalink
PL approx: doc update #227
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Mar 7, 2024
1 parent 3e337d6 commit 937d4c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions doc/source/modeling-expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ methods for piecewise-linear functions (Gurobi, COPT), and linearizes them for o

When a piecewise-linear function is linearized (rather than being handled natively by the solver),
numerical accuracy becomes a concern. To promote numerical stability, it is recommended that
the argument and result variables be explicitly bounded within [-1e+4,+1e-4]. See more in the section
the argument and result variables be explicitly bounded within at most [-1e+4,+1e-4]. See more in the section
on :ref:`numerical_accuracy`.


Expand Down Expand Up @@ -580,7 +580,7 @@ e.g., to see which constraints are received as conic vs quadratic,
see :ref:`explore-final-model`.



.. _nonlinear-functions:

General nonlinear functions
**********************************
Expand All @@ -603,15 +603,17 @@ Supported functions
is decomposed into quadratic constraints if the solver supports them,
otherwise passed to the solver natively or approximated by a piecewise-linear function.

General solvers
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Piecewise-linear approximation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For linear-quadratic MP-based solvers,
most of these nonlinear functions are handled by piecewise-linear approximation,
except products with binary variables.
The appoximation is constructed by the MP interface, using options
``cvt:plapprox:reltol`` and ``cvt:plapprox:domain``,
and is then processed as described in
The appoximation is constructed by the MP interface, using :ref:`options <solver-options>`
``cvt:plapprox:reltol`` and ``cvt:plapprox:domain``.

To reduce the approximation size and improve numerical properties,
set tight bounds on the variables, as described in
:ref:`piecewise_linear_modeling`.

Handling in Gurobi
Expand Down
5 changes: 3 additions & 2 deletions doc/source/modeling-numerics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ Piecewise-linear expressions can be modeled in AMPL directly, or arise from
approximations of other functions. Solvers which support PL expressions,
usually handle them algorithmically in a numerically stable way. Otherwise,
if PL expressions are linearized, it is recommended to have the argument
and result variables bounded in :math:`\pm10^4` (for approximated nonlinear functions,
hard bounds of up to :math:`\pm10^6` are imposed). The stability can be improved
and result variables bounded in :math:`\pm10^4` (the tighter the better;
for :ref:`approximated nonlinear functions <nonlinear-functions>`,
hard bounds of up to :math:`\pm10^6` are imposed by default). The stability can be improved
in some cases by decreasing integer tolerance, Gurobi's *intfocus* and
*numfocus* options, switching off presolve in the solver, and other tuning measures.

0 comments on commit 937d4c2

Please sign in to comment.