Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PyROS Solver Argument Resolution and Validation Routines #3126

Merged
merged 47 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d224bbe
Remove custom PyROS `ConfigDict` interfaces
shermanjasonaf Feb 7, 2024
d5fc7cb
Create new module for config objects
shermanjasonaf Feb 7, 2024
49fa433
Apply black, PEP8 code
shermanjasonaf Feb 7, 2024
1bda0d3
Update documentation of mandatory args
shermanjasonaf Feb 7, 2024
ecc2df8
Add more rigorous `InputDataStandardizer` checks
shermanjasonaf Feb 7, 2024
bcf1730
Add tests for `InputDataStandardizer`
shermanjasonaf Feb 7, 2024
fc497bc
Refactor uncertainty set argument validation
shermanjasonaf Feb 7, 2024
4976285
Add more rigorous checks for solver-like args
shermanjasonaf Feb 7, 2024
9e89fee
Extend domain of objective focus argument
shermanjasonaf Feb 7, 2024
039171f
Extend domain for path-like args
shermanjasonaf Feb 7, 2024
c0f2a41
Tweak domain name of path-like args
shermanjasonaf Feb 7, 2024
154bbba
Apply black
shermanjasonaf Feb 7, 2024
d7b41d5
Refactor checks for int-like args
shermanjasonaf Feb 7, 2024
2a0c790
Refactor logger type validator
shermanjasonaf Feb 7, 2024
14421fa
Apply black
shermanjasonaf Feb 7, 2024
be98fa9
Restructure PyROS argument resolution and validation
shermanjasonaf Feb 7, 2024
adc9d68
Make advanced validation more rigorous
shermanjasonaf Feb 7, 2024
4f64c4f
Simplify assembly of state variables
shermanjasonaf Feb 7, 2024
969aac9
Apply black
shermanjasonaf Feb 7, 2024
8201978
Make first char of test class names uppercase
shermanjasonaf Feb 7, 2024
012e319
Remove support for solver argument `dev_options`
shermanjasonaf Feb 7, 2024
2c4b89e
Remove `dev_options` from test docstring
shermanjasonaf Feb 7, 2024
55884a4
Apply black 24.1.1
shermanjasonaf Feb 7, 2024
cabe425
Fix typos
shermanjasonaf Feb 8, 2024
f7c8e4a
Fix another typo
shermanjasonaf Feb 8, 2024
7fdcf24
Check IPOPT available before advanced validation tests
shermanjasonaf Feb 8, 2024
ec0ad71
Remove IPOPT from solver validation tests
shermanjasonaf Feb 8, 2024
445d4cf
Fix typos
shermanjasonaf Feb 8, 2024
7b26268
Fix test solver registration
shermanjasonaf Feb 8, 2024
b899744
Check numpy available for uncertainty set test
shermanjasonaf Feb 8, 2024
655c06d
Add IPOPT availability checks to solve tests
shermanjasonaf Feb 8, 2024
0f727ab
Apply black to tests
shermanjasonaf Feb 8, 2024
08596e5
Update version number, changelog
shermanjasonaf Feb 8, 2024
5d7e093
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 8, 2024
73e1e28
Limit visibility of option `p_robustness`
shermanjasonaf Feb 9, 2024
cbbcceb
Add note on `options` arg to docs
shermanjasonaf Feb 9, 2024
d4d8d32
Tweak new note wording
shermanjasonaf Feb 9, 2024
a99e2a6
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 13, 2024
b0ecba2
Update name and base class of solver arg exception
shermanjasonaf Feb 15, 2024
6265e77
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 15, 2024
2c471e4
Simplify argument resolution
shermanjasonaf Feb 15, 2024
e3e8074
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 15, 2024
5154652
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 16, 2024
3449dfe
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 16, 2024
120c9a4
Incorporate updated interfaces of `common.config`
shermanjasonaf Feb 16, 2024
9c72835
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 20, 2024
3556a60
Merge branch 'main' into update-kwarg-parsing-validation
shermanjasonaf Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion doc/OnlineDocs/contributed_packages/pyros.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ PyROS Solver Interface

Otherwise, the solution returned is certified to only be robust feasible.


PyROS Uncertainty Sets
-----------------------------
Uncertainty sets are represented by subclasses of
Expand Down Expand Up @@ -518,7 +519,7 @@ correspond to first-stage degrees of freedom.

>>> # === Designate which variables correspond to first-stage
>>> # and second-stage degrees of freedom ===
>>> first_stage_variables =[
>>> first_stage_variables = [
... m.x1, m.x2, m.x3, m.x4, m.x5, m.x6,
... m.x19, m.x20, m.x21, m.x22, m.x23, m.x24, m.x31,
... ]
Expand Down Expand Up @@ -657,6 +658,54 @@ For this example, we notice a ~25% decrease in the final objective
value when switching from a static decision rule (no second-stage recourse)
to an affine decision rule.


Specifying Arguments Indirectly Through ``options``
"""""""""""""""""""""""""""""""""""""""""""""""""""
Like other Pyomo solver interface methods,
:meth:`~pyomo.contrib.pyros.PyROS.solve`
provides support for specifying options indirectly by passing
a keyword argument ``options``, whose value must be a :class:`dict`
mapping names of arguments to :meth:`~pyomo.contrib.pyros.PyROS.solve`
to their desired values.
For example, the ``solve()`` statement in the
:ref:`two-stage problem snippet <example-two-stg>`
could have been equivalently written as:

.. doctest::
:skipif: not (baron.available() and baron.license_is_valid())

>>> results_2 = pyros_solver.solve(
... model=m,
... first_stage_variables=first_stage_variables,
... second_stage_variables=second_stage_variables,
... uncertain_params=uncertain_parameters,
... uncertainty_set=box_uncertainty_set,
... local_solver=local_solver,
... global_solver=global_solver,
... options={
... "objective_focus": pyros.ObjectiveType.worst_case,
... "solve_master_globally": True,
... "decision_rule_order": 1,
... },
... )
==============================================================================
PyROS: The Pyomo Robust Optimization Solver.
...
------------------------------------------------------------------------------
Robust optimal solution identified.
------------------------------------------------------------------------------
...
------------------------------------------------------------------------------
All done. Exiting PyROS.
==============================================================================

In the event an argument is passed directly
by position or keyword, *and* indirectly through ``options``,
an appropriate warning is issued,
and the value passed directly takes precedence over the value
passed through ``options``.


The Price of Robustness
""""""""""""""""""""""""
In conjunction with standard Python control flow tools,
Expand Down
8 changes: 8 additions & 0 deletions pyomo/contrib/pyros/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
PyROS CHANGELOG
===============

-------------------------------------------------------------------------------
PyROS 1.2.10 07 Feb 2024
-------------------------------------------------------------------------------
- Update argument resolution and validation routines of `PyROS.solve()`
- Use methods of `common.config` for docstring of `PyROS.solve()`


-------------------------------------------------------------------------------
PyROS 1.2.9 15 Dec 2023
-------------------------------------------------------------------------------
Expand All @@ -14,6 +21,7 @@ PyROS 1.2.9 15 Dec 2023
- Refactor DR polishing routine; initialize auxiliary variables
to values they are meant to represent


-------------------------------------------------------------------------------
PyROS 1.2.8 12 Oct 2023
-------------------------------------------------------------------------------
Expand Down
Loading