Skip to content

Commit

Permalink
Merge pull request #3384 from jsiirola/gurobi-sh-deprecation
Browse files Browse the repository at this point in the history
Move away from dependence on gurobi.sh
  • Loading branch information
blnicho authored Nov 6, 2024
2 parents 22a1dac + f28d7e6 commit c463632
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 94 deletions.
3 changes: 2 additions & 1 deletion pyomo/common/unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,10 +876,11 @@ def filter_fcn(self, line):
# next 6 patterns ignore entries in pstats reports:
'function calls',
'List reduced',
'.py:',
'.py:', # timing/profiling output
' {built-in method',
' {method',
' {pyomo.core.expr.numvalue.as_numeric}',
' {gurobipy.',
):
if field in line:
return True
Expand Down
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'),
default='gurobi',
domain=Solver,
description="A solver to use to solve the continuous subproblems for "
"calculating the M values",
),
Expand Down
Loading

0 comments on commit c463632

Please sign in to comment.