From dd0df4addf4ba98ac82a5cef40dcf5ae75618645 Mon Sep 17 00:00:00 2001 From: Joao-Dionisio Date: Wed, 2 Oct 2024 11:31:38 +0200 Subject: [PATCH 1/3] Add paramter emphasis and setting --- docs/tutorials/constypes.rst | 2 +- docs/tutorials/model.rst | 84 +++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/constypes.rst b/docs/tutorials/constypes.rst index ea714d112..c0ee1b52f 100644 --- a/docs/tutorials/constypes.rst +++ b/docs/tutorials/constypes.rst @@ -80,7 +80,7 @@ coefficient values, and the constraint handler that created the Row. Constraint Information -======================== +====================== The Constraint object can be queried like any other object. Some of the information a Constraint object contains is the name of the constraint handler responsible for the constraint, diff --git a/docs/tutorials/model.rst b/docs/tutorials/model.rst index 57c25bd17..80e942666 100644 --- a/docs/tutorials/model.rst +++ b/docs/tutorials/model.rst @@ -109,6 +109,88 @@ all the parameter values that you wish to set, then one can use the command: scip.readParams(path_to_file) +Automatically set plugin parameters +=================================== + +We can influence the behavior of some of SCIP's plugins using ``SCIP_PARAMSETTING``. This can be applied +to the heuristics, to the presolvers, and to the separators (respectively with ``setHeuristics``, +``setPresolve``, and ``setSeparating``). + +.. code-block:: python + + from pyscipopt import Model, SCIP_PARAMSETTING + + scip = Model() + scip.setHeuristics(SCIP_PARAMSETTING.AGGRESSIVE) + +There are four parameter settings: + +.. list-table:: A list of the different options and the result + :widths: 25 25 + :align: center + :header-rows: 1 + + * - Option + - Result + * - ``DEFAULT`` + - set to the default values of all the plugin's parameters + * - ``FAST`` + - the time spend for the plugin is decreased + * - ``AGGRESSIVE`` + - such that the plugin is called more aggressively + * - ``OFF`` + - turn off the plugin + +.. note:: This is important to get dual information, as it's necessary to disable presolving and heuristics. + For more information, see the tutorial on getting :doc:`constraint information.` + + +Set solver emphasis +=================== + +One can also instruct SCIP to focus on different aspects of the search process. To do this, import +``SCIP_PARAMEMPHASIS`` from ``pyscipopt`` and set the appropriate value. For example, +if the goal is just to find a feasible solution, then we can do the following: + +.. code-block:: python + + from pyscipopt import Model, SCIP_PARAMEMPHASIS + + scip = Model() + scip.setEmphasis(SCIP_PARAMEMPHASIS.FEASIBILITY) + +You can find below a list of the available options, alongside their meaning. + +.. list-table:: Parameter emphasis summary + :widths: 25 25 + :align: center + :header-rows: 1 + + * - Setting + - Meaning + * - ``PARAMEMPHASIS.DEFAULT`` + - to use default values + * - ``PARAMEMPHASIS.COUNTER`` + - to get feasible and "fast" counting process + * - ``PARAMEMPHASIS.CPSOLVER`` + - to get CP like search (e.g. no LP relaxation) + * - ``PARAMEMPHASIS.EASYCIP`` + - to solve easy problems fast + * - ``PARAMEMPHASIS.FEASIBILITY`` + - to detect feasibility fast + * - ``PARAMEMPHASIS.HARDLP`` + - to be capable to handle hard LPs + * - ``PARAMEMPHASIS.OPTIMALITY`` + - to prove optimality fast + * - ``PARAMEMPHASIS.PHASEFEAS`` + - to find feasible solutions during a 3 phase solution process + * - ``PARAMEMPHASIS.PHASEIMPROVE`` + - to find improved solutions during a 3 phase solution process + * - ``PARAMEMPHASIS.PHASEPROOF`` + - to proof optimality during a 3 phase solution process + * - ``PARAMEMPHASIS.NUMERICS`` + - to solve problems which cause numerical issues + Copy a SCIP Model ================== @@ -122,7 +204,7 @@ This model is completely independent from the source model. The data has been du That is, calling ``scip.optimize()`` at this point will have no effect on ``scip_alternate_model``. .. note:: After optimizing users often struggle with reoptimization. To make changes to an - already optimized model, one must first fo the following: + already optimized model, one must first do the following: .. code-block:: python From 673f3a4d08de1a3f56d1616ce9ee0ba59c69c794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dion=C3=ADsio?= <57299939+Joao-Dionisio@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:08:32 +0100 Subject: [PATCH 2/3] Update docs/tutorials/model.rst Co-authored-by: Mark Turner <64978342+Opt-Mucca@users.noreply.github.com> --- docs/tutorials/model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/model.rst b/docs/tutorials/model.rst index 80e942666..376d8dcf3 100644 --- a/docs/tutorials/model.rst +++ b/docs/tutorials/model.rst @@ -109,7 +109,7 @@ all the parameter values that you wish to set, then one can use the command: scip.readParams(path_to_file) -Automatically set plugin parameters +Set Plugin-wide Parameters (Aggressiveness) =================================== We can influence the behavior of some of SCIP's plugins using ``SCIP_PARAMSETTING``. This can be applied From 1557c4e125dcfb27e560820b85bb00c5435595ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dion=C3=ADsio?= <57299939+Joao-Dionisio@users.noreply.github.com> Date: Fri, 4 Oct 2024 15:08:41 +0100 Subject: [PATCH 3/3] Update docs/tutorials/model.rst Co-authored-by: Mark Turner <64978342+Opt-Mucca@users.noreply.github.com> --- docs/tutorials/model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/model.rst b/docs/tutorials/model.rst index 376d8dcf3..184ee3a70 100644 --- a/docs/tutorials/model.rst +++ b/docs/tutorials/model.rst @@ -145,7 +145,7 @@ There are four parameter settings: For more information, see the tutorial on getting :doc:`constraint information.` -Set solver emphasis +Set Solver Emphasis =================== One can also instruct SCIP to focus on different aspects of the search process. To do this, import