Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
e552439
Add first draft of SCIP persistent solving
Opt-Mucca Mar 18, 2024
6a14f10
Add SCIPPersistent to docs
Opt-Mucca Mar 18, 2024
c107909
Add SCIp to Github action scripts
Opt-Mucca Mar 19, 2024
e00ded8
Remove 5.0.0 specific version. Add conda to workflow
Opt-Mucca Mar 19, 2024
a0b6250
Standardise string formatting to fstring
Opt-Mucca Mar 19, 2024
d0816eb
Add parameter link to docstring
Opt-Mucca Mar 19, 2024
0e11f11
Remove redundant second objective sense check
Opt-Mucca Mar 19, 2024
068ec99
Clean up _post_solve with a helper function for status handling
Opt-Mucca Mar 19, 2024
63af6d8
Remove individual skip_test option
Opt-Mucca Mar 19, 2024
4075d9a
Update pyomo/solvers/plugins/solvers/scip_persistent.py
Opt-Mucca Mar 19, 2024
f55fcc5
Update from the black command
Opt-Mucca Mar 19, 2024
e2b49b2
Merge remote-tracking branch 'origin/main'
Opt-Mucca Mar 19, 2024
91eae7b
Fix typos
Opt-Mucca Mar 19, 2024
5ee2007
Replace trySol via more safe checkSol
Opt-Mucca Mar 19, 2024
f6ff092
Adds support for partial solution loading
Opt-Mucca Mar 20, 2024
e7ac980
Add error handling for setting non-linear objective
Opt-Mucca Mar 21, 2024
c90bb23
Merge branch 'main' into main
Opt-Mucca Apr 10, 2024
2540f65
Remove dual and rc loading for SCIP. Fix bug of ranged rows
Opt-Mucca Apr 19, 2024
9e5d944
Add safe con.body.constant check
Opt-Mucca Apr 19, 2024
f90dfad
Remove slack loading for SCIP
Opt-Mucca Apr 29, 2024
f703d1f
Remove dual loading test for SCIP
Opt-Mucca Apr 29, 2024
5c02d32
Remove slack for suffix in tests
Opt-Mucca Apr 29, 2024
8ebcf88
Remove TODO for nonlinear handling
Opt-Mucca Apr 29, 2024
236427f
Merge branch 'main' into main
mrmundt Apr 30, 2024
30d8cc6
Skip LP_trivial_constraints for SCIP persistent
Opt-Mucca Jun 13, 2024
8d787ae
Merge branch 'main' into main
Opt-Mucca Jun 13, 2024
30e5e65
Add transformation for add_cons with non float/int rhs e.g. np.int
Opt-Mucca Jun 13, 2024
9104a92
Add warning if type is converted. Tidy up logic
Opt-Mucca Jun 13, 2024
a0324af
Merge branch 'main' into main
blnicho Aug 6, 2024
cbcb96d
Merge branch 'main' into main
blnicho Oct 15, 2024
fecd201
Merge branch 'main' into main
mrmundt Oct 29, 2024
1a4663d
Merge branch 'main' into pr/3200
blnicho Nov 13, 2024
cadfe5c
Merge branch 'main' into main
blnicho Nov 19, 2024
f3f2d7c
Fix num. vars and cons from transformed. Silent warm start fail
Opt-Mucca Nov 20, 2024
e4cdc6e
Merge branch 'main' into main
blnicho Dec 10, 2024
f326493
Merge branch 'main' into main
blnicho Jan 27, 2025
d0df2fc
Merge branch 'main' into main
blnicho Feb 13, 2025
7b18354
Add minor changes
Opt-Mucca Feb 19, 2025
859a1b2
Merge branch 'main' into main
mrmundt Feb 19, 2025
9a6c3eb
Merge branch 'main' into main
mrmundt Mar 20, 2025
27e3d10
Change copyright 2024 to 2025
Opt-Mucca Mar 21, 2025
e916067
Merge branch 'main' into main
mrmundt Mar 24, 2025
ed2cf25
Merge branch 'main' into main
mrmundt Apr 16, 2025
5ea53cd
Merge branch 'main' into main
mrmundt Apr 22, 2025
5aba506
Merge branch 'main' into main
mrmundt Jun 4, 2025
8caea1c
Merge branch 'main' into main
blnicho Jul 3, 2025
dbe63c0
Merge branch 'main' into main
mrmundt Jul 8, 2025
b57ab07
updating solution loader
michaelbynum Aug 9, 2025
070811d
refactoring gurobi interfaces
michaelbynum Aug 9, 2025
27a3a14
Merge branch 'main' into observer_gurobi_refactor
michaelbynum Aug 10, 2025
d70dbb5
revert_gurobi_persistent
michaelbynum Aug 10, 2025
5b1d3f9
refactoring gurobi interfaces
michaelbynum Aug 11, 2025
4818130
refactoring gurobi interfaces
michaelbynum Aug 11, 2025
7998fda
refactoring gurobi interfaces
michaelbynum Aug 12, 2025
909be88
refactoring gurobi interfaces
michaelbynum Aug 12, 2025
862c387
bugs
michaelbynum Aug 12, 2025
8f7a61e
refactoring gurobi interfaces
michaelbynum Aug 12, 2025
92fa4f5
remove unused imports
michaelbynum Aug 12, 2025
8a9fc46
run black
michaelbynum Aug 12, 2025
7249b19
update solution loader
michaelbynum Aug 12, 2025
710807b
Merge remote-tracking branch 'origin/main' into solver_api
michaelbynum Aug 12, 2025
25c48e7
Merge branch 'main' into observer_gurobi_refactor
michaelbynum Aug 12, 2025
438b9b5
Merge remote-tracking branch 'michaelbynum/observer_gurobi_refactor' …
michaelbynum Aug 12, 2025
ac42345
updating solution loader
michaelbynum Aug 12, 2025
df56887
Merge remote-tracking branch 'origin/main' into observer_gurobi_refactor
michaelbynum Aug 12, 2025
275d848
run black
michaelbynum Aug 12, 2025
cfa8633
Merge remote-tracking branch 'michaelbynum/observer_gurobi_refactor' …
michaelbynum Aug 12, 2025
70ca6e7
updating solution loader
michaelbynum Aug 13, 2025
1788ff3
dont free gurobi models twice
michaelbynum Aug 13, 2025
5ec0421
Merge branch 'observer_gurobi_refactor' into solver_api
michaelbynum Aug 13, 2025
2885f42
update solution loader
michaelbynum Aug 13, 2025
d16bee5
adding tests for trivial constraints and fixing bugs
michaelbynum Aug 14, 2025
873f176
merge observer
michaelbynum Aug 14, 2025
c62a7b3
Merge branch 'observer_gurobi_refactor' into solver_api
michaelbynum Aug 14, 2025
a4e2b81
run black
michaelbynum Aug 14, 2025
2001d15
Merge branch 'solver_api' into trivial_constraints
michaelbynum Aug 14, 2025
d25e721
run black
michaelbynum Aug 14, 2025
16ecce0
Merge remote-tracking branch 'opt_mucca/main' into scip
michaelbynum Aug 14, 2025
9e7cd0d
moving scip to contrib solvers
michaelbynum Aug 14, 2025
bf204bb
moving scip to contrib solvers
michaelbynum Aug 14, 2025
dabf031
porting scip interface
michaelbynum Aug 15, 2025
9601768
porting scip interface
michaelbynum Aug 15, 2025
9d2f22a
porting scip interface
michaelbynum Aug 15, 2025
b483729
bugs and tests
michaelbynum Aug 15, 2025
37a31a7
scip direct
michaelbynum Aug 15, 2025
a43a38b
forgot to inherit from PersistentSolverBase
michaelbynum Aug 16, 2025
1750fc5
merge in observer_gurobi_refactor
michaelbynum Aug 16, 2025
02f383d
Merge branch 'solver_api' into trivial_constraints
michaelbynum Aug 16, 2025
3e3509c
Merge branch 'trivial_constraints' into scip_port
michaelbynum Aug 16, 2025
e76baae
bug
michaelbynum Aug 16, 2025
413d63d
Merge branch 'observer_gurobi_refactor' into solver_api
michaelbynum Aug 16, 2025
3d302a1
Merge branch 'solver_api' into trivial_constraints
michaelbynum Aug 16, 2025
6603db6
Merge branch 'trivial_constraints' into scip_port
michaelbynum Aug 16, 2025
0b84dcc
more expression types for scip
michaelbynum Aug 18, 2025
865b622
Merge remote-tracking branch 'michaelbynum/scip_port' into scip_port
michaelbynum Aug 18, 2025
c2a0177
bug
michaelbynum Aug 18, 2025
0bbdd70
Merge branch 'observer_gurobi_refactor' into solver_api
michaelbynum Aug 18, 2025
ecd602d
Merge branch 'solver_api' into trivial_constraints
michaelbynum Aug 18, 2025
efdcd69
Merge branch 'trivial_constraints' into scip_port
michaelbynum Aug 18, 2025
3180462
capture_fd for scip
michaelbynum Aug 20, 2025
b522edd
Merge remote-tracking branch 'michaelbynum/scip_port' into scip_port
michaelbynum Aug 20, 2025
72912e0
working on persistent interface to scip
michaelbynum Aug 22, 2025
2c7208f
Merge branch 'main' into observer_gurobi_refactor
mrmundt Aug 26, 2025
cfa1e91
minor fixes
michaelbynum Sep 1, 2025
19fecf7
merge in main and observer
michaelbynum Oct 2, 2025
31e7e97
Merge remote-tracking branch 'michaelbynum/observer_gurobi_refactor' …
michaelbynum Oct 2, 2025
576a217
run black
michaelbynum Oct 2, 2025
ce99fb2
observer improvements
michaelbynum Oct 4, 2025
066e4fd
run black
michaelbynum Oct 4, 2025
a96b518
merge observer_gurobi_refactor into solver_api
michaelbynum Oct 5, 2025
92e77ba
merge solver_api into trivial_constraints
michaelbynum Oct 5, 2025
281ddc3
merge trivial_constraints into scip_port
michaelbynum Oct 5, 2025
e6331df
persistent interface to scip
michaelbynum Oct 6, 2025
98e2c9a
update docs
michaelbynum Oct 6, 2025
f0be4ff
update docs
michaelbynum Oct 6, 2025
7ec95a8
persistent interface to scip
michaelbynum Oct 6, 2025
75903d6
persistent interface to scip
michaelbynum Oct 6, 2025
0051024
updating tests
michaelbynum Oct 6, 2025
b037b9c
forgot to delete/revert some files
michaelbynum Oct 6, 2025
c200e2e
run black
michaelbynum Oct 6, 2025
960c531
typos
michaelbynum Oct 6, 2025
2f99306
merge observer into scip_port
michaelbynum Oct 16, 2025
6ccbaef
merge observer into observer_gurobi_refactor
michaelbynum Oct 28, 2025
cf000a1
directory for all gurobi interfaces
michaelbynum Nov 1, 2025
9abb4bf
merge main into observer_gurobi_refactor
michaelbynum Nov 1, 2025
7b20095
clean up gurobi interfaces
michaelbynum Nov 1, 2025
43a864f
Merge branch 'observer' into observer_gurobi_refactor
michaelbynum Nov 1, 2025
5073ba0
update gurobi persistent to use observer
michaelbynum Nov 2, 2025
5e280dc
gurobi refactor: bugs
michaelbynum Nov 2, 2025
8bff218
run black
michaelbynum Nov 2, 2025
d9dc14d
typo
michaelbynum Nov 5, 2025
1c26ae3
contrib.solvers: bug in gurobi refactor
michaelbynum Nov 5, 2025
a4858ca
contrib.solver: update tests
michaelbynum Nov 6, 2025
122511b
run black
michaelbynum Nov 7, 2025
71963f1
Changing the config option name for 'use_mipstart' to be 'warmstart_d…
emma58 Nov 7, 2025
8712884
Adding tests for Gurobi warmstarts in all the interfaces
emma58 Nov 7, 2025
8a729c0
Merge branch 'main' into observer_gurobi_refactor
michaelbynum Nov 11, 2025
7069f89
revert modification to ipopt interface
michaelbynum Nov 11, 2025
93bb118
Merge branch 'main' into observer_gurobi_refactor
michaelbynum Nov 12, 2025
7724678
Merge branch 'main' into observer_gurobi_refactor
michaelbynum Nov 14, 2025
9bfad14
contrib.solver.gurobi: better handling of temporary config options
michaelbynum Nov 16, 2025
2ab061a
fix error
michaelbynum Nov 16, 2025
f3d7f3a
contrib.solvers.gurobi: reworking the solution loader
michaelbynum Nov 18, 2025
d08d993
contrib.solvers.gurobi: reworking the solution loader
michaelbynum Nov 18, 2025
3ee4e99
run black
michaelbynum Nov 18, 2025
b9ca201
remove some timing statements
michaelbynum Nov 18, 2025
52d91f5
use absolute paths for imports
michaelbynum Dec 12, 2025
3660227
Merge remote-tracking branch 'origin/main' into observer_gurobi_refactor
michaelbynum Dec 12, 2025
ce4e77c
merge main
michaelbynum Dec 12, 2025
c3f2d48
solution loader updates
michaelbynum Dec 12, 2025
ba4b29c
run black
michaelbynum Dec 12, 2025
045f537
merge main
michaelbynum Dec 12, 2025
4487a69
merge main
michaelbynum Dec 12, 2025
0792800
fix typo
michaelbynum Dec 18, 2025
253bdd9
Merge branch 'solver_api' into trivial_constraints
michaelbynum Dec 18, 2025
3d6f8bb
Merge branch 'trivial_constraints' into scip_port
michaelbynum Dec 18, 2025
879ed3a
update scip interface to use observer
michaelbynum Dec 18, 2025
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
8 changes: 7 additions & 1 deletion .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ jobs:
|| echo "WARNING: Xpress Community Edition is not available"
python -m pip install --cache-dir cache/pip maingopy \
|| echo "WARNING: MAiNGO is not available"
if [[ ${{matrix.python}} == pypy* ]]; then
echo "skipping SCIP for pypy"
else
python -m pip install --cache-dir cache/pip pyscipopt \
|| echo "WARNING: SCIP is not available"
fi
if [[ ${{matrix.python}} == pypy* ]]; then
echo "skipping wntr for pypy"
else
Expand Down Expand Up @@ -399,7 +405,7 @@ jobs:
TIMEOUT_MSG="TIMEOUT: killing conda install process"
PYVER=$(echo "py${{matrix.python}}" | sed 's/\.//g')
echo "Installing for $PYVER"
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip; do
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip pyscipopt; do
echo ""
echo "*** Install $PKG ***"
echo ""
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ jobs:
|| echo "WARNING: Xpress Community Edition is not available"
python -m pip install --cache-dir cache/pip maingopy \
|| echo "WARNING: MAiNGO is not available"
if [[ ${{matrix.python}} == pypy* ]]; then
echo "skipping SCIP for pypy"
else
python -m pip install --cache-dir cache/pip pyscipopt \
|| echo "WARNING: SCIP is not available"
fi
if [[ ${{matrix.python}} == pypy* ]]; then
echo "skipping wntr for pypy"
else
Expand Down Expand Up @@ -452,7 +458,7 @@ jobs:
TIMEOUT_MSG="TIMEOUT: killing conda install process"
PYVER=$(echo "py${{matrix.python}}" | sed 's/\.//g')
echo "Installing for $PYVER"
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip; do
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip pyscipopt; do
echo ""
echo "*** Install $PKG ***"
echo ""
Expand Down
7 changes: 5 additions & 2 deletions pyomo/contrib/observer/component_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from pyomo.core.base.param import ParamData, ScalarParam
from pyomo.core.base.expression import ExpressionData, ScalarExpression
from pyomo.repn.util import ExitNodeDispatcher
from pyomo.common.numeric_types import native_numeric_types
from pyomo.common.collections import ComponentSet


Expand Down Expand Up @@ -80,8 +81,6 @@ def handle_skip(node, collector):
collector_handlers[RangedExpression] = handle_skip
collector_handlers[InequalityExpression] = handle_skip
collector_handlers[EqualityExpression] = handle_skip
collector_handlers[int] = handle_skip
collector_handlers[float] = handle_skip


class _ComponentFromExprCollector(StreamBasedExpressionVisitor):
Expand All @@ -93,6 +92,10 @@ def __init__(self, **kwds):
super().__init__(**kwds)

def exitNode(self, node, data):
if type(node) in native_numeric_types:
# we need this here to handle numpy
# (we can't put numpy in the dispatcher?)
return None
return collector_handlers[node.__class__](node, self)

def beforeChild(self, node, child, child_idx):
Expand Down
3 changes: 2 additions & 1 deletion pyomo/contrib/observer/model_observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ def remove_objectives(self, objs: Collection[ObjectiveData]):
def _check_for_unknown_active_components(self):
for ctype in self._model.collect_ctypes(active=True, descend_into=True):
if not issubclass(ctype, ActiveComponent):
# strangly, this is needed to skip things like Param
continue
if ctype in self._known_active_ctypes:
continue
Expand Down Expand Up @@ -910,7 +911,7 @@ def _update_variables(self, variables: Optional[Collection[VarData]] = None):
reason = Reason.no_change
if _fixed != fixed:
reason |= Reason.fixed
elif _fixed and (value != _value):
elif (_fixed or fixed) and (value != _value):
reason |= Reason.value
if lb is not _lb or ub is not _ub:
reason |= Reason.bounds
Expand Down
41 changes: 2 additions & 39 deletions pyomo/contrib/solver/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,6 @@ def set_objective(self, obj: ObjectiveData):
f"Derived class {self.__class__.__name__} failed to implement required method 'set_objective'."
)

def add_variables(self, variables: List[VarData]):
"""
Add variables to the model.
"""
raise NotImplementedError(
f"Derived class {self.__class__.__name__} failed to implement required method 'add_variables'."
)

def add_parameters(self, params: List[ParamData]):
"""
Add parameters to the model.
"""
raise NotImplementedError(
f"Derived class {self.__class__.__name__} failed to implement required method 'add_parameters'."
)

def add_constraints(self, cons: List[ConstraintData]):
"""
Add constraints to the model.
Expand All @@ -353,22 +337,6 @@ def add_block(self, block: BlockData):
f"Derived class {self.__class__.__name__} failed to implement required method 'add_block'."
)

def remove_variables(self, variables: List[VarData]):
"""
Remove variables from the model.
"""
raise NotImplementedError(
f"Derived class {self.__class__.__name__} failed to implement required method 'remove_variables'."
)

def remove_parameters(self, params: List[ParamData]):
"""
Remove parameters from the model.
"""
raise NotImplementedError(
f"Derived class {self.__class__.__name__} failed to implement required method 'remove_parameters'."
)

def remove_constraints(self, cons: List[ConstraintData]):
"""
Remove constraints from the model.
Expand Down Expand Up @@ -604,15 +572,10 @@ def _solution_handler(
legacy_results._smap_id = id(symbol_map)
delete_legacy_soln = True
if load_solutions:
if hasattr(model, 'dual') and model.dual.import_enabled():
for con, val in results.solution_loader.get_duals().items():
model.dual[con] = val
if hasattr(model, 'rc') and model.rc.import_enabled():
for var, val in results.solution_loader.get_reduced_costs().items():
model.rc[var] = val
results.solution_loader.load_import_suffixes()
elif results.incumbent_objective is not None:
delete_legacy_soln = False
for var, val in results.solution_loader.get_primals().items():
for var, val in results.solution_loader.get_vars().items():
legacy_soln.variable[symbol_map.getSymbol(var)] = {'Value': val}
if hasattr(model, 'dual') and model.dual.import_enabled():
for con, val in results.solution_loader.get_duals().items():
Expand Down
Loading
Loading