mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-10 03:18:52 -06:00
Make InternalSolver clonable
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from overrides import overrides
|
||||
from pyomo import environ as pe
|
||||
from scipy.stats import randint
|
||||
|
||||
@@ -27,9 +28,12 @@ class XpressPyomoSolver(BasePyomoSolver):
|
||||
def __init__(self, params: SolverParams = None) -> None:
|
||||
if params is None:
|
||||
params = {}
|
||||
if "randomseed" not in params.keys():
|
||||
params["randomseed"] = randint(low=0, high=1000).rvs()
|
||||
params["randomseed"] = randint(low=0, high=1000).rvs()
|
||||
super().__init__(
|
||||
solver_factory=pe.SolverFactory("xpress_persistent"),
|
||||
params=params,
|
||||
)
|
||||
|
||||
@overrides
|
||||
def clone(self) -> "XpressPyomoSolver":
|
||||
return XpressPyomoSolver(params=self.params)
|
||||
|
||||
Reference in New Issue
Block a user