Skip to content

Commit

Permalink
Update to XPRESS 9.0 (#82)
Browse files Browse the repository at this point in the history
* rename JNI module "main"

* Remove useless XPRESS lib dependencies

* Remove useless XPRESS lib dependencies from implementation

* temporarily deactivate windows build

* temporarily deactivate windows build pt2

* reactivate windows build

* update python script

* code style

* cleanup

* correction to stay compatible with xpress 8.13

* correction to stay compatible with xpress 8.13

* clean up python script

* Update python script to detect control parameters

* Update for XPRESS 9.0. Add seperate Int64 controls. Exclude parameters that are not for XPRSprob and XPRS_COMPUTE

* fix link in README.md

* test build with XPRESS 9.0

* test build with XPRESS 9.0

* update workflows

* update workflows

* update workflows

* review changes
  • Loading branch information
pet-mit authored Mar 7, 2023
1 parent c055373 commit dca59f6
Show file tree
Hide file tree
Showing 8 changed files with 544 additions and 464 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
container: 'centos:centos7'
env:
SIRIUS_RELEASE_TAG: antares-integration-v1.3
XPRESS_INSTALL_DIR: xpressmp813/
XPRESS_INSTALL_DIR: xpressmp/
SIRIUS_INSTALL_DIR: sirius_install/
strategy:
fail-fast: false
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
with:
repository: rte-france/xpress-mp
path: ${{ env.XPRESS_INSTALL_DIR }}
ref: master
ref: "9.0"
token: ${{ secrets.ACCESS_TOKEN }}

- name: set Xpress variables
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ubuntu-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
runs-on: ${{ matrix.os }}
env:
SIRIUS_RELEASE_TAG: ${{ matrix.sirius-release-tag }}
XPRESSDIR: ${{ github.workspace }}/xpressmp813
XPRESS: ${{ github.workspace }}/xpressmp813/bin
XPRS_LIB_PATH: ${{ github.workspace }}/xpressmp813/lib
XPRESSDIR: ${{ github.workspace }}/xpressmp
XPRESS: ${{ github.workspace }}/xpressmp/bin
XPRS_LIB_PATH: ${{ github.workspace }}/xpressmp/lib
SIRIUS_INSTALL_PATH : ${{ github.workspace }}/sirius_install
SIRIUS: ${{ github.workspace }}/sirius_install/bin
strategy:
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
with:
key: ${{ matrix.os }}-${{ matrix.shared }}-${{ matrix.sirius }}-${{ matrix.python-version }}

- name: setup envoronment
- name: setup environment
uses: ./.github/workflows/setup-env
with:
os: ${{ matrix.os }}
Expand All @@ -176,15 +176,15 @@ jobs:
with:
repository: rte-france/xpress-mp
path: ${{ env.XPRESSDIR }}
ref: master
ref: "9.0"
token: ${{ secrets.ACCESS_TOKEN }}
- name: Checkout Xpress windows
if: ${{ startsWith(matrix.os, 'windows') }}
uses: actions/checkout@v2
with:
repository: rte-france/xpress-mp-temp
path: ${{ env.XPRESSDIR }}
ref: master
ref: "9.0"
token: ${{ secrets.ACCESS_TOKEN }}

- name: set cache variables
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ developed by [RTE](https://www.rte-france.com/).
In order to use a version of ortools with the support of Xpress, a valid Xpress installation is required.
Ortools looks for the environment variable `XPRESS` that contains the path of the dynamic libraries of the solver.

#### Updating the Xpress version
If you need to build OR-Tools for a different XPRESS version than the last supported one, you can use Python script
[parse_header_xpress](ortools/xpress/parse_header_xpress.py) to make things easier.
Use it along with the XPRESS header file you have in your version:
~~~bash
python3 /path/to/ortools/linear_solver/xpress/parse_header_xpress.py /path/to/xpress/include/xprs.h
~~~
The script will output multiple sections that you should use to replace some parts of the code of the XPRESS interface.

### Using Sirius
In order to use a version of ortools with the support of Sirius, the dynamic library of Sirius must be present on the machine. When using the dynamically linked distribution, file libsirius_solver.so / libsirius_solver.dll is required.

Expand Down
55 changes: 39 additions & 16 deletions ortools/linear_solver/unittests/xpress_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ namespace operations_research {
return value;
}

int getInteger64Control(int control) {
XPRSint64 value;
EXPECT_STATUS(XPRSgetintcontrol64(prob(), control, &value));
return value;
}

private:
MPSolver* solver_;

Expand Down Expand Up @@ -659,6 +665,9 @@ ENDATA

TEST(XpressInterface, setDoubleControls) {
std::vector<std::tuple<std::string, int, double>> params = {
{"MAXCUTTIME", XPRS_MAXCUTTIME, 1.},
{"MAXSTALLTIME", XPRS_MAXSTALLTIME, 1.},
{"TUNERMAXTIME", XPRS_TUNERMAXTIME, 1.},
{"MATRIXTOL", XPRS_MATRIXTOL, 1.},
{"PIVOTTOL", XPRS_PIVOTTOL, 1.},
{"FEASTOL", XPRS_FEASTOL, 1.},
Expand Down Expand Up @@ -689,14 +698,14 @@ ENDATA
{"BARPRIMALSTOP", XPRS_BARPRIMALSTOP, 1.},
{"BARSTEPSTOP", XPRS_BARSTEPSTOP, 1.},
{"ELIMTOL", XPRS_ELIMTOL, 1.},
{"PERTURB", XPRS_PERTURB, 1.},
{"MARKOWITZTOL", XPRS_MARKOWITZTOL, 1.},
{"MIPABSGAPNOTIFY", XPRS_MIPABSGAPNOTIFY, 1.},
{"MIPRELGAPNOTIFY", XPRS_MIPRELGAPNOTIFY, 1.},
{"BARLARGEBOUND", XPRS_BARLARGEBOUND, 1.},
{"PPFACTOR", XPRS_PPFACTOR, 1.},
{"REPAIRINDEFINITEQMAX", XPRS_REPAIRINDEFINITEQMAX, 1.},
{"BARGAPTARGET", XPRS_BARGAPTARGET, 1.},
{"DUMMYCONTROL", XPRS_DUMMYCONTROL, 1.},
{"BARSTARTWEIGHT", XPRS_BARSTARTWEIGHT, 1.},
{"BARFREESCALE", XPRS_BARFREESCALE, 1.},
{"SBEFFORT", XPRS_SBEFFORT, 1.},
Expand All @@ -706,7 +715,6 @@ ENDATA
{"EIGENVALUETOL", XPRS_EIGENVALUETOL, 1.},
{"INDLINBIGM", XPRS_INDLINBIGM, 1.},
{"TREEMEMORYSAVINGTARGET", XPRS_TREEMEMORYSAVINGTARGET, 1.},
{"GLOBALFILEBIAS", XPRS_GLOBALFILEBIAS, 1.},
{"INDPRELINBIGM", XPRS_INDPRELINBIGM, 1.},
{"RELAXTREEMEMORYLIMIT", XPRS_RELAXTREEMEMORYLIMIT, 1.},
{"MIPABSGAPNOTIFYOBJ", XPRS_MIPABSGAPNOTIFYOBJ, 1.},
Expand All @@ -731,6 +739,11 @@ ENDATA
{"INPUTTOL", XPRS_INPUTTOL, 1.},
{"MIPRESTARTFACTOR", XPRS_MIPRESTARTFACTOR, 1.},
{"BAROBJPERTURB", XPRS_BAROBJPERTURB, 1.},
{"CPIALPHA", XPRS_CPIALPHA, 1.},
{"GLOBALBOUNDINGBOX", XPRS_GLOBALBOUNDINGBOX, 1.},
{"TIMELIMIT", XPRS_TIMELIMIT, 1.},
{"SOLTIMELIMIT", XPRS_SOLTIMELIMIT, 1.},
{"REPAIRINFEASTIMELIMIT", XPRS_REPAIRINFEASTIMELIMIT, 1.},
};
for (const auto& [paramString, control, paramValue] : params) {
UNITTEST_INIT_MIP();
Expand Down Expand Up @@ -771,7 +784,6 @@ ENDATA
{"BARITERLIMIT", XPRS_BARITERLIMIT, 1},
{"CHOLESKYALG", XPRS_CHOLESKYALG, 1},
{"BAROUTPUT", XPRS_BAROUTPUT, 1},
{"CSTYLE", XPRS_CSTYLE, 1},
{"EXTRAMIPENTS", XPRS_EXTRAMIPENTS, 1},
{"REFACTOR", XPRS_REFACTOR, 1},
{"BARTHREADS", XPRS_BARTHREADS, 1},
Expand Down Expand Up @@ -805,7 +817,6 @@ ENDATA
{"SYMSELECT", XPRS_SYMSELECT, 1},
{"SYMMETRY", XPRS_SYMMETRY, 1},
{"MAXMEMORYHARD", XPRS_MAXMEMORYHARD, 1},
{"LPTHREADS", XPRS_LPTHREADS, 1},
{"MIQCPALG", XPRS_MIQCPALG, 1},
{"QCCUTS", XPRS_QCCUTS, 1},
{"QCROOTALG", XPRS_QCROOTALG, 1},
Expand All @@ -828,10 +839,7 @@ ENDATA
{"DUALGRADIENT", XPRS_DUALGRADIENT, 1},
{"SBITERLIMIT", XPRS_SBITERLIMIT, 1},
{"SBBEST", XPRS_SBBEST, 1},
{"MAXCUTTIME", XPRS_MAXCUTTIME, 1},
{"ACTIVESET", XPRS_ACTIVESET, 1},
{"BARINDEFLIMIT", XPRS_BARINDEFLIMIT, 1},
{"HEURSTRATEGY", XPRS_HEURSTRATEGY, 1},
{"HEURFREQ", XPRS_HEURFREQ, 1},
{"HEURDEPTH", XPRS_HEURDEPTH, 1},
{"HEURMAXSOL", XPRS_HEURMAXSOL, 1},
Expand Down Expand Up @@ -863,7 +871,6 @@ ENDATA
{"MAXCHECKSONMAXCUTTIME", XPRS_MAXCHECKSONMAXCUTTIME, 1},
{"HISTORYCOSTS", XPRS_HISTORYCOSTS, 1},
{"ALGAFTERCROSSOVER", XPRS_ALGAFTERCROSSOVER, 1},
{"LINELENGTH", XPRS_LINELENGTH, 1},
{"MUTEXCALLBACKS", XPRS_MUTEXCALLBACKS, 1},
{"BARCRASH", XPRS_BARCRASH, 1},
{"HEURDIVESOFTROUNDING", XPRS_HEURDIVESOFTROUNDING, 1},
Expand All @@ -873,14 +880,13 @@ ENDATA
{"ROOTPRESOLVE", XPRS_ROOTPRESOLVE, 1},
{"CROSSOVERDRP", XPRS_CROSSOVERDRP, 1},
{"FORCEOUTPUT", XPRS_FORCEOUTPUT, 1},
{"PRIMALOPS", XPRS_PRIMALOPS, 1},
{"DETERMINISTIC", XPRS_DETERMINISTIC, 1},
{"PREPROBING", XPRS_PREPROBING, 1},
{"EXTRAQCELEMENTS", XPRS_EXTRAQCELEMENTS, 1},
{"EXTRAQCROWS", XPRS_EXTRAQCROWS, 1},
{"TREEMEMORYLIMIT", XPRS_TREEMEMORYLIMIT, 1},
{"TREECOMPRESSION", XPRS_TREECOMPRESSION, 1},
{"TREEDIAGNOSTICS", XPRS_TREEDIAGNOSTICS, 1},
{"MAXGLOBALFILESIZE", XPRS_MAXGLOBALFILESIZE, 1},
{"MAXTREEFILESIZE", XPRS_MAXTREEFILESIZE, 1},
{"PRECLIQUESTRATEGY", XPRS_PRECLIQUESTRATEGY, 1},
{"REPAIRINFEASMAXTIME", XPRS_REPAIRINFEASMAXTIME, 1},
{"IFCHECKCONVEXITY", XPRS_IFCHECKCONVEXITY, 1},
Expand Down Expand Up @@ -934,18 +940,16 @@ ENDATA
{"TUNERMETHOD", XPRS_TUNERMETHOD, 1},
{"TUNERTARGET", XPRS_TUNERTARGET, 1},
{"TUNERTHREADS", XPRS_TUNERTHREADS, 1},
{"TUNERMAXTIME", XPRS_TUNERMAXTIME, 1},
{"TUNERHISTORY", XPRS_TUNERHISTORY, 1},
{"TUNERPERMUTE", XPRS_TUNERPERMUTE, 1},
{"TUNERROOTALG", XPRS_TUNERROOTALG, 1},
{"TUNERVERBOSE", XPRS_TUNERVERBOSE, 1},
{"TUNEROUTPUT", XPRS_TUNEROUTPUT, 1},
{"PREANALYTICCENTER", XPRS_PREANALYTICCENTER, 1},
{"NETCUTS", XPRS_NETCUTS, 1},
{"LPFLAGS", XPRS_LPFLAGS, 1},
{"MIPKAPPAFREQ", XPRS_MIPKAPPAFREQ, 1},
{"OBJSCALEFACTOR", XPRS_OBJSCALEFACTOR, 1},
{"GLOBALFILELOGINTERVAL", XPRS_GLOBALFILELOGINTERVAL, 1},
{"TREEFILELOGINTERVAL", XPRS_TREEFILELOGINTERVAL, 1},
{"IGNORECONTAINERCPULIMIT", XPRS_IGNORECONTAINERCPULIMIT, 1},
{"IGNORECONTAINERMEMORYLIMIT", XPRS_IGNORECONTAINERMEMORYLIMIT, 1},
{"MIPDUALREDUCTIONS", XPRS_MIPDUALREDUCTIONS, 1},
Expand All @@ -956,9 +960,9 @@ ENDATA
{"GENCONSABSTRANSFORMATION", XPRS_GENCONSABSTRANSFORMATION, 1},
{"COMPUTEJOBPRIORITY", XPRS_COMPUTEJOBPRIORITY, 1},
{"PREFOLDING", XPRS_PREFOLDING, 1},
{"COMPUTE", XPRS_COMPUTE, 0},
{"NETSTALLLIMIT", XPRS_NETSTALLLIMIT, 1},
{"SERIALIZEPREINTSOL", XPRS_SERIALIZEPREINTSOL, 1},
{"NUMERICALEMPHASIS", XPRS_NUMERICALEMPHASIS, 1},
{"PWLNONCONVEXTRANSFORMATION", XPRS_PWLNONCONVEXTRANSFORMATION, 1},
{"MIPCOMPONENTS", XPRS_MIPCOMPONENTS, 1},
{"MIPCONCURRENTNODES", XPRS_MIPCONCURRENTNODES, 1},
Expand All @@ -972,10 +976,16 @@ ENDATA
{"BARREFITER", XPRS_BARREFITER, 1},
{"COMPUTELOG", XPRS_COMPUTELOG, 1},
{"SIFTPRESOLVEOPS", XPRS_SIFTPRESOLVEOPS, 1},
{"CHECKINPUTDATA", XPRS_CHECKINPUTDATA, 1},
{"ESCAPENAMES", XPRS_ESCAPENAMES, 1},
{"IOTIMEOUT", XPRS_IOTIMEOUT, 1},
{"MAXSTALLTIME", XPRS_MAXSTALLTIME, 1},
{"AUTOCUTTING", XPRS_AUTOCUTTING, 1},
{"CALLBACKCHECKTIMEDELAY", XPRS_CALLBACKCHECKTIMEDELAY, 1},
{"MULTIOBJOPS", XPRS_MULTIOBJOPS, 1},
{"MULTIOBJLOG", XPRS_MULTIOBJLOG, 1},
{"GLOBALSPATIALBRANCHIFPREFERORIG", XPRS_GLOBALSPATIALBRANCHIFPREFERORIG, 1},
{"PRECONFIGURATION", XPRS_PRECONFIGURATION, 1},
{"FEASIBILITYJUMP", XPRS_FEASIBILITYJUMP, 1},
};
for (const auto& [paramString, control, paramValue] : params) {
UNITTEST_INIT_MIP();
Expand All @@ -985,6 +995,19 @@ ENDATA
}
}

TEST(XpressInterface, setInt64Control) {
std::vector<std::tuple<std::string, int, int>> params = {
{"EXTRAELEMS", XPRS_EXTRAELEMS, 1},
{"EXTRASETELEMS", XPRS_EXTRASETELEMS, 1},
};
for (const auto& [paramString, control, paramValue] : params) {
UNITTEST_INIT_MIP();
std::string xpressParamString = paramString + " " + std::to_string(paramValue);
solver.SetSolverSpecificParametersAsString(xpressParamString);
EXPECT_EQ(paramValue, getter.getInteger64Control(control));
}
}

TEST(XpressInterface, SolveMIP) {
UNITTEST_INIT_MIP();

Expand Down
Loading

0 comments on commit dca59f6

Please sign in to comment.