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