Skip to content

Commit ddbe61f

Browse files
authored
Merge branch 'main' into cuid-from-cuid
2 parents 682ebbf + cd778c5 commit ddbe61f

File tree

18 files changed

+1517
-354
lines changed

18 files changed

+1517
-354
lines changed

doc/OnlineDocs/explanation/solvers/pyros.rst

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -329,23 +329,30 @@ The deterministic Pyomo model for *hydro* is shown below.
329329

330330
.. note::
331331
Primitive data (Python literals) that have been hard-coded within a
332-
deterministic model cannot be later considered uncertain,
333-
unless they are first converted to ``Param`` objects within
334-
the ``ConcreteModel`` object.
335-
Furthermore, any ``Param`` object that is to be later considered
336-
uncertain must have the property ``mutable=True``.
332+
deterministic model (:class:`~pyomo.core.base.PyomoModel.ConcreteModel`)
333+
cannot be later considered uncertain,
334+
unless they are first converted to Pyomo
335+
:class:`~pyomo.core.base.param.Param` instances declared on the
336+
:class:`~pyomo.core.base.PyomoModel.ConcreteModel` object.
337+
Furthermore, any :class:`~pyomo.core.base.param.Param`
338+
object that is to be later considered uncertain must be instantiated
339+
with the argument ``mutable=True``.
337340

338341
.. note::
339-
In case modifying the ``mutable`` property inside the deterministic
340-
model object itself is not straightforward in your context,
341-
you may consider adding the following statement **after**
342+
If specifying/modifying the ``mutable`` argument in the
343+
:class:`~pyomo.core.base.param.Param` declarations
344+
of your deterministic model source code
345+
is not straightforward in your context, then
346+
you may consider adding **after** the line
342347
``import pyomo.environ as pyo`` but **before** defining the model
343-
object: ``pyo.Param.DefaultMutable = True``.
344-
For all ``Param`` objects declared after this statement,
345-
the attribute ``mutable`` is set to ``True`` by default.
346-
Hence, non-mutable ``Param`` objects are now declared by
347-
explicitly passing the argument ``mutable=False`` to the
348-
``Param`` constructor.
348+
object the statement: ``pyo.Param.DefaultMutable = True``.
349+
For all :class:`~pyomo.core.base.param.Param`
350+
objects declared after this statement,
351+
the attribute ``mutable`` is set to True by default.
352+
Hence, non-mutable :class:`~pyomo.core.base.param.Param`
353+
objects are now declared by explicitly passing the argument
354+
``mutable=False`` to the :class:`~pyomo.core.base.param.Param`
355+
constructor.
349356

350357
.. doctest::
351358

@@ -428,22 +435,37 @@ The deterministic Pyomo model for *hydro* is shown below.
428435
Step 2: Define the Uncertainty
429436
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
430437

431-
First, we need to collect into a list those ``Param`` objects of our model
432-
that represent potentially uncertain parameters.
433-
For the purposes of our example, we shall assume uncertainty in the model
434-
parameters ``[m.p[0], m.p[1], m.p[2], m.p[3]]``, for which we can
435-
conveniently utilize the object ``m.p`` (itself an indexed ``Param`` object).
438+
We first collect the components of our model that represent the
439+
uncertain parameters.
440+
In this example, we assume uncertainty in
441+
the parameter objects ``m.p[0]``, ``m.p[1]``, ``m.p[2]``, and ``m.p[3]``.
442+
Since these objects comprise the mutable :class:`~pyomo.core.base.param.Param`
443+
object ``m.p``, we can conveniently specify:
436444

437445
.. doctest::
438446

439-
>>> # === Specify which parameters are uncertain ===
440-
>>> # We can pass IndexedParams this way to PyROS,
441-
>>> # or as an expanded list per index
442-
>>> uncertain_parameters = [m.p]
447+
>>> uncertain_params = m.p
448+
449+
Equivalently, we may instead set ``uncertain_params`` to
450+
either ``[m.p]``, ``[m.p[0], m.p[1], m.p[2], m.p[3]]``,
451+
or ``list(m.p.values())``.
452+
453+
.. note::
454+
Any :class:`~pyomo.core.base.param.Param` object that is
455+
to be considered uncertain by PyROS must have the property
456+
``mutable=True``.
443457

444458
.. note::
445-
Any ``Param`` object that is to be considered uncertain by PyROS
446-
must have the property ``mutable=True``.
459+
PyROS also allows uncertain parameters to be implemented as
460+
:class:`~pyomo.core.base.var.Var` objects declared on the
461+
deterministic model.
462+
This may be convenient for users transitioning to PyROS from
463+
parameter estimation and/or uncertainty quantification workflows,
464+
in which the uncertain parameters are
465+
often represented by :class:`~pyomo.core.base.var.Var` objects.
466+
Prior to invoking PyROS,
467+
all such :class:`~pyomo.core.base.var.Var` objects should be fixed.
468+
447469

448470
PyROS will seek to identify solutions that remain feasible for any
449471
realization of these parameters included in an uncertainty set.
@@ -555,7 +577,7 @@ correspond to first-stage degrees of freedom.
555577
... model=m,
556578
... first_stage_variables=first_stage_variables,
557579
... second_stage_variables=second_stage_variables,
558-
... uncertain_params=uncertain_parameters,
580+
... uncertain_params=uncertain_params,
559581
... uncertainty_set=box_uncertainty_set,
560582
... local_solver=local_solver,
561583
... global_solver=global_solver,
@@ -648,7 +670,7 @@ In this example, we select affine decision rules by setting
648670
... model=m,
649671
... first_stage_variables=first_stage_variables,
650672
... second_stage_variables=second_stage_variables,
651-
... uncertain_params=uncertain_parameters,
673+
... uncertain_params=uncertain_params,
652674
... uncertainty_set=box_uncertainty_set,
653675
... local_solver=local_solver,
654676
... global_solver=global_solver,
@@ -702,7 +724,7 @@ could have been equivalently written as:
702724
... model=m,
703725
... first_stage_variables=first_stage_variables,
704726
... second_stage_variables=second_stage_variables,
705-
... uncertain_params=uncertain_parameters,
727+
... uncertain_params=uncertain_params,
706728
... uncertainty_set=box_uncertainty_set,
707729
... local_solver=local_solver,
708730
... global_solver=global_solver,
@@ -768,7 +790,7 @@ instance and invoking the PyROS solver:
768790
... model=m,
769791
... first_stage_variables=first_stage_variables,
770792
... second_stage_variables=second_stage_variables,
771-
... uncertain_params=uncertain_parameters,
793+
... uncertain_params=uncertain_params,
772794
... uncertainty_set= box_uncertainty_set,
773795
... local_solver=local_solver,
774796
... global_solver=global_solver,
@@ -860,7 +882,8 @@ for a basic tutorial, see the :doc:`logging HOWTO <python:howto/logging>`.
860882
* Iteration log table
861883
* Termination details: message, timing breakdown, summary of statistics
862884
* - :py:obj:`logging.DEBUG`
863-
- * Termination outcomes and summary of statistics for
885+
- * Progress through the various preprocessing subroutines
886+
* Termination outcomes and summary of statistics for
864887
every master feasility, master, and DR polishing problem
865888
* Progress updates for the separation procedure
866889
* Separation subproblem initial point infeasibilities
@@ -935,7 +958,7 @@ Observe that the log contains the following information:
935958
:linenos:
936959
937960
==============================================================================
938-
PyROS: The Pyomo Robust Optimization Solver, v1.3.1.
961+
PyROS: The Pyomo Robust Optimization Solver, v1.3.2.
939962
Pyomo version: 6.9.0
940963
Commit hash: unknown
941964
Invoked at UTC 2024-11-01T00:00:00.000000

0 commit comments

Comments
 (0)