Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the Xpress interface and add dynamic loading of the Xpress library #3966

Merged
merged 204 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
b02e612
add rte_actions
sgatto Oct 17, 2023
d0397eb
remove USE_XPRESS variable
sgatto Oct 17, 2023
52ee2c9
update xpress interface with dynamic load
sgatto Oct 17, 2023
4273c9e
move google_actions
sgatto Oct 17, 2023
2374542
fix actions
sgatto Oct 17, 2023
f80dcb4
integrate sonar suggestions
pet-mit Oct 16, 2023
530d109
cleaning
sgatto Oct 17, 2023
d11d0f7
fix example xpress_use.cc
sgatto Oct 18, 2023
7e47007
minor change
sgatto Oct 18, 2023
92ea3da
remove xpress from CS and Java LinearProgramming tests
sgatto Oct 18, 2023
23bacb2
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 18, 2023
2b81142
add toto
sgatto Oct 18, 2023
be07240
add unittest
sgatto Oct 19, 2023
6ebcbaa
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 19, 2023
779d2d4
minor improvement to unittests
sgatto Oct 19, 2023
f787532
add temporary log
sgatto Oct 20, 2023
db0e870
fix XPRSinterrupt
pet-mit Oct 20, 2023
3a67a30
Merge remote-tracking branch 'origin/feature/xpress_only' into featur…
pet-mit Oct 20, 2023
e2612c7
remove temporary log
sgatto Oct 20, 2023
399afca
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 20, 2023
99f8d27
reformat
sgatto Oct 20, 2023
9e968ff
reformat
sgatto Oct 20, 2023
128aa4e
reformat
sgatto Oct 20, 2023
e9ecf26
fix
sgatto Oct 20, 2023
76834ea
isolate xpress tests
sgatto Oct 20, 2023
7204c06
add xpress tests dir
sgatto Oct 23, 2023
f551fc4
update actions
sgatto Oct 23, 2023
fa788ea
update actions to run xpress tests
sgatto Oct 23, 2023
325b8dd
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 23, 2023
dec7d58
less verbose tests
sgatto Oct 23, 2023
644d507
verbose output only for xpress tests
sgatto Oct 23, 2023
5c88a5d
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 25, 2023
62963ea
fix oracle.yml
sgatto Oct 25, 2023
01decfd
disable python callback test
sgatto Oct 25, 2023
752b021
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 25, 2023
93b1fbb
activate RTE actions only
sgatto Oct 26, 2023
e5a3319
remove call backs from java and python swig-files
sgatto Oct 26, 2023
c990d7c
licences changes
sgatto Oct 26, 2023
ec3857b
start separating windows and ubuntu workflows
sgatto Oct 26, 2023
2d4cd22
small fixes
sgatto Oct 26, 2023
5647c84
windows only
sgatto Oct 26, 2023
4577766
rename workflows
sgatto Oct 26, 2023
0c97b1f
ubuntu bug
sgatto Oct 26, 2023
3f49353
ubuntu fix
sgatto Oct 26, 2023
4c07d77
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 26, 2023
7e9b440
clean ubuntu.yml
sgatto Oct 26, 2023
fbd09ab
check linux python
sgatto Oct 26, 2023
f72d6fc
fix ubuntu
sgatto Oct 26, 2023
1e935c7
fix windows.yml
sgatto Oct 26, 2023
f2c3b71
small fixes plus ubuntu latest
sgatto Oct 26, 2023
2ed437f
-DBUILD_SAMPLES=OFF
sgatto Oct 26, 2023
2801ed9
-DBUILD_SAMPLES=OFF
sgatto Oct 26, 2023
16fd309
Merge remote-tracking branch 'origin/feature/xpress_only' into featur…
sgatto Oct 26, 2023
fe21cf9
clean actions
sgatto Oct 26, 2023
eb36a27
clean actions
sgatto Oct 26, 2023
75f71f9
clean actions 2
sgatto Oct 26, 2023
ca1c701
Merge branch 'google/main' into feature/xpress_only
sgatto Oct 26, 2023
2f1e064
add rte_actions
sgatto Oct 17, 2023
b190d1d
remove USE_XPRESS variable
sgatto Oct 17, 2023
3c4a76e
update xpress interface with dynamic load
sgatto Oct 17, 2023
74ce25e
move google_actions
sgatto Oct 17, 2023
c47674f
fix actions
sgatto Oct 17, 2023
78d042e
integrate sonar suggestions
pet-mit Oct 16, 2023
2c4f0b4
cleaning
sgatto Oct 17, 2023
53bffc4
fix XPRSinterrupt
pet-mit Oct 20, 2023
385ba69
fix example xpress_use.cc
sgatto Oct 18, 2023
98bf1bb
minor change
sgatto Oct 18, 2023
4d1fedd
remove xpress from CS and Java LinearProgramming tests
sgatto Oct 18, 2023
dcd7964
add toto
sgatto Oct 18, 2023
94f5e4c
add unittest
sgatto Oct 19, 2023
bfe0857
minor improvement to unittests
sgatto Oct 19, 2023
06f22a0
add temporary log
sgatto Oct 20, 2023
d00c351
remove temporary log
sgatto Oct 20, 2023
5a29544
reformat
sgatto Oct 20, 2023
2e184aa
reformat
sgatto Oct 20, 2023
ea54eb3
reformat
sgatto Oct 20, 2023
c376b4b
fix
sgatto Oct 20, 2023
53f1aa0
isolate xpress tests
sgatto Oct 20, 2023
f189b4e
add xpress tests dir
sgatto Oct 23, 2023
8a21d11
update actions
sgatto Oct 23, 2023
81f6387
update actions to run xpress tests
sgatto Oct 23, 2023
28898c6
less verbose tests
sgatto Oct 23, 2023
d83dc23
verbose output only for xpress tests
sgatto Oct 23, 2023
be5a7de
fix oracle.yml
sgatto Oct 25, 2023
5b3a631
disable python callback test
sgatto Oct 25, 2023
e0d46d2
activate RTE actions only
sgatto Oct 26, 2023
ba10b5a
remove call backs from java and python swig-files
sgatto Oct 26, 2023
8a69d08
licences changes
sgatto Oct 26, 2023
76b0b6b
start separating windows and ubuntu workflows
sgatto Oct 26, 2023
095dfd2
small fixes
sgatto Oct 26, 2023
3224ded
windows only
sgatto Oct 26, 2023
1a711d8
rename workflows
sgatto Oct 26, 2023
1485b1c
ubuntu bug
sgatto Oct 26, 2023
8b6649a
ubuntu fix
sgatto Oct 26, 2023
8a91250
clean ubuntu.yml
sgatto Oct 26, 2023
cad5f37
check linux python
sgatto Oct 26, 2023
9ec6273
fix ubuntu
sgatto Oct 26, 2023
f265bd2
fix windows.yml
sgatto Oct 26, 2023
4323b4d
small fixes plus ubuntu latest
sgatto Oct 26, 2023
8597bc2
-DBUILD_SAMPLES=OFF
sgatto Oct 26, 2023
cbde8ff
clean actions
sgatto Oct 26, 2023
dac651c
clean actions
sgatto Oct 26, 2023
c994e9d
clean actions 2
sgatto Oct 26, 2023
6070786
Merge remote-tracking branch 'origin/feature/xpress_only' into featur…
sgatto Oct 27, 2023
fe829fc
rename xpress test
sgatto Oct 27, 2023
4243b61
revert actions like google main
sgatto Oct 27, 2023
b4ead5a
remove setup-env action.yml
sgatto Oct 27, 2023
a4a4ac9
fix test_xpress_interface.cc
sgatto Oct 27, 2023
585f47f
chose cmake generator for windows.yml
sgatto Oct 27, 2023
513cb46
fix ubuntu.yml
sgatto Oct 27, 2023
2db65fb
only ubuntu 22.04
sgatto Oct 27, 2023
8e54cb0
revert writing colnames and rownames
sgatto Oct 27, 2023
8eec3ae
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Oct 27, 2023
d3bc4e8
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Oct 27, 2023
b0d3fdf
activate 1 google action
sgatto Oct 27, 2023
4d99c55
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Oct 27, 2023
54eec80
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Oct 27, 2023
58aad45
activate 4 google action for Windows Cmake
sgatto Oct 27, 2023
68cb4e0
test
sgatto Oct 27, 2023
b111171
test ls xpress
sgatto Oct 28, 2023
baa9985
test ls xpress
sgatto Oct 28, 2023
9e6c432
test xpress window cp
sgatto Oct 28, 2023
29517a0
test xpress window cp
sgatto Oct 28, 2023
881663e
echo $XPRESS_DIR
sgatto Oct 28, 2023
10b10a9
change order
sgatto Oct 28, 2023
94854b6
disable google ci actions
sgatto Oct 28, 2023
4a7223e
fix check xpress installation
sgatto Oct 28, 2023
571cb94
fix check xpress installation
sgatto Oct 28, 2023
62f54a2
fix check xpress installation
sgatto Oct 28, 2023
1a364b5
turn xpress off for windows
sgatto Oct 29, 2023
094717b
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Oct 30, 2023
78d8ddd
separate python and cpp CI actions
sgatto Oct 30, 2023
66da48a
fix names
sgatto Oct 30, 2023
01d3539
Update windows-java-dotnet.yml
sgatto Oct 30, 2023
19fb897
Update windows-python.yml
sgatto Oct 30, 2023
652adcf
Update windows-cpp.yml
sgatto Oct 30, 2023
2c71b54
Merge remote-tracking branch 'origin/feature/xpress_only_RTE' into fe…
sgatto Oct 30, 2023
ee08b45
fix python version windows-python.yml
sgatto Oct 30, 2023
037e61d
Update windows-python.yml
sgatto Oct 30, 2023
c79cef5
try use 4 cpu for windows build
sgatto Oct 30, 2023
78ecf34
try different pip install xpress
sgatto Oct 30, 2023
2d4b657
change order of zip installation
sgatto Oct 30, 2023
bf0c843
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Oct 30, 2023
528ec99
revert to LoadLibrary instead of LoadLibraryA
sgatto Oct 30, 2023
11edd4c
reduce parallel jobs to 2
sgatto Oct 30, 2023
1f70643
Check xpress installation 2
sgatto Oct 30, 2023
f79c251
revert to LoadLibraryA
sgatto Oct 30, 2023
2786b71
check xpress installation
sgatto Oct 30, 2023
5ae372e
try to debug
sgatto Oct 31, 2023
244c12c
try to use old style variables
sgatto Oct 31, 2023
5b70c97
try to fix old style variables
sgatto Oct 31, 2023
fce8fb2
revert to new style variables
sgatto Oct 31, 2023
7051554
clone xpress instead of using pip
sgatto Oct 31, 2023
e4e5a82
naif test
sgatto Nov 1, 2023
887cdc2
naif test
sgatto Nov 1, 2023
ab648f1
naif test
sgatto Nov 1, 2023
4ff94bf
try to fix windows paths
sgatto Nov 2, 2023
4f0f40a
try single backslash
sgatto Nov 2, 2023
d607131
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 6, 2023
518faad
pip install xpress 9.0.x
sgatto Nov 6, 2023
3232f7a
naif test
sgatto Nov 6, 2023
db75c07
clean
sgatto Nov 6, 2023
3133020
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 6, 2023
3ebd604
small fix
sgatto Nov 6, 2023
2637c36
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 6, 2023
2b8e8ea
accept suggestion by Mizux
sgatto Nov 6, 2023
6961796
try add XPRESS to path
sgatto Nov 7, 2023
546e0f5
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 7, 2023
90cd316
try use pip for windows-cpp
sgatto Nov 7, 2023
4697b33
try use pip for windows-java and python
sgatto Nov 7, 2023
f48946d
try increase timeout for xpress SetHint test
sgatto Nov 7, 2023
3c53b49
ignore a test if using Windows
sgatto Nov 7, 2023
7161d7a
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 7, 2023
f22e9c4
clean
sgatto Nov 7, 2023
6d2a0e3
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 9, 2023
73a0132
change cmake/README.md
sgatto Nov 9, 2023
59d19b5
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 9, 2023
496fc44
try fix build bazel
sgatto Nov 10, 2023
04f80d0
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 10, 2023
c600ddd
try fix build bazel add MPSWriteError.h
sgatto Nov 10, 2023
4627ddf
xpress tests gracefully exit if Xpress not found
sgatto Nov 13, 2023
18468fe
add integer and linear programming test for dotnet python and java
sgatto Nov 13, 2023
2c61b20
remove MPSWriteError
sgatto Nov 13, 2023
e48384c
try fix Window build
sgatto Nov 13, 2023
a9a4f32
first step
sgatto Nov 14, 2023
468c8ef
remove useless line from CMakeLists.txt
sgatto Nov 14, 2023
000a2e0
Merge branch 'feature/xpress_only_RTE' into feature/chantge_SetStarti…
sgatto Nov 14, 2023
fd1de93
first step SetStartingLpBasisInt and GetFinalLpBasisInt
sgatto Nov 14, 2023
b7e2ad2
fix wrong push
sgatto Nov 14, 2023
5b53bbf
improve code
sgatto Nov 14, 2023
fa2475f
Merge branch 'google/main' into feature/change_SetStartingLpBasis
sgatto Nov 14, 2023
7ea0e72
Merge branch 'google/main' into feature/xpress_only_RTE
sgatto Nov 14, 2023
d75106a
try fix test under windows
sgatto Nov 15, 2023
6fabeec
Merge branch 'feature/xpress_only_RTE' into feature/change_SetStartin…
sgatto Nov 15, 2023
474ece4
fix error
sgatto Nov 15, 2023
8475339
accept suggestions from flomnes
sgatto Nov 16, 2023
0a08de7
use XPRSmipoptimize and XPRSlpoptimize instead of XPRSminim and XPRSm…
sgatto Nov 16, 2023
46379e6
Merge branch 'feature/xpress_only_RTE' into feature/change_SetStartin…
sgatto Nov 16, 2023
e179c8b
Feature/xpress only (#115)
flomnes Nov 20, 2023
2f543db
Merge remote-tracking branch 'google/main' into feature/temporary-for…
flomnes Nov 20, 2023
696317a
hard crash if one Xpress function not found (#116)
sgatto Nov 21, 2023
2ff8f3b
log exception instead of throwing them
sgatto Nov 22, 2023
19bf3d3
MPSolverToXpressBasisStatus should consider 5 enum values
sgatto Nov 22, 2023
890757b
accept suggestion by @flomnes
sgatto Dec 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ option(USE_CPLEX "Use the CPLEX solver" OFF)
message(STATUS "CPLEX support: ${USE_CPLEX}")

## XPRESS
option(USE_XPRESS "Use the XPRESS solver" OFF)
message(STATUS "XPRESS support: ${USE_XPRESS}")
# Since it is dynamicaly loaded upon use, OFF is currently not supported.
CMAKE_DEPENDENT_OPTION(USE_XPRESS "Use the Xpress solver" ON "BUILD_CXX" OFF)

# Language specific options
if(BUILD_CXX)
Expand Down
88 changes: 0 additions & 88 deletions cmake/FindXPRESS.cmake

This file was deleted.

13 changes: 1 addition & 12 deletions cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Here the list of supported solvers:
* HiGHS\*
* PDLP
* SCIP
* XPRESS\*
* XPRESS

\*: these solvers are disabled by default.

Expand Down Expand Up @@ -127,7 +127,6 @@ support for the following third-party solvers:
note: You must enable the support of GLPK solver by using `-DUSE_GLPK=ON`
(`OFF` by default).
* CPLEX (`USE_CPLEX`),
* XPRESS (`USE_XPRESS`)

**warning: Since these solvers are either proprietary (and require a specific
license) or available under the GPL, we can't test them on public CI and their
Expand All @@ -145,14 +144,6 @@ For ease of migration from legacy `make third_party` builds, CMake will also
read the CPLEX installation path from the `UNIX_CPLEX_DIR` environment variable,
if defined.

### Enabling XPRESS Support

To enable XPRESS support, configure with `-DUSE_XPRESS=ON` and
`-DXPRESS_ROOT=/absolute/path/to/XPRESS/root/dir`, replacing
`/absolute/path/to/XPRESS/root/dir` with the path to your XPRESS installation.
`XPRESS_ROOT` can also be defined as an environment variable rather than an
option at configure time.

## CMake Options

There are several options that can be passed to CMake to modify how the code
Expand Down Expand Up @@ -217,8 +208,6 @@ cmake -S. -Bbuild -LH
| | | |
| `USE_CPLEX` | OFF | Enable CPLEX support |
| | | |
| `USE_XPRESS` | OFF | Enable XPRESS support |
| | | |
| `BUILD_DOC` | OFF\* | Build all documentations |
| `BUILD_CXX_DOC` | OFF\* | Build C++ documentation<br>**Forced** to ON if `BUILD_DOC=ON` |
| `BUILD_DOTNET_DOC` | OFF\* | Build .Net documentation<br>**Forced** to ON if `BUILD_DOC=ON` |
Expand Down
12 changes: 2 additions & 10 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ endif()
if(USE_CPLEX)
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_CPLEX")
endif()
if(USE_XPRESS)
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_XPRESS")
if(MSVC)
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "XPRESS_PATH=\"${XPRESS_ROOT}\"")
else()
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "XPRESS_PATH=${XPRESS_ROOT}")
endif()
endif()

if(WIN32)
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "__WIN32__")
Expand Down Expand Up @@ -326,7 +318,8 @@ foreach(SUBPROJECT IN ITEMS
port
sat
scheduling
util)
util
xpress)
add_subdirectory(ortools/${SUBPROJECT})
#target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_${SUBPROJECT})
target_sources(${PROJECT_NAME} PRIVATE $<TARGET_OBJECTS:${PROJECT_NAME}_${SUBPROJECT}>)
Expand Down Expand Up @@ -364,7 +357,6 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
$<$<BOOL:${USE_HIGHS}>:HIGHS::HIGHS>
${PDLP_DEPS}
$<$<BOOL:${USE_SCIP}>:libscip>
$<$<BOOL:${USE_XPRESS}>:XPRESS::XPRESS>
Threads::Threads)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC psapi.lib ws2_32.lib)
Expand Down
4 changes: 0 additions & 4 deletions cmake/deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ if(USE_CPLEX)
find_package(CPLEX REQUIRED)
endif()

if(USE_XPRESS)
find_package(XPRESS REQUIRED)
endif()

# Check language Dependencies
if(BUILD_PYTHON)
if(NOT BUILD_pybind11)
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/integer_programming.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void RunAllExamples() {
RunIntegerProgrammingExample("GUROBI");
RunIntegerProgrammingExample("GLPK");
RunIntegerProgrammingExample("CPLEX");
RunIntegerProgrammingExample("XPRESS");
}
} // namespace operations_research

Expand Down
104 changes: 104 additions & 0 deletions examples/cpp/xpress_use.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Copyright Artelys for RTE.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This example that shows how to use Xpress Solver.

#include <cstdlib>

#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/logging.h"
#include "ortools/linear_solver/linear_solver.h"

using namespace operations_research;

/**
* This method shows two ways to initialize a Xpress solver instance.
* Two environment variables are used to specify the Xpress installation paths:
* * XPRESSDIR : Path to the Xpress root directory (containing bin and lib folders)
* * XPRESS : Path to the directory containing Xpress license
*/
void useXpressSolver(bool solveAsMip, bool useFactory) {
std::unique_ptr<MPSolver> solver = nullptr;
if (useFactory) {
/* This is the preferred way as the program won't stop if anything went
wrong. In such a case, `solver` will take value `nullptr` */
std::string xpressName = (solveAsMip ? "XPRESS" : "XPRESS_LP");
solver.reset(MPSolver::CreateSolver(xpressName));
} else {
MPSolver::OptimizationProblemType problemType = (solveAsMip ?
MPSolver::XPRESS_MIXED_INTEGER_PROGRAMMING
: MPSolver::XPRESS_LINEAR_PROGRAMMING);
/* MPSolver::SupportsProblemType(problem_type) will test if Xpress is
correctly loaded and has a valid license. This check is important to keep
the program running if Xpress is not correctly installed. With the
constructor usage, if Xpress is badly loaded or if there is a problem
with the license, the program will abort (SIGABRT)
*/
if (MPSolver::SupportsProblemType(problemType)) {
solver.reset(new MPSolver("IntegerProgrammingExample", problemType));
}
}
if (solver == nullptr) {
LOG(WARNING) << "Xpress solver is not available";
return;
}
// Use the solver
/*
max -100 x1 + 10 x2
s.t. x2 <= 20 x1;
30 x1 + 3.5 x2 <= 350
0 <= x1 <= 5
0 <= x2
*/
const double infinity = MPSolver::infinity();
const MPVariable* x1 = solver->MakeIntVar(0, 5, "x1");
const MPVariable* x2 = solver->MakeNumVar(0.0, infinity, "x2");

MPObjective* const objective = solver->MutableObjective();
objective->SetCoefficient(x1, -100);
objective->SetCoefficient(x2, 10);
objective->SetMaximization();

MPConstraint* const c0 = solver->MakeRowConstraint(-infinity, 0.0);
c0->SetCoefficient(x1, -20.0);
c0->SetCoefficient(x2, 1);

MPConstraint* const c1 = solver->MakeRowConstraint(-infinity, 350.0);
c1->SetCoefficient(x1, 30.0);
c1->SetCoefficient(x2, 3.5);


const MPSolver::ResultStatus result_status = solver->Solve();

// Check that the problem has an optimal solution.
if (result_status != MPSolver::OPTIMAL) {
LOG(FATAL) << "Solver returned with non-optimal status.";
} else {
LOG(WARNING) << "Optimal solution found: obj=" << objective->Value();
}
}
#define ABSL_MIN_LOG_LEVEL INFO;
int main(int argc, char** argv) {
absl::SetFlag(&FLAGS_stderrthreshold, 0);
absl::SetFlag(&FLAGS_logtostderr, true);
InitGoogle(argv[0], &argc, &argv, true);
std::cout << "start\n";
LOG(WARNING) << "start";
for (bool solveAsMip: {true, false}) {
for (bool useFactory: {true, false}) {
useXpressSolver(solveAsMip, useFactory);
}
}
return EXIT_SUCCESS;
}
4 changes: 4 additions & 0 deletions examples/dotnet/csintegerprogramming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ static void Main()
RunIntegerProgrammingExample("SAT");
Console.WriteLine("---- Linear programming example with GUROBI ----");
RunIntegerProgrammingExample("GUROBI");
Console.WriteLine("---- Linear programming example with XPRESS ----");
RunIntegerProgrammingExample("XPRESS");
Console.WriteLine("---- Integer programming example (Natural API) with GLPK ----");
RunIntegerProgrammingExampleNaturalApi("GLPK");
Console.WriteLine("---- Linear programming example (Natural API) with CBC ----");
Expand All @@ -127,5 +129,7 @@ static void Main()
RunIntegerProgrammingExampleNaturalApi("SAT");
Console.WriteLine("---- Linear programming example (Natural API) with GUROBI ----");
RunIntegerProgrammingExampleNaturalApi("GUROBI");
Console.WriteLine("---- Linear programming example (Natural API) with XPRESS ----");
RunIntegerProgrammingExampleNaturalApi("XPRESS");
}
}
1 change: 1 addition & 0 deletions examples/dotnet/cslinearprogramming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static void Main()
RunLinearProgrammingExample("GLOP");
RunLinearProgrammingExample("GLPK_LP");
RunLinearProgrammingExample("CLP");
RunLinearProgrammingExample("XPRESS_LP");

RunLinearProgrammingExampleNaturalApi("GLOP", true);
RunLinearProgrammingExampleNaturalApi("GLPK_LP", false);
Expand Down
2 changes: 2 additions & 0 deletions examples/java/IntegerProgramming.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,7 @@ public static void main(String[] args) throws Exception {
runIntegerProgrammingExample("GLPK");
System.out.println("---- Integer programming example with CP-SAT ----");
runIntegerProgrammingExample("SAT");
System.out.println("---- Integer programming example with XPRESS ----");
runIntegerProgrammingExample("XPRESS");
}
}
2 changes: 2 additions & 0 deletions examples/java/LinearProgramming.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,7 @@ public static void main(String[] args) throws Exception {
runLinearProgrammingExample("GLOP", true);
System.out.println("---- Linear programming example with CLP ----");
runLinearProgrammingExample("CLP", false);
System.out.println("---- Linear programming example with XPRESS ----");
runLinearProgrammingExample("XPRESS_LP", false);
}
}
2 changes: 2 additions & 0 deletions examples/python/integer_programming.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def RunAllIntegerExampleNaturalLanguageAPI():
# RunIntegerExampleNaturalLanguageAPI('CBC')
RunIntegerExampleNaturalLanguageAPI("SCIP")
RunIntegerExampleNaturalLanguageAPI("SAT")
RunIntegerExampleNaturalLanguageAPI("XPRESS")


def RunAllIntegerExampleCppStyleAPI():
Expand All @@ -110,6 +111,7 @@ def RunAllIntegerExampleCppStyleAPI():
# RunIntegerExampleCppStyleAPI('CBC')
RunIntegerExampleCppStyleAPI("SCIP")
RunIntegerExampleCppStyleAPI("SAT")
RunIntegerExampleCppStyleAPI("XPRESS")


def main():
Expand Down
2 changes: 2 additions & 0 deletions examples/python/linear_programming.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ def main():
RunLinearExampleNaturalLanguageAPI("GLPK_LP")
RunLinearExampleNaturalLanguageAPI("CLP")
RunLinearExampleNaturalLanguageAPI("PDLP")
RunLinearExampleNaturalLanguageAPI("XPRESS_LP")

RunLinearExampleCppStyleAPI("GLOP")
RunLinearExampleCppStyleAPI("GLPK_LP")
RunLinearExampleCppStyleAPI("CLP")
RunLinearExampleCppStyleAPI("PDLP")
RunLinearExampleCppStyleAPI("XPRESS_LP")


if __name__ == "__main__":
Expand Down
3 changes: 0 additions & 3 deletions makefiles/Makefile.cpp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ USE_HIGHS ?= OFF
USE_PDLP := ON # OFF not supported
USE_SCIP ?= ON
USE_CPLEX ?= OFF
USE_XPRESS ?= OFF

USE_DOTNET_CORE_31 ?= OFF
USE_DOTNET_6 ?= ON
Expand Down Expand Up @@ -72,7 +71,6 @@ third_party:
-DUSE_PDLP=$(USE_PDLP) \
-DUSE_SCIP=$(USE_SCIP) \
-DUSE_CPLEX=$(USE_CPLEX) \
-DUSE_XPRESS=$(USE_XPRESS) \
-DUSE_DOTNET_CORE_31=$(USE_DOTNET_CORE_31) \
-DUSE_DOTNET_6=$(USE_DOTNET_6) \
-DBUILD_VENV=$(BUILD_VENV) \
Expand Down Expand Up @@ -665,7 +663,6 @@ detect_cpp:
@echo USE_SCIP = $(USE_SCIP)
@echo USE_GLPK = $(USE_GLPK)
@echo USE_CPLEX = $(USE_CPLEX)
@echo USE_XPRESS = $(USE_XPRESS)
ifdef GLPK_ROOT
@echo GLPK_ROOT = $(GLPK_ROOT)
endif
Expand Down
Loading
Loading