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