Skip to content

[WIP] support xhat mip gapper options in generic cylinders #525

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions doc/src/generic_cylinders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,38 @@ warmstart-subproblems
Loosely speaking, this option causes subproblem solves to be given the
previous iteration solution as a warm-start. This is particularly important
when using an option to lineraize proximal terms.


mipgap extensions
-----------------

Extensions can be seen using the ``--help`` argument (the ``--module``
argement is still required for ``--help``). We provide a little
background here. If the mipgap command does not have a prefix, then
it refers to the hub algorithm, otherwise the prefix refers
to the cylinder named in the prefix (if the cylinder is not
present, no error message is given). So ``--mapgap-json`` gives
the name of the mpigap json file for the PH hub algorithm, while
``--lagrangian-mipgap-json`` gives it for the ``lagrangian`` spoke
(if present). See the ``mipgapper`` section of :ref:`Extensions`
for a little more information.

Here is an example json file:

.. code-block:: json

{
"0": 0.02,
"1": 0.02,
"2": 0.01,
"10": 0.001,
"20": 0.0001
}

The ``starting-mipgap`` (e.g., ``lagrangian-starting-mipgap``)
and ``mipgap-ratio`` options taken together operate based on the overall
gap (the so-called `cylinder` gap) to set the mipgap.
As the cylinders close the relative optimality gap the extension will set the subproblem
mipgaps as the ``min(starting_mipgap, mipgap_ratio * problem_ratio)``, where
the ``problem_ratio`` is the relative optimality gap on the overall problem
as computed by the cylinders.
6 changes: 6 additions & 0 deletions mpisppy/generic_cylinders.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def _parse_args(m):
cfg.integer_relax_then_enforce_args()
cfg.gapper_args()
cfg.gapper_args(name="lagrangian")
cfg.gapper_args(name="xhatshuffle")
cfg.gapper_args(name="xhatxbar")
cfg.ph_nonant_args()
cfg.relaxed_ph_args()
cfg.fwph_args()
Expand Down Expand Up @@ -379,11 +381,15 @@ def _do_decomp(module, cfg, scenario_creator, scenario_creator_kwargs, scenario_
if cfg.get("stage2EFsolvern") is not None:
xhatshuffle_spoke["opt_kwargs"]["options"]["stage2EFsolvern"] = cfg["stage2EFsolvern"]
xhatshuffle_spoke["opt_kwargs"]["options"]["branching_factors"] = cfg["branching_factors"]
if cfg.lagrangian_starting_mipgap is not None:
vanilla.add_gapper(lagrangian_spoke, cfg, "xhatshuffle")
Comment on lines +384 to +385
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if cfg.lagrangian_starting_mipgap is not None:
vanilla.add_gapper(lagrangian_spoke, cfg, "xhatshuffle")
if cfg.xhatsuffle_starting_mipgap is not None:
vanilla.add_gapper(xhatshuffle_spoke, cfg, "xhatshuffle")


if cfg.xhatxbar:
xhatxbar_spoke = vanilla.xhatxbar_spoke(*beans,
scenario_creator_kwargs=scenario_creator_kwargs,
all_nodenames=all_nodenames)
if cfg.lagrangian_starting_mipgap is not None:
vanilla.add_gapper(xhatxbar_spoke, cfg, "xhatshuffle")
Comment on lines +391 to +392
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if cfg.lagrangian_starting_mipgap is not None:
vanilla.add_gapper(xhatxbar_spoke, cfg, "xhatshuffle")
if cfg.xhatxbar_starting_mipgap is not None:
vanilla.add_gapper(xhatxbar_spoke, cfg, "xhatxbar")


# reduced cost fixer options setup
if cfg.reduced_costs:
Expand Down
2 changes: 1 addition & 1 deletion mpisppy/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def gapper_args(self, name=None):
name = name+"_"

if name == "":
self.add_to_config('mipgaps_json',
self.add_to_config(f'{name}mipgaps_json',
description="path to json file with a mipgap schedule for PH iterations",
domain=str,
default=None)
Expand Down
Loading