Skip to content

Commit

Permalink
Version change (#691)
Browse files Browse the repository at this point in the history
* cleaning of deprecation + change of version

* fix some more deprecation issues

* updated HISTORY and included Antony Phillips in authors.
  • Loading branch information
pchtsp authored Jan 12, 2024
1 parent 67e0852 commit e602a40
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 214 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Roy, J.S
Mitchell, Stuart A
Christophe-Marie Duquesne (PYGLPK and YAPOSIB bindings)
Franco Peschiera
Antony Phillips
8 changes: 8 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# Copyright S.A.Mitchell (s.mitchell@auckland.ac.nz), 2007-
# Copyright F.Peschiera (pchtsp@gmail.com), 2019-
# See the LICENSE file for copyright information.
2.8.0 2024-01-12
mip start in HiGHS_CMD and SCIP_PY
GUROBI solver with environment handling
added COPT solver
added gurobi, highs, xpress, copt to github actions
cbc arm binary
fixes to SCIPS
took out deprecations in arguments
2.7.0
added HiGHS solver
added XPRESS_PY solver
Expand Down
7 changes: 0 additions & 7 deletions pulp/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,3 @@ def listSolvers(onlyAvailable=False):
result.append(solver.name)
del solver
return result


# DEPRECATED aliases:
get_solver = getSolver
get_solver_from_json = getSolverFromJson
get_solver_from_dict = getSolverFromDict
list_solvers = listSolvers
40 changes: 3 additions & 37 deletions pulp/apis/coin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ def __init__(
mip=True,
msg=True,
timeLimit=None,
fracGap=None,
maxSeconds=None,
gapRel=None,
gapAbs=None,
presolve=None,
Expand All @@ -62,7 +60,6 @@ def __init__(
threads=None,
logPath=None,
timeMode="elapsed",
mip_start=False,
maxNodes=None,
):
"""
Expand All @@ -80,35 +77,10 @@ def __init__(
:param bool presolve: if True, adds presolve on
:param bool cuts: if True, adds gomory on knapsack on probing on
:param bool strong: if True, adds strong
:param float fracGap: deprecated for gapRel
:param float maxSeconds: deprecated for timeLimit
:param str timeMode: "elapsed": count wall-time to timeLimit; "cpu": count cpu-time
:param bool mip_start: deprecated for warmStart
:param int maxNodes: max number of nodes during branching. Stops the solving when reached.
"""

if fracGap is not None:
warnings.warn("Parameter fracGap is being deprecated for gapRel")
if gapRel is not None:
warnings.warn("Parameter gapRel and fracGap passed, using gapRel")
else:
gapRel = fracGap
if maxSeconds is not None:
warnings.warn("Parameter maxSeconds is being deprecated for timeLimit")
if timeLimit is not None:
warnings.warn(
"Parameter timeLimit and maxSeconds passed, using timeLimit"
)
else:
timeLimit = maxSeconds
if mip_start:
warnings.warn("Parameter mip_start is being deprecated for warmStart")
if warmStart:
warnings.warn(
"Parameter mipStart and mip_start passed, using warmStart"
)
else:
warmStart = mip_start
LpSolver_CMD.__init__(
self,
gapRel=gapRel,
Expand Down Expand Up @@ -377,8 +349,6 @@ def __init__(
mip=True,
msg=True,
timeLimit=None,
fracGap=None,
maxSeconds=None,
gapRel=None,
gapAbs=None,
presolve=None,
Expand All @@ -390,7 +360,6 @@ def __init__(
path=None,
threads=None,
logPath=None,
mip_start=False,
timeMode="elapsed",
):
if path is not None:
Expand All @@ -402,8 +371,6 @@ def __init__(
mip=mip,
msg=msg,
timeLimit=timeLimit,
fracGap=fracGap,
maxSeconds=maxSeconds,
gapRel=gapRel,
gapAbs=gapAbs,
presolve=presolve,
Expand All @@ -414,7 +381,6 @@ def __init__(
keepFiles=keepFiles,
threads=threads,
logPath=logPath,
mip_start=mip_start,
timeMode=timeMode,
)

Expand Down Expand Up @@ -478,14 +444,14 @@ def __init__(
rounding=1,
integerPresolve=1,
strong=5,
epgap=None,
*args,
**kwargs,
):
LpSolver.__init__(self, *args, **kwargs)
self.fracGap = None
if epgap is not None:
self.fracGap = float(epgap)
gapRel = self.optionsDict.get("gapRel")
if gapRel is not None:
self.fracGap = float(gapRel)
if self.timeLimit is not None:
self.timeLimit = float(self.timeLimit)
# Todo: these options are not yet implemented
Expand Down
25 changes: 0 additions & 25 deletions pulp/apis/copt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ def __init__(
"""
Initialize command-line solver
"""
if mip_start:
warnings.warn("Parameter mip_start is being deprecated for warmStart")
if warmStart:
warnings.warn(
"Parameter warmStart and mip_start passed, using warmStart"
)
else:
warmStart = mip_start

LpSolver_CMD.__init__(self, path, keepFiles, mip, msg, [])

self.mipstart = warmStart
Expand Down Expand Up @@ -333,14 +324,6 @@ def __init__(
"""
Initialize COPT solver
"""
if mip_start:
warnings.warn("Parameter mip_start is being deprecated for warmStart")
if warmStart:
warnings.warn(
"Parameter warmStart and mip_start passed, using warmStart"
)
else:
warmStart = mip_start

LpSolver.__init__(self, mip, msg)

Expand Down Expand Up @@ -888,7 +871,6 @@ def __init__(
mip=True,
msg=True,
timeLimit=None,
epgap=None,
gapRel=None,
warmStart=False,
logPath=None,
Expand All @@ -901,14 +883,7 @@ def __init__(
:param float gapRel: relative gap tolerance for the solver to stop (in fraction)
:param bool warmStart: if True, the solver will use the current value of variables as a start
:param str logPath: path to the log file
:param float epgap: deprecated for gapRel
"""
if epgap is not None:
warnings.warn("Parameter epgap is being deprecated for gapRel")
if gapRel is not None:
warnings.warn("Parameter gapRel and epgap passed, using gapRel")
else:
gapRel = epgap

LpSolver.__init__(
self,
Expand Down
38 changes: 0 additions & 38 deletions pulp/apis/cplex_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class CPLEX_CMD(LpSolver_CMD):

def __init__(
self,
timelimit=None,
mip=True,
msg=True,
timeLimit=None,
Expand All @@ -25,7 +24,6 @@ def __init__(
logPath=None,
maxMemory=None,
maxNodes=None,
mip_start=False,
):
"""
:param bool mip: if False, assume LP even if integer variables
Expand All @@ -41,25 +39,7 @@ def __init__(
:param str logPath: path to the log file
:param float maxMemory: max memory to use during the solving. Stops the solving when reached.
:param int maxNodes: max number of nodes during branching. Stops the solving when reached.
:param bool mip_start: deprecated for warmStart
:param float timelimit: deprecated for timeLimit
"""
if timelimit is not None:
warnings.warn("Parameter timelimit is being deprecated for timeLimit")
if timeLimit is not None:
warnings.warn(
"Parameter timeLimit and timelimit passed, using timeLimit "
)
else:
timeLimit = timelimit
if mip_start:
warnings.warn("Parameter mip_start is being deprecated for warmStart")
if warmStart:
warnings.warn(
"Parameter mipStart and mip_start passed, using warmStart"
)
else:
warmStart = mip_start
LpSolver_CMD.__init__(
self,
gapRel=gapRel,
Expand Down Expand Up @@ -293,8 +273,6 @@ def __init__(
gapRel=None,
warmStart=False,
logPath=None,
epgap=None,
logfilename=None,
threads=None,
):
"""
Expand All @@ -304,24 +282,8 @@ def __init__(
:param float gapRel: relative gap tolerance for the solver to stop (in fraction)
:param bool warmStart: if True, the solver will use the current value of variables as a start
:param str logPath: path to the log file
:param float epgap: deprecated for gapRel
:param str logfilename: deprecated for logPath
:param int threads: number of threads to be used by CPLEX to solve a problem (default None uses all available)
"""
if epgap is not None:
warnings.warn("Parameter epgap is being deprecated for gapRel")
if gapRel is not None:
warnings.warn("Parameter gapRel and epgap passed, using gapRel")
else:
gapRel = epgap
if logfilename is not None:
warnings.warn("Parameter logfilename is being deprecated for logPath")
if logPath is not None:
warnings.warn(
"Parameter logPath and logfilename passed, using logPath"
)
else:
logPath = logfilename

LpSolver.__init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions pulp/apis/glpk_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ def actualSolve(self, lp, callback=None):
else:

def __init__(
self, mip=True, msg=True, timeLimit=None, epgap=None, **solverParams
self, mip=True, msg=True, timeLimit=None, gapRel=None, **solverParams
):
"""
Initializes the glpk solver.
@param mip: if False the solver will solve a MIP as an LP
@param msg: displays information from the solver to stdout
@param timeLimit: not handled
@param epgap: not handled
@param gapRel: not handled
@param solverParams: not handled
"""
LpSolver.__init__(self, mip, msg)
Expand Down
20 changes: 1 addition & 19 deletions pulp/apis/gurobi_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def __init__(
mip=True,
msg=True,
timeLimit=None,
epgap=None,
gapRel=None,
warmStart=False,
logPath=None,
Expand All @@ -86,7 +85,6 @@ def __init__(
:param float gapRel: relative gap tolerance for the solver to stop (in fraction)
:param bool warmStart: if True, the solver will use the current value of variables as a start
:param str logPath: path to the log file
:param float epgap: deprecated for gapRel
:param gp.Env env: Gurobi environment to use. Default None.
:param dict envOptions: environment options.
:param bool manageEnv: if False, assume the environment is handled by the user.
Expand Down Expand Up @@ -148,13 +146,6 @@ def __init__(
self.model = None
self.init_gurobi = False # whether env and model have been initialised

if epgap is not None:
warnings.warn("Parameter epgap is being deprecated for gapRel")
if gapRel is not None:
warnings.warn("Parameter gapRel and epgap passed, using gapRel")
else:
gapRel = epgap

LpSolver.__init__(
self,
mip=mip,
Expand Down Expand Up @@ -243,7 +234,7 @@ def available(self):
try:
with gp.Env(params=self.env_options):
pass
except gurobipy.GurobiError as e:
except gp.GurobiError as e:
warnings.warn(f"GUROBI error: {e}.")
return False
return True
Expand Down Expand Up @@ -416,16 +407,7 @@ def __init__(
:param bool keepFiles: if True, files are saved in the current directory and not deleted after solving
:param str path: path to the solver binary
:param str logPath: path to the log file
:param bool mip_start: deprecated for warmStart
"""
if mip_start:
warnings.warn("Parameter mip_start is being deprecated for warmStart")
if warmStart:
warnings.warn(
"Parameter warmStart and mip_start passed, using warmStart"
)
else:
warmStart = mip_start
LpSolver_CMD.__init__(
self,
gapRel=gapRel,
Expand Down
18 changes: 0 additions & 18 deletions pulp/apis/xpress_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def __init__(
options=None,
keepFiles=False,
path=None,
maxSeconds=None,
targetGap=None,
heurFreq=None,
heurStra=None,
coverCuts=None,
Expand All @@ -69,8 +67,6 @@ def __init__(
:param bool msg: if False, no log is shown
:param float timeLimit: maximum time for solver (in seconds)
:param float gapRel: relative gap tolerance for the solver to stop (in fraction)
:param maxSeconds: deprecated for timeLimit
:param targetGap: deprecated for gapRel
:param heurFreq: the frequency at which heuristics are used in the tree search
:param heurStra: heuristic strategy
:param coverCuts: the number of rounds of lifted cover inequalities at the top node
Expand All @@ -80,20 +76,6 @@ def __init__(
https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/chapter7.html
:param bool warmStart: if True, then use current variable values as start
"""
if maxSeconds:
warnings.warn("Parameter maxSeconds is being deprecated for timeLimit")
if timeLimit is not None:
warnings.warn(
"Parameter timeLimit and maxSeconds passed, using timeLimit"
)
else:
timeLimit = maxSeconds
if targetGap is not None:
warnings.warn("Parameter targetGap is being deprecated for gapRel")
if gapRel is not None:
warnings.warn("Parameter gapRel and epgap passed, using gapRel")
else:
gapRel = targetGap
LpSolver_CMD.__init__(
self,
gapRel=gapRel,
Expand Down
2 changes: 1 addition & 1 deletion pulp/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
This file contains the constant definitions for PuLP
Note that hopefully these will be changed into something more pythonic
"""
VERSION = "2.7.0"
VERSION = "2.8.0"
EPS = 1e-7

# variable categories
Expand Down
Loading

0 comments on commit e602a40

Please sign in to comment.