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

Move away from dependence on gurobi.sh #3384

Merged
merged 27 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c828678
Refactor GUROBI_RUN to separate result parsing from writing the soln …
jsiirola Oct 16, 2024
2c8f91f
Add a file-based direct interface (a thin veneer over the shell inter…
jsiirola Oct 16, 2024
7f4a4ff
Explicitly release model in GUROBI_RUN
jsiirola Oct 16, 2024
3587763
Prevent gurobipy_available from being resolved (even if it was alread…
jsiirola Oct 16, 2024
9f579c2
NFC: apply black
jsiirola Oct 16, 2024
c664c68
guard import of GUROBI_RUN
jsiirola Oct 16, 2024
d6fc8ee
Remove pin on Gurobi version
jsiirola Oct 16, 2024
dffbbd5
NFC: apply black
jsiirola Oct 16, 2024
a03e5ce
Switch default mBigM solver to avoid triggering gurobipy import
jsiirola Oct 16, 2024
040725e
Update contrib (appsi+solver) tests to reflect change in Gurobi behavior
jsiirola Oct 16, 2024
5c01b97
Bugfix to test (copy/paste error)
jsiirola Oct 16, 2024
f820414
Implement GUROBIFILE available() and license_is_valid() checks
jsiirola Oct 16, 2024
9f79d32
fix typo (copy/paste error)
jsiirola Oct 16, 2024
1f6d126
Merge branch 'main' into gurobi-sh-deprecation
jsiirola Oct 16, 2024
7f33e1d
Merge branch 'main' into gurobi-sh-deprecation
jsiirola Oct 28, 2024
f85117c
NFC: update comments
jsiirola Oct 28, 2024
3981d2f
NFC: remove references to CPLEX
jsiirola Oct 28, 2024
ff6a733
Merge branch 'main' into gurobi-sh-deprecation
jsiirola Oct 31, 2024
83aa22a
Add missing import
jsiirola Oct 31, 2024
24bee9f
Capture gurobi output sent to the underlying stdout file handle
jsiirola Oct 31, 2024
fd18342
NFC: apply black
jsiirola Oct 31, 2024
525dc6c
Merge branch 'main' into gurobi-sh-deprecation
jsiirola Nov 1, 2024
f6e2822
Leverage deferred config resolution for mbigm solver
jsiirola Nov 1, 2024
6aeba60
Merge branch 'main' into gurobi-sh-deprecation
blnicho Nov 5, 2024
fec1416
Merge branch 'main' into gurobi-sh-deprecation
mrmundt Nov 5, 2024
7fd605c
Remove reference to pyutilib
jsiirola Nov 5, 2024
f28d7e6
Skip gurobipy profile lines
jsiirola Nov 5, 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
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'),
Copy link
Member

Choose a reason for hiding this comment

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

Now that #3394 has been merged can the changes in this file be reverted?

Copy link
Member

Choose a reason for hiding this comment

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

Oops, I just noticed the last commit message which seems to already be using the deferred config stuff so ignore my original question. Is the Solver domain implemented here general enough to go into pyomo.common or pyomo.util?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is pretty general, but could use some discussion before promulgating it elsewhere. In particular, what is the "correct" way to know if you were handed a "solver" object? Given that we have 3 different base classes floating around (core, APPSI, and contrib/solver), inheritance is probably not the right answer. This implementation just looks for a solve() method and hopes it quacks.

default='gurobi',
domain=Solver,
description="A solver to use to solve the continuous subproblems for "
"calculating the M values",
),
Expand Down
Loading
Loading