Skip to content

Commit

Permalink
Leverage deferred config resolution for mbigm solver
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Nov 1, 2024
1 parent 525dc6c commit f6e2822
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pyomo/gdp/plugins/multiple_bigm.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@
}


def Solver(val):
if isinstance(val, str):
return SolverFactory(val)
if not hasattr(val, 'solve'):
raise ValueError("Expected a string or solver object (with solve() method)")
return val


@TransformationFactory.register(
'gdp.mbigm',
doc="Relax disjunctive model using big-M terms specific to each disjunct",
Expand Down Expand Up @@ -127,7 +135,8 @@ class MultipleBigMTransformation(GDP_to_MIP_Transformation, _BigM_MixIn):
CONFIG.declare(
'solver',
ConfigValue(
default=SolverFactory('_gurobi_file'),
default='gurobi',
domain=Solver,
description="A solver to use to solve the continuous subproblems for "
"calculating the M values",
),
Expand Down

0 comments on commit f6e2822

Please sign in to comment.