Skip to content

Commit a0aa5c3

Browse files
Update tutorial to include parameter emphasis and setting (#909)
* Add paramter emphasis and setting * Update docs/tutorials/model.rst Co-authored-by: Mark Turner <64978342+Opt-Mucca@users.noreply.github.com> * Update docs/tutorials/model.rst Co-authored-by: Mark Turner <64978342+Opt-Mucca@users.noreply.github.com> --------- Co-authored-by: Mark Turner <64978342+Opt-Mucca@users.noreply.github.com>
1 parent af6f171 commit a0aa5c3

File tree

2 files changed

+84
-2
lines changed

2 files changed

+84
-2
lines changed

docs/tutorials/constypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ coefficient values, and the constraint handler that created the Row.
8080
8181
8282
Constraint Information
83-
========================
83+
======================
8484

8585
The Constraint object can be queried like any other object. Some of the information a Constraint
8686
object contains is the name of the constraint handler responsible for the constraint,

docs/tutorials/model.rst

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,88 @@ all the parameter values that you wish to set, then one can use the command:
109109
110110
scip.readParams(path_to_file)
111111
112+
Set Plugin-wide Parameters (Aggressiveness)
113+
===================================
114+
115+
We can influence the behavior of some of SCIP's plugins using ``SCIP_PARAMSETTING``. This can be applied
116+
to the heuristics, to the presolvers, and to the separators (respectively with ``setHeuristics``,
117+
``setPresolve``, and ``setSeparating``).
118+
119+
.. code-block:: python
120+
121+
from pyscipopt import Model, SCIP_PARAMSETTING
122+
123+
scip = Model()
124+
scip.setHeuristics(SCIP_PARAMSETTING.AGGRESSIVE)
125+
126+
There are four parameter settings:
127+
128+
.. list-table:: A list of the different options and the result
129+
:widths: 25 25
130+
:align: center
131+
:header-rows: 1
132+
133+
* - Option
134+
- Result
135+
* - ``DEFAULT``
136+
- set to the default values of all the plugin's parameters
137+
* - ``FAST``
138+
- the time spend for the plugin is decreased
139+
* - ``AGGRESSIVE``
140+
- such that the plugin is called more aggressively
141+
* - ``OFF``
142+
- turn off the plugin
143+
144+
.. note:: This is important to get dual information, as it's necessary to disable presolving and heuristics.
145+
For more information, see the tutorial on getting :doc:`constraint information.</tutorials/constypes/>`
146+
147+
148+
Set Solver Emphasis
149+
===================
150+
151+
One can also instruct SCIP to focus on different aspects of the search process. To do this, import
152+
``SCIP_PARAMEMPHASIS`` from ``pyscipopt`` and set the appropriate value. For example,
153+
if the goal is just to find a feasible solution, then we can do the following:
154+
155+
.. code-block:: python
156+
157+
from pyscipopt import Model, SCIP_PARAMEMPHASIS
158+
159+
scip = Model()
160+
scip.setEmphasis(SCIP_PARAMEMPHASIS.FEASIBILITY)
161+
162+
You can find below a list of the available options, alongside their meaning.
163+
164+
.. list-table:: Parameter emphasis summary
165+
:widths: 25 25
166+
:align: center
167+
:header-rows: 1
168+
169+
* - Setting
170+
- Meaning
171+
* - ``PARAMEMPHASIS.DEFAULT``
172+
- to use default values
173+
* - ``PARAMEMPHASIS.COUNTER``
174+
- to get feasible and "fast" counting process
175+
* - ``PARAMEMPHASIS.CPSOLVER``
176+
- to get CP like search (e.g. no LP relaxation)
177+
* - ``PARAMEMPHASIS.EASYCIP``
178+
- to solve easy problems fast
179+
* - ``PARAMEMPHASIS.FEASIBILITY``
180+
- to detect feasibility fast
181+
* - ``PARAMEMPHASIS.HARDLP``
182+
- to be capable to handle hard LPs
183+
* - ``PARAMEMPHASIS.OPTIMALITY``
184+
- to prove optimality fast
185+
* - ``PARAMEMPHASIS.PHASEFEAS``
186+
- to find feasible solutions during a 3 phase solution process
187+
* - ``PARAMEMPHASIS.PHASEIMPROVE``
188+
- to find improved solutions during a 3 phase solution process
189+
* - ``PARAMEMPHASIS.PHASEPROOF``
190+
- to proof optimality during a 3 phase solution process
191+
* - ``PARAMEMPHASIS.NUMERICS``
192+
- to solve problems which cause numerical issues
193+
112194
Copy a SCIP Model
113195
==================
114196
@@ -122,7 +204,7 @@ This model is completely independent from the source model. The data has been du
122204
That is, calling ``scip.optimize()`` at this point will have no effect on ``scip_alternate_model``.
123205
124206
.. note:: After optimizing users often struggle with reoptimization. To make changes to an
125-
already optimized model, one must first fo the following:
207+
already optimized model, one must first do the following:
126208
127209
.. code-block:: python
128210

0 commit comments

Comments
 (0)