Skip to content

Commit

Permalink
Pulp interface xpress py (coin-or#560)
Browse files Browse the repository at this point in the history
* Add an alias for the Xpress command line solver.

* Implement a solver that uses the XPRESS Python API.

* Added XPRESS_PY solver to tests

* Fix casting of control value: last attempt should change a string.

* Fix checking for flush messages.

* Mention warmstart support in documentation.

* Support warmstart also for non-MIP.

* Fix handling of infeasible cases.

If there is no solution then `getlpsol()` and/or `getmipsol()` will
raise an exception.

* Expect that `XPRESS_PY` errors on duplicate names.

* Map XPRESS exceptions to PulpSolverError.

* Formatted xpress_api.py to pass PR checks

* Add support SOS constraints.

* Fixed handling of SOS constraints.

- There was a typo in the code that handles SOS.
- If there are SOS constraints, then the model is a MIP from XPRESS'
  point of view.
- In the console we should use `LPOPTIMIZE` and `MIPOPTIMIZE` rather
  than `MINIM`/`MAXIM` followed by `GLOBAL`. The latter approach
  seems to have problems with models that contain SOSs but no integer
  variables.

* Adapt expected results for `XPRESS_CMD`.

This interface is an alias for `XPRESS` and thus behaves the same.

* Get back things that were list during rebase.

* Fix formatting.

* Remove unused argument.

* Rename `_xprs` attribute to `solverModel` to align with documentation.

* Split `_solve()` into `callSolver()` and `findSolutionValues()`.

This aligns the code with the documentation.

* Align solution proocess to documentation.

Solving a model is now performed in three steps:
- self.buildSolverModel()
- self.callSolver()
- self.findSolutionValues()

This aligns the code to the way how adding 3rd party solvers is
documented.

* Change definition of alias.

* Fix some problems that the reviewer found.

Co-authored-by: Chris Brown <[email protected]>
  • Loading branch information
djunglas and chrisb-fico authored Aug 22, 2022
1 parent 412fb5f commit ff8d48f
Show file tree
Hide file tree
Showing 4 changed files with 460 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/source/guides/how_to_mip_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Many solvers permit the possibility of giving a valid (or parcially valid in som
Supported solver APIs
-----------------------

The present solver APIs that work with PuLP warm-start are the following: ``CPLEX_CMD``, ``GUROBI_CMD``, ``PULP_CBC_CMD``, ``CBC_CMD``, ``CPLEX_PY``, ``GUROBI``, ``XPRESS``.
The present solver APIs that work with PuLP warm-start are the following: ``CPLEX_CMD``, ``GUROBI_CMD``, ``PULP_CBC_CMD``, ``CBC_CMD``, ``CPLEX_PY``, ``GUROBI``, ``XPRESS``, ``XPRESS_PY``.

Example problem
----------------
Expand Down
2 changes: 2 additions & 0 deletions pulp/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
GUROBI_CMD,
MOSEK,
XPRESS,
XPRESS_CMD,
XPRESS_PY,
PULP_CBC_CMD,
COIN_CMD,
COINMP_DLL,
Expand Down
Loading

0 comments on commit ff8d48f

Please sign in to comment.