diff --git a/HISTORY b/HISTORY index 07fb28ee..d3baf306 100644 --- a/HISTORY +++ b/HISTORY @@ -2,11 +2,12 @@ # 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.6.0 2021- - dropped packaged choco - fixed bugs +2.7.0 added HiGHS solver added pysmps dependency for mps parsing +2.6.0 2021-12-04 + dropped packaged choco + fixed bugs deprecated 'indexs' parameter LpVariable dicts and matrix 2.5.1 2021-09-28 updated docs diff --git a/doc/source/guides/how_to_configure_solvers.rst b/doc/source/guides/how_to_configure_solvers.rst index 1299970d..32f112bd 100644 --- a/doc/source/guides/how_to_configure_solvers.rst +++ b/doc/source/guides/how_to_configure_solvers.rst @@ -12,13 +12,13 @@ PuLP has some helper functions that permit a user to query which solvers are ava import pulp as pl solver_list = pl.listSolvers() - # ['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'] + # ['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'] If passed the `only_available=True` argument, PuLP lists the solvers that are currently available:: import pulp as pl solver_list = pl.listSolvers(onlyAvailable=True) - # ['GLPK_CMD', 'CPLEX_CMD', 'CPLEX_PY', 'GUROBI', 'GUROBI_CMD', 'PULP_CBC_CMD', 'COIN_CMD', 'PULP_CHOCO_CMD'] + # ['GLPK_CMD', 'CPLEX_CMD', 'CPLEX_PY', 'GUROBI', 'GUROBI_CMD', 'PULP_CBC_CMD', 'COIN_CMD'] 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: diff --git a/pulp/apis/__init__.py b/pulp/apis/__init__.py index 73aad22d..62634c6f 100644 --- a/pulp/apis/__init__.py +++ b/pulp/apis/__init__.py @@ -22,15 +22,11 @@ COIN_CMD, COINMP_DLL, CHOCO_CMD, - PULP_CHOCO_CMD, MIPCL_CMD, SCIP_CMD, ] -try: - import ujson as json -except ImportError: - import json +import json # Default solver selection if PULP_CBC_CMD().available(): diff --git a/pulp/apis/choco_api.py b/pulp/apis/choco_api.py index b5699b36..c9419ae1 100644 --- a/pulp/apis/choco_api.py +++ b/pulp/apis/choco_api.py @@ -25,7 +25,6 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.""" from .core import LpSolver_CMD, subprocess, PulpSolverError -from .core import pulp_choco_path import os from .. import constants import warnings @@ -157,54 +156,3 @@ def readsol(filename): values[name] = float(value) return status, values, sol_status - - -class PULP_CHOCO_CMD(CHOCO_CMD): - """ - This solver uses a packaged version of choco provided with the package - """ - - pulp_choco_path = pulp_choco_path - name = "PULP_CHOCO_CMD" - try: - if os.name != "nt": - if not os.access(pulp_choco_path, os.X_OK): - import stat - - os.chmod(pulp_choco_path, stat.S_IXUSR + stat.S_IXOTH) - except: # probably due to incorrect permissions - - def available(self): - """True if the solver is available""" - return False - - def actualSolve(self, lp, callback=None): - """Solve a well formulated lp problem""" - raise PulpSolverError( - "PULP_CHOCO_CMD: Not Available (check permissions on %s)" - % self.pulp_choco_path - ) - - else: - - def __init__( - self, - path=None, - keepFiles=0, - mip=True, - msg=True, - options=None, - timeLimit=None, - ): - if path is not None: - raise PulpSolverError("Use CHOCO_CMD if you want to set a path") - # check that the file is executable - CHOCO_CMD.__init__( - self, - path=self.pulp_choco_path, - keepFiles=keepFiles, - mip=mip, - msg=msg, - options=options, - timeLimit=timeLimit, - ) diff --git a/pulp/apis/core.py b/pulp/apis/core.py index 6020adae..d7d85a67 100644 --- a/pulp/apis/core.py +++ b/pulp/apis/core.py @@ -146,10 +146,6 @@ def initialize(filename, operating_system="linux", arch="64"): scip_path = config.get("locations", "ScipPath") except configparser.Error: scip_path = "scip" - try: - pulp_choco_path = config.get("locations", "PulpChocoPath") - except configparser.Error: - pulp_choco_path = "choco" for i, path in enumerate(coinMP_path): if not os.path.dirname(path): # 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"): glpk_path, pulp_cbc_path, scip_path, - pulp_choco_path, ) @@ -199,7 +194,6 @@ def initialize(filename, operating_system="linux", arch="64"): glpk_path, pulp_cbc_path, scip_path, - pulp_choco_path, ) = initialize(config_filename, operating_system, arch) diff --git a/pulp/constants.py b/pulp/constants.py index a3c3db70..48f3fc53 100644 --- a/pulp/constants.py +++ b/pulp/constants.py @@ -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.5.1" +VERSION = "2.6.0" EPS = 1e-7 # variable categories diff --git a/pulp/solverdir/choco/__init__.py b/pulp/solverdir/choco/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pulp/solverdir/choco/choco-parsers-with-dependencies.jar b/pulp/solverdir/choco/choco-parsers-with-dependencies.jar deleted file mode 100755 index 844321d7..00000000 Binary files a/pulp/solverdir/choco/choco-parsers-with-dependencies.jar and /dev/null differ diff --git a/pulp/solverdir/choco/license.txt b/pulp/solverdir/choco/license.txt deleted file mode 100644 index bc2cef1e..00000000 --- a/pulp/solverdir/choco/license.txt +++ /dev/null @@ -1,29 +0,0 @@ -BSD 4-Clause License - -Copyright (c) 2017, IMT Atlantique -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by the IMT Atlantique. -4. Neither the name of the IMT Atlantique nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY IMT Atlantique ''AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL IMT Atlantique BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/pulp/tests/test_pulp.py b/pulp/tests/test_pulp.py index af697e86..8dcc8981 100644 --- a/pulp/tests/test_pulp.py +++ b/pulp/tests/test_pulp.py @@ -73,7 +73,7 @@ def test_pulp_009(self): {x: 4, y: -1, z: 6, w: 0}, use_mps=False, ) - elif self.solver.__class__ in [PULP_CHOCO_CMD, CHOCO_CMD, MIPCL_CMD]: + elif self.solver.__class__ in [CHOCO_CMD, MIPCL_CMD]: # this error is not detected with mps and choco, MIPCL_CMD can only use mps files pass else: @@ -152,7 +152,7 @@ def test_pulp_012(self): elif self.solver.__class__ in [GUROBI_CMD, SCIP_CMD]: # GUROBI_CMD has a very simple interface pulpTestCheck(prob, self.solver, [const.LpStatusNotSolved]) - elif self.solver.__class__ in [PULP_CHOCO_CMD, CHOCO_CMD]: + elif self.solver.__class__ in [CHOCO_CMD]: # choco bounds all variables. Would not return unbounded status pass else: @@ -217,7 +217,6 @@ def test_pulp_014(self): CPLEX_PY, GLPK_CMD, GUROBI_CMD, - PULP_CHOCO_CMD, CHOCO_CMD, MIPCL_CMD, MOSEK, @@ -415,7 +414,6 @@ def test_pulp_030(self): print("\t Testing MIP relaxation") if self.solver.__class__ in [ GUROBI_CMD, - PULP_CHOCO_CMD, CHOCO_CMD, MIPCL_CMD, SCIP_CMD, @@ -755,7 +753,7 @@ def test_pulp_123(self): elif self.solver.__class__ in [GUROBI_CMD, SCIP_CMD]: # GLPK_CMD Does not report unbounded problems, correctly pulpTestCheck(prob, self.solver, [const.LpStatusNotSolved]) - elif self.solver.__class__ in [PULP_CHOCO_CMD, CHOCO_CMD]: + elif self.solver.__class__ in [CHOCO_CMD]: # choco bounds all variables. Would not return unbounded status pass else: @@ -944,7 +942,7 @@ def test_timeLimit(self): self.solver.timeLimit = 20 # CHOCO has issues when given a time limit print("\t Testing timeLimit argument") - if self.solver.name != "PULP_CHOCO_CMD": + if self.solver.name != "CHOCO_CMD": pulpTestCheck( prob, self.solver, @@ -1327,10 +1325,6 @@ class YAPOSIBTest(BaseSolverTest.PuLPTest): solveInst = YAPOSIB -class PULP_CHOCO_CMDTest(BaseSolverTest.PuLPTest): - solveInst = PULP_CHOCO_CMD - - class CHOCO_CMDTest(BaseSolverTest.PuLPTest): solveInst = CHOCO_CMD diff --git a/setup.py b/setup.py index 934b050c..8d0641c7 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,6 @@ "pulp.solverdir.cbc.win.32", "pulp.solverdir.cbc.win.64", "pulp.solverdir.cbc.osx.64", - "pulp.solverdir.choco", ], package_data={ "pulp.solverdir.cbc.linux.32": ["*", "*.*"], @@ -52,7 +51,6 @@ "pulp.solverdir.cbc.win.32": ["*", "*.*"], "pulp.solverdir.cbc.win.64": ["*", "*.*"], "pulp.solverdir.cbc.osx.64": ["*", "*.*"], - "pulp.solverdir.choco": ["*", "*.*"], }, include_package_data=True, install_requires=[],