Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
environment.cc
Go to the documentation of this file.
1// Copyright 2019-2023 RTE
2// Copyright 2010-2025 Google LLC
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Initial version of this code was provided by RTE
16
18
19#include <cstdlib>
20// NOLINTNEXTLINE(build/c++17)
21#include <filesystem>
22#include <functional>
23#include <string>
24#include <vector>
25
26#include "absl/base/call_once.h"
27#include "absl/base/const_init.h"
28#include "absl/status/status.h"
29#include "absl/strings/str_cat.h"
30#include "absl/strings/str_join.h"
31#include "absl/synchronization/mutex.h"
34
35namespace operations_research {
36
37#define STRINGIFY2(X) #X
38#define STRINGIFY(X) STRINGIFY2(X)
39
40// Let's not reformat for rest of the file.
41// This was generated with the parse_header_xpress.py script.
42// See the comment at the top of the script.
43
44// This is the 'define' section.
45// NOLINTBEGIN(whitespace/line_length)
46// NOLINTBEGIN(google3-runtime-global-variables)
47// clang-format off
48std::function<int(XPRSprob* p_prob)> XPRScreateprob = nullptr;
49std::function<int(XPRSprob prob)> XPRSdestroyprob = nullptr;
50std::function<int(const char* path)> XPRSinit = nullptr;
51std::function<int(void)> XPRSfree = nullptr;
52std::function<int(char* buffer, int maxbytes)> XPRSgetlicerrmsg = nullptr;
53std::function<int(int* p_i, char* p_c)> XPRSlicense = nullptr;
54std::function<int(char* banner)> XPRSgetbanner = nullptr;
55std::function<int(char* version)> XPRSgetversion = nullptr;
56std::function<int(XPRSprob prob, const char* probname)> XPRSsetprobname = nullptr;
57std::function<int(XPRSprob prob, int control)> XPRSsetdefaultcontrol = nullptr;
58std::function<int(XPRSprob prob, int reason)> XPRSinterrupt = nullptr;
59std::function<int(XPRSprob prob, int control, int value)> XPRSsetintcontrol = nullptr;
60std::function<int(XPRSprob prob, int control, XPRSint64 value)> XPRSsetintcontrol64 = nullptr;
61std::function<int(XPRSprob prob, int control, double value)> XPRSsetdblcontrol = nullptr;
62std::function<int(XPRSprob prob, int control, const char* value)> XPRSsetstrcontrol = nullptr;
63std::function<int(XPRSprob prob, int control, int* p_value)> XPRSgetintcontrol = nullptr;
64std::function<int(XPRSprob prob, int control, XPRSint64* p_value)> XPRSgetintcontrol64 = nullptr;
65std::function<int(XPRSprob prob, int control, double* p_value)> XPRSgetdblcontrol = nullptr;
66std::function<int(XPRSprob prob, int control, char* value, int maxbytes, int* p_nbytes)> XPRSgetstringcontrol = nullptr;
67std::function<int(XPRSprob prob, int attrib, int* p_value)> XPRSgetintattrib = nullptr;
68std::function<int(XPRSprob prob, int attrib, char* value, int maxbytes, int* p_nbytes)> XPRSgetstringattrib = nullptr;
69std::function<int(XPRSprob prob, int attrib, double* p_value)> XPRSgetdblattrib = nullptr;
70std::function<int(XPRSprob prob, const char* name, int* p_id, int* p_type)> XPRSgetcontrolinfo = nullptr;
71std::function<int(XPRSprob prob, double objcoef[], int first, int last)> XPRSgetobj = nullptr;
72std::function<int(XPRSprob prob, double rhs[], int first, int last)> XPRSgetrhs = nullptr;
73std::function<int(XPRSprob prob, double rng[], int first, int last)> XPRSgetrhsrange = nullptr;
74std::function<int(XPRSprob prob, double lb[], int first, int last)> XPRSgetlb = nullptr;
75std::function<int(XPRSprob prob, double ub[], int first, int last)> XPRSgetub = nullptr;
76std::function<int(XPRSprob prob, int row, int col, double* p_coef)> XPRSgetcoef = nullptr;
77std::function<int(XPRSprob prob, int* status, double duals[], int first, int last)> XPRSgetduals = nullptr;
78std::function<int(XPRSprob prob, int* status, double djs[], int first, int last)> XPRSgetredcosts = nullptr;
79std::function<int(XPRSprob prob, int nrows, int ncoefs, const char rowtype[], const double rhs[], const double rng[], const int start[], const int colind[], const double rowcoef[])> XPRSaddrows = nullptr;
80std::function<int(XPRSprob prob, int nrows, const int rowind[])> XPRSdelrows = nullptr;
81std::function<int(XPRSprob prob, int ncols, int ncoefs, const double objcoef[], const int start[], const int rowind[], const double rowcoef[], const double lb[], const double ub[])> XPRSaddcols = nullptr;
82std::function<int(XPRSprob prob, int type, const char names[], int first, int last)> XPRSaddnames = nullptr;
83std::function<int(XPRSprob prob, int type, char names[], int first, int last)> XPRSgetnames = nullptr;
84std::function<int(XPRSprob prob, int ncols, const int colind[])> XPRSdelcols = nullptr;
85std::function<int(XPRSprob prob, int ncols, const int colind[], const char coltype[])> XPRSchgcoltype = nullptr;
86std::function<int(XPRSprob prob, const int rowstat[], const int colstat[])> XPRSloadbasis = nullptr;
87std::function<int(XPRSprob prob)> XPRSpostsolve = nullptr;
88std::function<int(XPRSprob prob, int objsense)> XPRSchgobjsense = nullptr;
89std::function<int(XPRSprob prob, char* errmsg)> XPRSgetlasterror = nullptr;
90std::function<int(XPRSprob prob, int rowstat[], int colstat[])> XPRSgetbasis = nullptr;
91std::function<int(XPRSprob prob, const char* filename, const char* flags)> XPRSwriteprob = nullptr;
92std::function<int(XPRSprob prob, char rowtype[], int first, int last)> XPRSgetrowtype = nullptr;
93std::function<int(XPRSprob prob, char coltype[], int first, int last)> XPRSgetcoltype = nullptr;
94std::function<int(XPRSprob prob, int nbounds, const int colind[], const char bndtype[], const double bndval[])> XPRSchgbounds = nullptr;
95std::function<int(XPRSprob prob, int length, const double solval[], const int colind[], const char* name)> XPRSaddmipsol = nullptr;
96std::function<int(XPRSprob prob, double x[], double slack[], double duals[], double djs[])> XPRSgetlpsol = nullptr;
97std::function<int(XPRSprob prob, double x[], double slack[])> XPRSgetmipsol = nullptr;
98std::function<int(XPRSprob prob, int ncols, const int colind[], const double objcoef[])> XPRSchgobj = nullptr;
99std::function<int(XPRSprob prob, int row, int col, double coef)> XPRSchgcoef = nullptr;
100std::function<int(XPRSprob prob, int ncoefs, const int rowind[], const int colind[], const double rowcoef[])> XPRSchgmcoef = nullptr;
101std::function<int(XPRSprob prob, XPRSint64 ncoefs, const int rowind[], const int colind[], const double rowcoef[])> XPRSchgmcoef64 = nullptr;
102std::function<int(XPRSprob prob, int ncoefs, const int objqcol1[], const int objqcol2[], const double objqcoef[])> XPRSchgmqobj = nullptr;
103std::function<int(XPRSprob prob, int nrows, const int rowind[], const double rhs[])> XPRSchgrhs = nullptr;
104std::function<int(XPRSprob prob, int nrows, const int rowind[], const double rng[])> XPRSchgrhsrange = nullptr;
105std::function<int(XPRSprob prob, int nrows, const int rowind[], const char rowtype[])> XPRSchgrowtype = nullptr;
106std::function<int(XPRSprob prob, int objidx)> XPRSdelobj = nullptr;
107std::function<int(XPRSprob prob, void (XPRS_CC *f_intsol)(XPRSprob cbprob, void* cbdata), void* p, int priority)> XPRSaddcbintsol = nullptr;
108std::function<int(XPRSprob prob, void (XPRS_CC *f_intsol)(XPRSprob cbprob, void* cbdata), void* p)> XPRSremovecbintsol = nullptr;
109std::function<int(XPRSprob prob, void (XPRS_CC *f_message)(XPRSprob cbprob, void* cbdata, const char* msg, int msglen, int msgtype), void* p, int priority)> XPRSaddcbmessage = nullptr;
110std::function<int(XPRSprob prob, const char* flags)> XPRSlpoptimize = nullptr;
111std::function<int(XPRSprob prob, const char* flags)> XPRSmipoptimize = nullptr;
112std::function<int(XPRSprob prob, const char* flags, int* solvestatus, int* solstatus)> XPRSoptimize = nullptr;
113// clang-format on
114// NOLINTEND(google3-runtime-global-variables)
115// NOLINTEND(whitespace/line_length)
116
117void LoadXpressFunctions(DynamicLibrary* xpress_dynamic_library) {
118 // This was generated with the parse_header_xpress.py script.
119 // See the comment at the top of the script.
120
121 // This is the 'assign' section.
122 // NOLINTBEGIN(whitespace/line_length)
123 // clang-format off
124 xpress_dynamic_library->GetFunction(&XPRScreateprob, "XPRScreateprob");
125 xpress_dynamic_library->GetFunction(&XPRSdestroyprob, "XPRSdestroyprob");
126 xpress_dynamic_library->GetFunction(&XPRSinit, "XPRSinit");
127 xpress_dynamic_library->GetFunction(&XPRSfree, "XPRSfree");
128 xpress_dynamic_library->GetFunction(&XPRSgetlicerrmsg, "XPRSgetlicerrmsg");
129 xpress_dynamic_library->GetFunction(&XPRSlicense, "XPRSlicense");
130 xpress_dynamic_library->GetFunction(&XPRSgetbanner, "XPRSgetbanner");
131 xpress_dynamic_library->GetFunction(&XPRSgetversion, "XPRSgetversion");
132 xpress_dynamic_library->GetFunction(&XPRSsetprobname, "XPRSsetprobname");
133 xpress_dynamic_library->GetFunction(&XPRSsetdefaultcontrol, "XPRSsetdefaultcontrol");
134 xpress_dynamic_library->GetFunction(&XPRSinterrupt, "XPRSinterrupt");
135 xpress_dynamic_library->GetFunction(&XPRSsetintcontrol, "XPRSsetintcontrol");
136 xpress_dynamic_library->GetFunction(&XPRSsetintcontrol64, "XPRSsetintcontrol64");
137 xpress_dynamic_library->GetFunction(&XPRSsetdblcontrol, "XPRSsetdblcontrol");
138 xpress_dynamic_library->GetFunction(&XPRSsetstrcontrol, "XPRSsetstrcontrol");
139 xpress_dynamic_library->GetFunction(&XPRSgetintcontrol, "XPRSgetintcontrol");
140 xpress_dynamic_library->GetFunction(&XPRSgetintcontrol64, "XPRSgetintcontrol64");
141 xpress_dynamic_library->GetFunction(&XPRSgetdblcontrol, "XPRSgetdblcontrol");
142 xpress_dynamic_library->GetFunction(&XPRSgetstringcontrol, "XPRSgetstringcontrol");
143 xpress_dynamic_library->GetFunction(&XPRSgetintattrib, "XPRSgetintattrib");
144 xpress_dynamic_library->GetFunction(&XPRSgetstringattrib, "XPRSgetstringattrib");
145 xpress_dynamic_library->GetFunction(&XPRSgetdblattrib, "XPRSgetdblattrib");
146 xpress_dynamic_library->GetFunction(&XPRSgetobj, "XPRSgetobj");
147 xpress_dynamic_library->GetFunction(&XPRSgetrhs, "XPRSgetrhs");
148 xpress_dynamic_library->GetFunction(&XPRSgetrhsrange, "XPRSgetrhsrange");
149 xpress_dynamic_library->GetFunction(&XPRSgetlb, "XPRSgetlb");
150 xpress_dynamic_library->GetFunction(&XPRSgetub, "XPRSgetub");
151 xpress_dynamic_library->GetFunction(&XPRSgetcoef, "XPRSgetcoef");
152 xpress_dynamic_library->GetFunction(&XPRSgetduals, "XPRSgetduals");
153 xpress_dynamic_library->GetFunction(&XPRSgetredcosts, "XPRSgetredcosts");
154 xpress_dynamic_library->GetFunction(&XPRSaddrows, "XPRSaddrows");
155 xpress_dynamic_library->GetFunction(&XPRSdelrows, "XPRSdelrows");
156 xpress_dynamic_library->GetFunction(&XPRSaddcols, "XPRSaddcols");
157 xpress_dynamic_library->GetFunction(&XPRSaddnames, "XPRSaddnames");
158 xpress_dynamic_library->GetFunction(&XPRSgetnames, "XPRSgetnames");
159 xpress_dynamic_library->GetFunction(&XPRSdelcols, "XPRSdelcols");
160 xpress_dynamic_library->GetFunction(&XPRSchgcoltype, "XPRSchgcoltype");
161 xpress_dynamic_library->GetFunction(&XPRSloadbasis, "XPRSloadbasis");
162 xpress_dynamic_library->GetFunction(&XPRSpostsolve, "XPRSpostsolve");
163 xpress_dynamic_library->GetFunction(&XPRSchgobjsense, "XPRSchgobjsense");
164 xpress_dynamic_library->GetFunction(&XPRSgetlasterror, "XPRSgetlasterror");
165 xpress_dynamic_library->GetFunction(&XPRSgetbasis, "XPRSgetbasis");
166 xpress_dynamic_library->GetFunction(&XPRSwriteprob, "XPRSwriteprob");
167 xpress_dynamic_library->GetFunction(&XPRSgetrowtype, "XPRSgetrowtype");
168 xpress_dynamic_library->GetFunction(&XPRSgetcoltype, "XPRSgetcoltype");
169 xpress_dynamic_library->GetFunction(&XPRSchgbounds, "XPRSchgbounds");
170 xpress_dynamic_library->GetFunction(&XPRSaddmipsol, "XPRSaddmipsol");
171 xpress_dynamic_library->GetFunction(&XPRSgetlpsol, "XPRSgetlpsol");
172 xpress_dynamic_library->GetFunction(&XPRSgetmipsol, "XPRSgetmipsol");
173 xpress_dynamic_library->GetFunction(&XPRSchgobj, "XPRSchgobj");
174 xpress_dynamic_library->GetFunction(&XPRSchgcoef, "XPRSchgcoef");
175 xpress_dynamic_library->GetFunction(&XPRSchgmcoef, "XPRSchgmcoef");
176 xpress_dynamic_library->GetFunction(&XPRSchgmcoef64, "XPRSchgmcoef64");
177 xpress_dynamic_library->GetFunction(&XPRSchgmqobj, "XPRSchgmqobj");
178 xpress_dynamic_library->GetFunction(&XPRSchgrhs, "XPRSchgrhs");
179 xpress_dynamic_library->GetFunction(&XPRSchgrhsrange, "XPRSchgrhsrange");
180 xpress_dynamic_library->GetFunction(&XPRSchgrowtype, "XPRSchgrowtype");
181 xpress_dynamic_library->GetFunction(&XPRSdelobj, "XPRSdelobj");
182 xpress_dynamic_library->GetFunction(&XPRSaddcbintsol, "XPRSaddcbintsol");
183 xpress_dynamic_library->GetFunction(&XPRSremovecbintsol, "XPRSremovecbintsol");
184 xpress_dynamic_library->GetFunction(&XPRSaddcbmessage, "XPRSaddcbmessage");
185 xpress_dynamic_library->GetFunction(&XPRSlpoptimize, "XPRSlpoptimize");
186 xpress_dynamic_library->GetFunction(&XPRSmipoptimize, "XPRSmipoptimize");
187 xpress_dynamic_library->GetFunction(&XPRSoptimize, "XPRSoptimize");
188 // clang-format on
189 // NOLINTEND(whitespace/line_length)
190}
191
192void printXpressBanner(bool error) {
193 char banner[XPRS_MAXBANNERLENGTH];
194 XPRSgetbanner(banner);
195
196 if (error) {
197 LOG(ERROR) << "XpressInterface : Xpress banner :\n" << banner << "\n";
198 } else {
199 LOG(WARNING) << "XpressInterface : Xpress banner :\n" << banner << "\n";
200 }
201}
202
203std::vector<std::string> XpressDynamicLibraryPotentialPaths() {
204 std::vector<std::string> potential_paths;
205
206 // Look for libraries pointed by XPRESSDIR first.
207 const char* xpressdir_from_env = getenv("XPRESSDIR");
208 if (xpressdir_from_env != nullptr) {
209 LOG(INFO) << "Environment variable XPRESSDIR = " << xpressdir_from_env;
210#if defined(_MSC_VER) // Windows
211 potential_paths.push_back(
212 absl::StrCat(xpressdir_from_env, "\\bin\\xprs.dll"));
213#elif defined(__APPLE__) // macOS
214 potential_paths.push_back(
215 absl::StrCat(xpressdir_from_env, "/lib/libxprs.dylib"));
216#elif defined(__GNUC__) // Linux
217 potential_paths.push_back(
218 absl::StrCat(xpressdir_from_env, "/lib/libxprs.so"));
219#else
220 LOG(ERROR) << "OS Not recognized by xpress/environment.cc."
221 << " You won't be able to use Xpress.";
222#endif
223 } else {
224 LOG(WARNING) << "Environment variable XPRESSDIR undefined.";
225 }
226
227 // Search for canonical places.
228#if defined(_MSC_VER) // Windows
229 potential_paths.push_back(absl::StrCat("C:\\xpressmp\\bin\\xprs.dll"));
230 potential_paths.push_back(
231 absl::StrCat("C:\\Program Files\\xpressmp\\bin\\xprs.dll"));
232#elif defined(__APPLE__) // macOS
233 potential_paths.push_back(
234 absl::StrCat("/Library/xpressmp/lib/libxprs.dylib"));
235#elif defined(__GNUC__) // Linux
236 potential_paths.push_back(absl::StrCat("/opt/xpressmp/lib/libxprs.so"));
237#else
238 LOG(ERROR) << "OS Not recognized by xpress/environment.cc."
239 << " You won't be able to use Xpress.";
240#endif
241 return potential_paths;
242}
243
244absl::Status LoadXpressDynamicLibrary(std::string& xpresspath) {
245 static std::string* xpress_lib_path = new std::string;
246 static absl::once_flag xpress_loading_done;
247 static absl::Status* xpress_load_status = new absl::Status;
248 static DynamicLibrary* xpress_library = new DynamicLibrary;
249 static absl::Mutex mutex(absl::kConstInit);
250
251 absl::MutexLock lock(&mutex);
252
253 absl::call_once(xpress_loading_done, []() {
254 const std::vector<std::string> canonical_paths =
256 for (const std::string& path : canonical_paths) {
257 if (xpress_library->TryToLoad(path)) {
258 LOG(INFO) << "Found the Xpress library in " << path << ".";
259 xpress_lib_path->clear();
260 std::filesystem::path p(path);
261 p.remove_filename();
262 xpress_lib_path->append(p.string());
263 break;
264 }
265 }
266
267 if (xpress_library->LibraryIsLoaded()) {
268 LOG(INFO) << "Loading all Xpress functions";
269 LoadXpressFunctions(xpress_library);
270 *xpress_load_status = absl::OkStatus();
271 } else {
272 *xpress_load_status = absl::NotFoundError(
273 absl::StrCat("Could not find the Xpress shared library. Looked in: [",
274 absl::StrJoin(canonical_paths, "', '"),
275 "]. Please check environment variable XPRESSDIR"));
276 }
277 });
278 xpresspath.clear();
279 xpresspath.append(*xpress_lib_path);
280 return *xpress_load_status;
281}
282
284void log_full_license_error(int code, const std::string& xpress_lib_dir);
286bool initXpressEnv(bool verbose, int xpress_oem_license_key) {
287 std::string xpress_lib_dir;
288 absl::Status status = LoadXpressDynamicLibrary(xpress_lib_dir);
289 if (!status.ok()) {
290 LOG(WARNING) << status << "\n";
291 return false;
292 }
293
294 int code;
295 // if not an OEM key
296 if (xpress_oem_license_key == 0) {
297 if (verbose) {
299 }
300
301 code = XPRSinit(nullptr);
302
303 if (!code) {
304 // XPRSbanner informs about Xpress version, options and error messages
305 if (verbose) {
306 printXpressBanner(false);
307 char version[16];
308 XPRSgetversion(version);
309 LOG(WARNING) << "Optimizer version: " << version
310 << " (OR-Tools was compiled with version " << XPVERSION
311 << ").";
312 }
313 return true;
314 } else {
315 log_full_license_error(code, xpress_lib_dir);
316 return false;
317 }
318 } else {
319 // if OEM key
320 if (verbose) {
321 LOG(WARNING) << "XpressInterface : Initialising xpress-MP with OEM key "
322 << xpress_oem_license_key;
323 }
324
325 int nvalue = 0;
326 int ierr;
327 char slicmsg[256] = "";
328 char errmsg[256];
329
330 XPRSlicense(&nvalue, slicmsg);
331 if (verbose) {
332 DLOG(INFO) << "XpressInterface : First message from XPRSLicense : "
333 << slicmsg;
334 }
335
336 nvalue = xpress_oem_license_key - ((nvalue * nvalue) / 19);
337 ierr = XPRSlicense(&nvalue, slicmsg);
338
339 if (verbose) {
340 DLOG(INFO) << "XpressInterface : Second message from XPRSLicense : "
341 << slicmsg;
342 }
343 if (ierr == 16) {
344 if (verbose) {
345 DLOG(INFO)
346 << "XpressInterface : Optimizer development software detected";
347 }
348 } else if (ierr != 0) {
349 // get the license error message
350 XPRSgetlicerrmsg(errmsg, 256);
351
352 LOG(ERROR) << "XpressInterface : " << errmsg;
353 return false;
354 }
355
356 code = XPRSinit(nullptr);
357
358 if (!code) {
359 return true;
360 } else {
361 LOG(ERROR) << "XPRSinit returned code : " << code << "\n";
362 return false;
363 }
364 }
365}
366void log_full_license_error(int code, const std::string& xpress_lib_dir) {
367 LOG(WARNING) << "XpressInterface: Xpress found at " << xpress_lib_dir << "\n";
368 char errmsg[256];
369 XPRSgetlicerrmsg(errmsg, 256);
370
371 LOG(ERROR) << "XpressInterface : License error : " << errmsg
372 << " (XPRSinit returned code " << code << "). \n";
373 LOG(ERROR)
374 << "|_Your Xpress installation should have set the env var XPAUTH_PATH"
375 " to the full path of your licence file\n";
376}
378 LOG(WARNING)
379 << "XpressInterface : Initialising xpress-MP with default parameters";
380}
381
383 bool correctlyInstalled = initXpressEnv(false);
384 if (correctlyInstalled) {
385 XPRSfree();
386 }
387 return correctlyInstalled;
388}
389
390} // namespace operations_research
bool LibraryIsLoaded() const
std::function< T > GetFunction(const char *function_name)
bool TryToLoad(const absl::string_view library_name)
In SWIG mode, we don't want anything besides these top-level includes.
std::function< int(XPRSprob prob, int objidx)> XPRSdelobj
std::function< int(XPRSprob prob, void(XPRS_CC *f_intsol)(XPRSprob cbprob, void *cbdata), void *p, int priority)> XPRSaddcbintsol
std::function< int(XPRSprob prob, int control)> XPRSsetdefaultcontrol
std::function< int(XPRSprob prob, int nrows, const int rowind[], const char rowtype[])> XPRSchgrowtype
std::function< int(char *banner)> XPRSgetbanner
absl::Status LoadXpressDynamicLibrary(std::string &xpresspath)
std::function< int(XPRSprob prob, char rowtype[], int first, int last)> XPRSgetrowtype
std::function< int(XPRSprob prob, int attrib, int *p_value)> XPRSgetintattrib
std::function< int(XPRSprob prob, int ncoefs, const int objqcol1[], const int objqcol2[], const double objqcoef[])> XPRSchgmqobj
std::function< int(XPRSprob prob, char coltype[], int first, int last)> XPRSgetcoltype
std::function< int(XPRSprob prob, int attrib, double *p_value)> XPRSgetdblattrib
std::function< int(XPRSprob prob, int *status, double djs[], int first, int last)> XPRSgetredcosts
std::function< int(XPRSprob prob, const char *filename, const char *flags)> XPRSwriteprob
std::function< int(XPRSprob prob, void(XPRS_CC *f_message)(XPRSprob cbprob, void *cbdata, const char *msg, int msglen, int msgtype), void *p, int priority)> XPRSaddcbmessage
std::function< int(XPRSprob prob, double rhs[], int first, int last)> XPRSgetrhs
bool initXpressEnv(bool verbose, int xpress_oem_license_key)
! init XPRESS environment.
void LoadXpressFunctions(DynamicLibrary *xpress_dynamic_library)
std::function< int(XPRSprob prob, int length, const double solval[], const int colind[], const char *name)> XPRSaddmipsol
std::function< int(XPRSprob prob, double x[], double slack[])> XPRSgetmipsol
std::function< int(XPRSprob prob, int nbounds, const int colind[], const char bndtype[], const double bndval[])> XPRSchgbounds
std::function< int(XPRSprob prob, int row, int col, double *p_coef)> XPRSgetcoef
std::function< int(XPRSprob prob, const int rowstat[], const int colstat[])> XPRSloadbasis
std::function< int(XPRSprob prob, int row, int col, double coef)> XPRSchgcoef
std::function< int(XPRSprob prob, int nrows, const int rowind[])> XPRSdelrows
std::function< int(XPRSprob prob, int type, char names[], int first, int last)> XPRSgetnames
std::function< int(XPRSprob prob, int ncols, const int colind[])> XPRSdelcols
std::function< int(XPRSprob prob, int control, double *p_value)> XPRSgetdblcontrol
std::function< int(XPRSprob prob, double lb[], int first, int last)> XPRSgetlb
std::function< int(XPRSprob prob, const char *flags, int *solvestatus, int *solstatus)> XPRSoptimize
std::function< int(XPRSprob prob, int control, int *p_value)> XPRSgetintcontrol
std::function< int(XPRSprob prob, void(XPRS_CC *f_intsol)(XPRSprob cbprob, void *cbdata), void *p)> XPRSremovecbintsol
std::function< int(XPRSprob prob, int ncols, const int colind[], const char coltype[])> XPRSchgcoltype
std::function< int(char *version)> XPRSgetversion
std::function< int(XPRSprob prob, const char *name, int *p_id, int *p_type)> XPRSgetcontrolinfo
std::function< int(XPRSprob prob, double x[], double slack[], double duals[], double djs[])> XPRSgetlpsol
std::function< int(XPRSprob prob, int control, XPRSint64 *p_value)> XPRSgetintcontrol64
std::function< int(XPRSprob prob)> XPRSpostsolve
std::function< int(XPRSprob prob, double objcoef[], int first, int last)> XPRSgetobj
std::function< int(XPRSprob prob, int nrows, const int rowind[], const double rng[])> XPRSchgrhsrange
std::function< int(XPRSprob prob, int type, const char names[], int first, int last)> XPRSaddnames
std::function< int(XPRSprob prob, int ncoefs, const int rowind[], const int colind[], const double rowcoef[])> XPRSchgmcoef
void log_full_license_error(int code, const std::string &xpress_lib_dir)
std::function< int(void)> XPRSfree
std::function< int(XPRSprob prob, int reason)> XPRSinterrupt
bool XpressIsCorrectlyInstalled()
std::function< int(char *buffer, int maxbytes)> XPRSgetlicerrmsg
void log_message_about_XPRSinit_argument()
std::function< int(XPRSprob prob, int control, int value)> XPRSsetintcontrol
std::function< int(XPRSprob prob, int nrows, int ncoefs, const char rowtype[], const double rhs[], const double rng[], const int start[], const int colind[], const double rowcoef[])> XPRSaddrows
std::function< int(XPRSprob prob, char *errmsg)> XPRSgetlasterror
std::function< int(XPRSprob prob, int attrib, char *value, int maxbytes, int *p_nbytes)> XPRSgetstringattrib
std::function< int(XPRSprob prob)> XPRSdestroyprob
std::function< int(XPRSprob prob, int control, double value)> XPRSsetdblcontrol
std::function< int(XPRSprob prob, XPRSint64 ncoefs, const int rowind[], const int colind[], const double rowcoef[])> XPRSchgmcoef64
std::function< int(XPRSprob prob, double rng[], int first, int last)> XPRSgetrhsrange
std::function< int(XPRSprob prob, double ub[], int first, int last)> XPRSgetub
void printXpressBanner(bool error)
std::function< int(int *p_i, char *p_c)> XPRSlicense
std::function< int(XPRSprob prob, int control, const char *value)> XPRSsetstrcontrol
std::function< int(XPRSprob prob, int ncols, int ncoefs, const double objcoef[], const int start[], const int rowind[], const double rowcoef[], const double lb[], const double ub[])> XPRSaddcols
std::function< int(XPRSprob prob, int control, char *value, int maxbytes, int *p_nbytes)> XPRSgetstringcontrol
std::function< int(XPRSprob prob, const char *flags)> XPRSmipoptimize
std::function< int(XPRSprob prob, int nrows, const int rowind[], const double rhs[])> XPRSchgrhs
std::function< int(XPRSprob prob, int ncols, const int colind[], const double objcoef[])> XPRSchgobj
std::function< int(XPRSprob prob, int *status, double duals[], int first, int last)> XPRSgetduals
std::vector< std::string > XpressDynamicLibraryPotentialPaths()
std::function< int(XPRSprob *p_prob)> XPRScreateprob
std::function< int(XPRSprob prob, const char *flags)> XPRSlpoptimize
std::function< int(XPRSprob prob, int control, XPRSint64 value)> XPRSsetintcontrol64
std::function< int(XPRSprob prob, int objsense)> XPRSchgobjsense
std::function< int(const char *path)> XPRSinit
std::function< int(XPRSprob prob, const char *probname)> XPRSsetprobname
std::function< int(XPRSprob prob, int rowstat[], int colstat[])> XPRSgetbasis
#define XPRS_MAXBANNERLENGTH
Definition environment.h:97
#define XPRSint64
Definition environment.h:56
struct xo_prob_struct * XPRSprob
Copyright 2019-2023 RTE.
Definition environment.h:27
#define XPVERSION
Definition environment.h:98
#define XPRS_CC
NOLINTEND(runtime/int)
Definition environment.h:63