Skip to content

Commit 7b551d9

Browse files
authored
Remove choco (#510)
* removing packaged choco * updated history and version
1 parent 876ebd3 commit 7b551d9

File tree

11 files changed

+12
-110
lines changed

11 files changed

+12
-110
lines changed

HISTORY

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
# Copyright S.A.Mitchell ([email protected]), 2007-
33
# Copyright F.Peschiera ([email protected]), 2019-
44
# See the LICENSE file for copyright information.
5-
2.6.0 2021-
6-
dropped packaged choco
7-
fixed bugs
5+
2.7.0
86
added HiGHS solver
97
added pysmps dependency for mps parsing
8+
2.6.0 2021-12-04
9+
dropped packaged choco
10+
fixed bugs
1011
deprecated 'indexs' parameter LpVariable dicts and matrix
1112
2.5.1 2021-09-28
1213
updated docs

doc/source/guides/how_to_configure_solvers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ PuLP has some helper functions that permit a user to query which solvers are ava
1212
1313
import pulp as pl
1414
solver_list = pl.listSolvers()
15-
# ['GLPK_CMD', 'PYGLPK', 'CPLEX_CMD', 'CPLEX_PY', 'CPLEX_DLL', 'GUROBI', 'GUROBI_CMD', 'MOSEK', 'XPRESS', 'PULP_CBC_CMD', 'COIN_CMD', 'COINMP_DLL', 'CHOCO_CMD', 'PULP_CHOCO_CMD', 'MIPCL_CMD', 'SCIP_CMD']
15+
# ['GLPK_CMD', 'PYGLPK', 'CPLEX_CMD', 'CPLEX_PY', 'CPLEX_DLL', 'GUROBI', 'GUROBI_CMD', 'MOSEK', 'XPRESS', 'PULP_CBC_CMD', 'COIN_CMD', 'COINMP_DLL', 'CHOCO_CMD', 'MIPCL_CMD', 'SCIP_CMD']
1616
1717
If passed the `only_available=True` argument, PuLP lists the solvers that are currently available::
1818

1919
import pulp as pl
2020
solver_list = pl.listSolvers(onlyAvailable=True)
21-
# ['GLPK_CMD', 'CPLEX_CMD', 'CPLEX_PY', 'GUROBI', 'GUROBI_CMD', 'PULP_CBC_CMD', 'COIN_CMD', 'PULP_CHOCO_CMD']
21+
# ['GLPK_CMD', 'CPLEX_CMD', 'CPLEX_PY', 'GUROBI', 'GUROBI_CMD', 'PULP_CBC_CMD', 'COIN_CMD']
2222

2323
Also, it's possible to get a solver object by using the name of the solver. Any arguments passed to this function are passed to the constructor:
2424

pulp/apis/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@
2222
COIN_CMD,
2323
COINMP_DLL,
2424
CHOCO_CMD,
25-
PULP_CHOCO_CMD,
2625
MIPCL_CMD,
2726
SCIP_CMD,
2827
]
2928

30-
try:
31-
import ujson as json
32-
except ImportError:
33-
import json
29+
import json
3430

3531
# Default solver selection
3632
if PULP_CBC_CMD().available():

pulp/apis/choco_api.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."""
2626

2727
from .core import LpSolver_CMD, subprocess, PulpSolverError
28-
from .core import pulp_choco_path
2928
import os
3029
from .. import constants
3130
import warnings
@@ -157,54 +156,3 @@ def readsol(filename):
157156
values[name] = float(value)
158157

159158
return status, values, sol_status
160-
161-
162-
class PULP_CHOCO_CMD(CHOCO_CMD):
163-
"""
164-
This solver uses a packaged version of choco provided with the package
165-
"""
166-
167-
pulp_choco_path = pulp_choco_path
168-
name = "PULP_CHOCO_CMD"
169-
try:
170-
if os.name != "nt":
171-
if not os.access(pulp_choco_path, os.X_OK):
172-
import stat
173-
174-
os.chmod(pulp_choco_path, stat.S_IXUSR + stat.S_IXOTH)
175-
except: # probably due to incorrect permissions
176-
177-
def available(self):
178-
"""True if the solver is available"""
179-
return False
180-
181-
def actualSolve(self, lp, callback=None):
182-
"""Solve a well formulated lp problem"""
183-
raise PulpSolverError(
184-
"PULP_CHOCO_CMD: Not Available (check permissions on %s)"
185-
% self.pulp_choco_path
186-
)
187-
188-
else:
189-
190-
def __init__(
191-
self,
192-
path=None,
193-
keepFiles=0,
194-
mip=True,
195-
msg=True,
196-
options=None,
197-
timeLimit=None,
198-
):
199-
if path is not None:
200-
raise PulpSolverError("Use CHOCO_CMD if you want to set a path")
201-
# check that the file is executable
202-
CHOCO_CMD.__init__(
203-
self,
204-
path=self.pulp_choco_path,
205-
keepFiles=keepFiles,
206-
mip=mip,
207-
msg=msg,
208-
options=options,
209-
timeLimit=timeLimit,
210-
)

pulp/apis/core.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ def initialize(filename, operating_system="linux", arch="64"):
146146
scip_path = config.get("locations", "ScipPath")
147147
except configparser.Error:
148148
scip_path = "scip"
149-
try:
150-
pulp_choco_path = config.get("locations", "PulpChocoPath")
151-
except configparser.Error:
152-
pulp_choco_path = "choco"
153149
for i, path in enumerate(coinMP_path):
154150
if not os.path.dirname(path):
155151
# if no pathname is supplied assume the file is in the same directory
@@ -164,7 +160,6 @@ def initialize(filename, operating_system="linux", arch="64"):
164160
glpk_path,
165161
pulp_cbc_path,
166162
scip_path,
167-
pulp_choco_path,
168163
)
169164

170165

@@ -199,7 +194,6 @@ def initialize(filename, operating_system="linux", arch="64"):
199194
glpk_path,
200195
pulp_cbc_path,
201196
scip_path,
202-
pulp_choco_path,
203197
) = initialize(config_filename, operating_system, arch)
204198

205199

pulp/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
This file contains the constant definitions for PuLP
2828
Note that hopefully these will be changed into something more pythonic
2929
"""
30-
VERSION = "2.5.1"
30+
VERSION = "2.6.0"
3131
EPS = 1e-7
3232

3333
# variable categories

pulp/solverdir/choco/__init__.py

Whitespace-only changes.
-27.4 MB
Binary file not shown.

pulp/solverdir/choco/license.txt

Lines changed: 0 additions & 29 deletions
This file was deleted.

pulp/tests/test_pulp.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_pulp_009(self):
7373
{x: 4, y: -1, z: 6, w: 0},
7474
use_mps=False,
7575
)
76-
elif self.solver.__class__ in [PULP_CHOCO_CMD, CHOCO_CMD, MIPCL_CMD]:
76+
elif self.solver.__class__ in [CHOCO_CMD, MIPCL_CMD]:
7777
# this error is not detected with mps and choco, MIPCL_CMD can only use mps files
7878
pass
7979
else:
@@ -152,7 +152,7 @@ def test_pulp_012(self):
152152
elif self.solver.__class__ in [GUROBI_CMD, SCIP_CMD]:
153153
# GUROBI_CMD has a very simple interface
154154
pulpTestCheck(prob, self.solver, [const.LpStatusNotSolved])
155-
elif self.solver.__class__ in [PULP_CHOCO_CMD, CHOCO_CMD]:
155+
elif self.solver.__class__ in [CHOCO_CMD]:
156156
# choco bounds all variables. Would not return unbounded status
157157
pass
158158
else:
@@ -217,7 +217,6 @@ def test_pulp_014(self):
217217
CPLEX_PY,
218218
GLPK_CMD,
219219
GUROBI_CMD,
220-
PULP_CHOCO_CMD,
221220
CHOCO_CMD,
222221
MIPCL_CMD,
223222
MOSEK,
@@ -415,7 +414,6 @@ def test_pulp_030(self):
415414
print("\t Testing MIP relaxation")
416415
if self.solver.__class__ in [
417416
GUROBI_CMD,
418-
PULP_CHOCO_CMD,
419417
CHOCO_CMD,
420418
MIPCL_CMD,
421419
SCIP_CMD,
@@ -755,7 +753,7 @@ def test_pulp_123(self):
755753
elif self.solver.__class__ in [GUROBI_CMD, SCIP_CMD]:
756754
# GLPK_CMD Does not report unbounded problems, correctly
757755
pulpTestCheck(prob, self.solver, [const.LpStatusNotSolved])
758-
elif self.solver.__class__ in [PULP_CHOCO_CMD, CHOCO_CMD]:
756+
elif self.solver.__class__ in [CHOCO_CMD]:
759757
# choco bounds all variables. Would not return unbounded status
760758
pass
761759
else:
@@ -944,7 +942,7 @@ def test_timeLimit(self):
944942
self.solver.timeLimit = 20
945943
# CHOCO has issues when given a time limit
946944
print("\t Testing timeLimit argument")
947-
if self.solver.name != "PULP_CHOCO_CMD":
945+
if self.solver.name != "CHOCO_CMD":
948946
pulpTestCheck(
949947
prob,
950948
self.solver,
@@ -1327,10 +1325,6 @@ class YAPOSIBTest(BaseSolverTest.PuLPTest):
13271325
solveInst = YAPOSIB
13281326

13291327

1330-
class PULP_CHOCO_CMDTest(BaseSolverTest.PuLPTest):
1331-
solveInst = PULP_CHOCO_CMD
1332-
1333-
13341328
class CHOCO_CMDTest(BaseSolverTest.PuLPTest):
13351329
solveInst = CHOCO_CMD
13361330

0 commit comments

Comments
 (0)