Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
gurobi_environment.cc
Go to the documentation of this file.
1// Copyright 2010-2025 Google LLC
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
15
16#include <cstdlib>
17#include <functional>
18#include <string>
19#include <vector>
20
21#include "absl/base/no_destructor.h"
22#include "absl/status/status.h"
23#include "absl/strings/str_cat.h"
24#include "absl/strings/str_join.h"
25#include "absl/strings/string_view.h"
28
29namespace operations_research {
30
31// This was generated with the parse_header.py script.
32// See the comment at the top of the script.
33// Let's not reformat the rest of the file.
34// clang-format off
35
36// This is the 'define' section.
37std::function<int(GRBmodel* model, const char* attrname)> GRBisattravailable =
38 nullptr;
39std::function<int(GRBmodel* model, const char* attrname, int* valueP)>
40 GRBgetintattr = nullptr;
41std::function<int(GRBmodel* model, const char* attrname, int newvalue)>
42 GRBsetintattr = nullptr;
43std::function<int(GRBmodel* model, const char* attrname, int element,
44 int* valueP)>
46std::function<int(GRBmodel* model, const char* attrname, int element,
47 int newvalue)>
49std::function<int(GRBmodel* model, const char* attrname, int first, int len,
50 int* values)>
52std::function<int(GRBmodel* model, const char* attrname, int first, int len,
53 int* newvalues)>
55std::function<int(GRBmodel* model, const char* attrname, int len, int* ind,
56 int* newvalues)>
58std::function<int(GRBmodel* model, const char* attrname, int element,
59 char* valueP)>
61std::function<int(GRBmodel* model, const char* attrname, int element,
62 char newvalue)>
64std::function<int(GRBmodel* model, const char* attrname, int first, int len,
65 char* values)>
67std::function<int(GRBmodel* model, const char* attrname, int first, int len,
68 char* newvalues)>
70std::function<int(GRBmodel* model, const char* attrname, int len, int* ind,
71 char* newvalues)>
73std::function<int(GRBmodel* model, const char* attrname, double* valueP)>
74 GRBgetdblattr = nullptr;
75std::function<int(GRBmodel* model, const char* attrname, double newvalue)>
76 GRBsetdblattr = nullptr;
77std::function<int(GRBmodel* model, const char* attrname, int element,
78 double* valueP)>
80std::function<int(GRBmodel* model, const char* attrname, int element,
81 double newvalue)>
83std::function<int(GRBmodel* model, const char* attrname, int first, int len,
84 double* values)>
86std::function<int(GRBmodel* model, const char* attrname, int first, int len,
87 double* newvalues)>
89std::function<int(GRBmodel* model, const char* attrname, int len, int* ind,
90 double* newvalues)>
92std::function<int(GRBmodel* model, const char* attrname, char** valueP)>
93 GRBgetstrattr = nullptr;
94std::function<int(GRBmodel* model, const char* attrname, const char* newvalue)>
95 GRBsetstrattr = nullptr;
96std::function<int(GRBmodel* model, int(GUROBI_STDCALL* cb)(CB_ARGS),
97 void* usrdata)>
99std::function<int(void* cbdata, int where, int what, void* resultP)> GRBcbget =
100 nullptr;
101std::function<int(void* cbdata, const double* solution, double* objvalP)>
102 GRBcbsolution = nullptr;
103std::function<int(void* cbdata, int cutlen, const int* cutind,
104 const double* cutval, char cutsense, double cutrhs)>
105 GRBcbcut = nullptr;
106std::function<int(void* cbdata, int lazylen, const int* lazyind,
107 const double* lazyval, char lazysense, double lazyrhs)>
108 GRBcblazy = nullptr;
109std::function<int(GRBmodel* model, int* numnzP, int* vbeg, int* vind,
110 double* vval, int start, int len)>
111 GRBgetvars = nullptr;
112std::function<int(GRBmodel* model)> GRBoptimize = nullptr;
113std::function<int(GRBmodel* model)> GRBcomputeIIS = nullptr;
114std::function<int(GRBmodel* model, const char* filename)> GRBwrite = nullptr;
115std::function<int(GRBenv* env, GRBmodel** modelP, const char* Pname,
116 int numvars, double* obj, double* lb, double* ub, char* vtype,
117 char** varnames)>
118 GRBnewmodel = nullptr;
119std::function<int(GRBmodel* model, int numnz, int* vind, double* vval,
120 double obj, double lb, double ub, char vtype,
121 const char* varname)>
122 GRBaddvar = nullptr;
123std::function<int(GRBmodel* model, int numvars, int numnz, int* vbeg, int* vind,
124 double* vval, double* obj, double* lb, double* ub,
125 char* vtype, char** varnames)>
126 GRBaddvars = nullptr;
127std::function<int(GRBmodel* model, int numnz, int* cind, double* cval,
128 char sense, double rhs, const char* constrname)>
129 GRBaddconstr = nullptr;
130std::function<int(GRBmodel* model, int numconstrs, int numnz, int* cbeg,
131 int* cind, double* cval, char* sense, double* rhs,
132 char** constrnames)>
133 GRBaddconstrs = nullptr;
134std::function<int(GRBmodel* model, int numnz, int* cind, double* cval,
135 double lower, double upper, const char* constrname)>
137std::function<int(GRBmodel* model, int numsos, int nummembers, int* types,
138 int* beg, int* ind, double* weight)>
139 GRBaddsos = nullptr;
140std::function<int(GRBmodel* model, const char* name, int resvar, int nvars,
141 const int* vars, double constant)>
143std::function<int(GRBmodel* model, const char* name, int resvar, int nvars,
144 const int* vars, double constant)>
146std::function<int(GRBmodel* model, const char* name, int resvar, int argvar)>
148std::function<int(GRBmodel* model, const char* name, int resvar, int nvars,
149 const int* vars)>
151std::function<int(GRBmodel* model, const char* name, int resvar, int nvars,
152 const int* vars)>
154std::function<int(GRBmodel* model, const char* name, int binvar, int binval,
155 int nvars, const int* vars, const double* vals, char sense,
156 double rhs)>
158std::function<int(GRBmodel* model, int numlnz, int* lind, double* lval,
159 int numqnz, int* qrow, int* qcol, double* qval, char sense,
160 double rhs, const char* QCname)>
161 GRBaddqconstr = nullptr;
162std::function<int(GRBmodel* model, int numqnz, int* qrow, int* qcol,
163 double* qval)>
164 GRBaddqpterms = nullptr;
165std::function<int(GRBmodel* model, int len, int* ind)> GRBdelvars = nullptr;
166std::function<int(GRBmodel* model, int len, int* ind)> GRBdelconstrs = nullptr;
167std::function<int(GRBmodel* model, int len, int* ind)> GRBdelsos = nullptr;
168std::function<int(GRBmodel* model, int len, int* ind)> GRBdelgenconstrs =
169 nullptr;
170std::function<int(GRBmodel* model, int len, int* ind)> GRBdelqconstrs = nullptr;
171std::function<int(GRBmodel* model)> GRBdelq = nullptr;
172std::function<int(GRBmodel* model, int cnt, int* cind, int* vind, double* val)>
173 GRBchgcoeffs = nullptr;
174std::function<int(GRBmodel* model)> GRBupdatemodel = nullptr;
175std::function<int(GRBmodel* model)> GRBfreemodel = nullptr;
176std::function<void(GRBmodel* model)> GRBterminate = nullptr;
177std::function<int(GRBmodel* model, int index, int priority, double weight,
178 double abstol, double reltol, const char* name,
179 double constant, int lnz, int* lind, double* lval)>
181std::function<int(GRBenv* env, const char* paramname, int* valueP)>
182 GRBgetintparam = nullptr;
183std::function<int(GRBenv* env, const char* paramname, double* valueP)>
184 GRBgetdblparam = nullptr;
185std::function<int(GRBenv* env, const char* paramname, char* valueP)>
186 GRBgetstrparam = nullptr;
187std::function<int(GRBenv* env, const char* paramname, int* valueP, int* minP,
188 int* maxP, int* defP)>
190std::function<int(GRBenv* env, const char* paramname, double* valueP,
191 double* minP, double* maxP, double* defP)>
193std::function<int(GRBenv* env, const char* paramname, char* valueP, char* defP)>
195std::function<int(GRBenv* env, const char* paramname)> GRBgetparamtype =
196 nullptr;
197std::function<int(GRBenv* env, int i, char** paramnameP)> GRBgetparamname =
198 nullptr;
199std::function<int(GRBenv* env, const char* paramname, const char* value)>
200 GRBsetparam = nullptr;
201std::function<int(GRBenv* env, const char* paramname, int value)>
202 GRBsetintparam = nullptr;
203std::function<int(GRBenv* env, const char* paramname, double value)>
204 GRBsetdblparam = nullptr;
205std::function<int(GRBenv* env, const char* paramname, const char* value)>
206 GRBsetstrparam = nullptr;
207std::function<int(GRBenv* env)> GRBresetparams = nullptr;
208std::function<int(GRBenv* dest, GRBenv* src)> GRBcopyparams = nullptr;
209std::function<int(GRBenv* env)> GRBgetnumparams = nullptr;
210std::function<int(GRBenv** envP)> GRBemptyenv = nullptr;
211std::function<int(GRBenv** envP, const char* logfilename)> GRBloadenv = nullptr;
212std::function<int(GRBenv* env)> GRBstartenv = nullptr;
213std::function<GRBenv*(GRBmodel* model)> GRBgetenv = nullptr;
214std::function<GRBenv*(GRBmodel* model, int num)> GRBgetmultiobjenv = nullptr;
215std::function<GRBenv*(GRBmodel* model)> GRBdiscardmultiobjenvs = nullptr;
216std::function<void(GRBenv* env)> GRBfreeenv = nullptr;
217std::function<const char*(GRBenv* env)> GRBgeterrormsg = nullptr;
218std::function<void(int* majorP, int* minorP, int* technicalP)> GRBversion =
219 nullptr;
220std::function<char*(void)> GRBplatform = nullptr;
221
222void LoadGurobiFunctions(DynamicLibrary* gurobi_dynamic_library) {
223 // This was generated with the parse_header.py script.
224 // See the comment at the top of the script.
225
226 // This is the 'assign' section.
227 gurobi_dynamic_library->GetFunction(&GRBisattravailable,
228 "GRBisattravailable");
229 gurobi_dynamic_library->GetFunction(&GRBgetintattr, "GRBgetintattr");
230 gurobi_dynamic_library->GetFunction(&GRBsetintattr, "GRBsetintattr");
231 gurobi_dynamic_library->GetFunction(&GRBgetintattrelement,
232 "GRBgetintattrelement");
233 gurobi_dynamic_library->GetFunction(&GRBsetintattrelement,
234 "GRBsetintattrelement");
235 gurobi_dynamic_library->GetFunction(&GRBgetintattrarray,
236 "GRBgetintattrarray");
237 gurobi_dynamic_library->GetFunction(&GRBsetintattrarray,
238 "GRBsetintattrarray");
239 gurobi_dynamic_library->GetFunction(&GRBsetintattrlist, "GRBsetintattrlist");
240 gurobi_dynamic_library->GetFunction(&GRBgetcharattrelement,
241 "GRBgetcharattrelement");
242 gurobi_dynamic_library->GetFunction(&GRBsetcharattrelement,
243 "GRBsetcharattrelement");
244 gurobi_dynamic_library->GetFunction(&GRBgetcharattrarray,
245 "GRBgetcharattrarray");
246 gurobi_dynamic_library->GetFunction(&GRBsetcharattrarray,
247 "GRBsetcharattrarray");
248 gurobi_dynamic_library->GetFunction(&GRBsetcharattrlist,
249 "GRBsetcharattrlist");
250 gurobi_dynamic_library->GetFunction(&GRBgetdblattr, "GRBgetdblattr");
251 gurobi_dynamic_library->GetFunction(&GRBsetdblattr, "GRBsetdblattr");
252 gurobi_dynamic_library->GetFunction(&GRBgetdblattrelement,
253 "GRBgetdblattrelement");
254 gurobi_dynamic_library->GetFunction(&GRBsetdblattrelement,
255 "GRBsetdblattrelement");
256 gurobi_dynamic_library->GetFunction(&GRBgetdblattrarray,
257 "GRBgetdblattrarray");
258 gurobi_dynamic_library->GetFunction(&GRBsetdblattrarray,
259 "GRBsetdblattrarray");
260 gurobi_dynamic_library->GetFunction(&GRBsetdblattrlist, "GRBsetdblattrlist");
261 gurobi_dynamic_library->GetFunction(&GRBgetstrattr, "GRBgetstrattr");
262 gurobi_dynamic_library->GetFunction(&GRBsetstrattr, "GRBsetstrattr");
263 gurobi_dynamic_library->GetFunction(&GRBsetcallbackfunc,
264 "GRBsetcallbackfunc");
265 gurobi_dynamic_library->GetFunction(&GRBcbget, "GRBcbget");
266 gurobi_dynamic_library->GetFunction(&GRBcbsolution, "GRBcbsolution");
267 gurobi_dynamic_library->GetFunction(&GRBcbcut, "GRBcbcut");
268 gurobi_dynamic_library->GetFunction(&GRBcblazy, "GRBcblazy");
269 gurobi_dynamic_library->GetFunction(&GRBgetvars, "GRBgetvars");
270 gurobi_dynamic_library->GetFunction(&GRBoptimize, "GRBoptimize");
271 gurobi_dynamic_library->GetFunction(&GRBcomputeIIS, "GRBcomputeIIS");
272 gurobi_dynamic_library->GetFunction(&GRBwrite, "GRBwrite");
273 gurobi_dynamic_library->GetFunction(&GRBnewmodel, "GRBnewmodel");
274 gurobi_dynamic_library->GetFunction(&GRBaddvar, "GRBaddvar");
275 gurobi_dynamic_library->GetFunction(&GRBaddvars, "GRBaddvars");
276 gurobi_dynamic_library->GetFunction(&GRBaddconstr, "GRBaddconstr");
277 gurobi_dynamic_library->GetFunction(&GRBaddconstrs, "GRBaddconstrs");
278 gurobi_dynamic_library->GetFunction(&GRBaddrangeconstr, "GRBaddrangeconstr");
279 gurobi_dynamic_library->GetFunction(&GRBaddsos, "GRBaddsos");
280 gurobi_dynamic_library->GetFunction(&GRBaddgenconstrMax,
281 "GRBaddgenconstrMax");
282 gurobi_dynamic_library->GetFunction(&GRBaddgenconstrMin,
283 "GRBaddgenconstrMin");
284 gurobi_dynamic_library->GetFunction(&GRBaddgenconstrAbs,
285 "GRBaddgenconstrAbs");
286 gurobi_dynamic_library->GetFunction(&GRBaddgenconstrAnd,
287 "GRBaddgenconstrAnd");
288 gurobi_dynamic_library->GetFunction(&GRBaddgenconstrOr, "GRBaddgenconstrOr");
289 gurobi_dynamic_library->GetFunction(&GRBaddgenconstrIndicator,
290 "GRBaddgenconstrIndicator");
291 gurobi_dynamic_library->GetFunction(&GRBaddqconstr, "GRBaddqconstr");
292 gurobi_dynamic_library->GetFunction(&GRBaddqpterms, "GRBaddqpterms");
293 gurobi_dynamic_library->GetFunction(&GRBdelvars, "GRBdelvars");
294 gurobi_dynamic_library->GetFunction(&GRBdelconstrs, "GRBdelconstrs");
295 gurobi_dynamic_library->GetFunction(&GRBdelsos, "GRBdelsos");
296 gurobi_dynamic_library->GetFunction(&GRBdelgenconstrs, "GRBdelgenconstrs");
297 gurobi_dynamic_library->GetFunction(&GRBdelqconstrs, "GRBdelqconstrs");
298 gurobi_dynamic_library->GetFunction(&GRBdelq, "GRBdelq");
299 gurobi_dynamic_library->GetFunction(&GRBchgcoeffs, "GRBchgcoeffs");
300 gurobi_dynamic_library->GetFunction(&GRBupdatemodel, "GRBupdatemodel");
301 gurobi_dynamic_library->GetFunction(&GRBfreemodel, "GRBfreemodel");
302 gurobi_dynamic_library->GetFunction(&GRBterminate, "GRBterminate");
303 gurobi_dynamic_library->GetFunction(&GRBsetobjectiven, "GRBsetobjectiven");
304 gurobi_dynamic_library->GetFunction(&GRBgetintparam, "GRBgetintparam");
305 gurobi_dynamic_library->GetFunction(&GRBgetdblparam, "GRBgetdblparam");
306 gurobi_dynamic_library->GetFunction(&GRBgetstrparam, "GRBgetstrparam");
307 gurobi_dynamic_library->GetFunction(&GRBsetparam, "GRBsetparam");
308 gurobi_dynamic_library->GetFunction(&GRBsetintparam, "GRBsetintparam");
309 gurobi_dynamic_library->GetFunction(&GRBsetdblparam, "GRBsetdblparam");
310 gurobi_dynamic_library->GetFunction(&GRBsetstrparam, "GRBsetstrparam");
311 gurobi_dynamic_library->GetFunction(&GRBresetparams, "GRBresetparams");
312 gurobi_dynamic_library->GetFunction(&GRBcopyparams, "GRBcopyparams");
313 gurobi_dynamic_library->GetFunction(&GRBloadenv, "GRBloadenv");
314 gurobi_dynamic_library->GetFunction(&GRBstartenv, "GRBstartenv");
315 gurobi_dynamic_library->GetFunction(&GRBemptyenv, "GRBemptyenv");
316 gurobi_dynamic_library->GetFunction(&GRBgetnumparams, "GRBgetnumparams");
317 gurobi_dynamic_library->GetFunction(&GRBgetparamname, "GRBgetparamname");
318 gurobi_dynamic_library->GetFunction(&GRBgetparamtype, "GRBgetparamtype");
319 gurobi_dynamic_library->GetFunction(&GRBgetintparaminfo,
320 "GRBgetintparaminfo");
321 gurobi_dynamic_library->GetFunction(&GRBgetdblparaminfo,
322 "GRBgetdblparaminfo");
323 gurobi_dynamic_library->GetFunction(&GRBgetstrparaminfo,
324 "GRBgetstrparaminfo");
325 gurobi_dynamic_library->GetFunction(&GRBgetenv, "GRBgetenv");
326 gurobi_dynamic_library->GetFunction(&GRBgetmultiobjenv, "GRBgetmultiobjenv");
327 gurobi_dynamic_library->GetFunction(&GRBdiscardmultiobjenvs,
328 "GRBdiscardmultiobjenvs");
329 gurobi_dynamic_library->GetFunction(&GRBfreeenv, "GRBfreeenv");
330 gurobi_dynamic_library->GetFunction(&GRBgeterrormsg, "GRBgeterrormsg");
331 gurobi_dynamic_library->GetFunction(&GRBversion, "GRBversion");
332 gurobi_dynamic_library->GetFunction(&GRBplatform, "GRBplatform");
333}
334
335// clang-format on
336
337std::vector<std::string> GurobiDynamicLibraryPotentialPaths() {
338 std::vector<std::string> potential_paths;
339 // clang-format off
340 const std::vector<absl::string_view> kGurobiVersions = {
341 "1300",
342 "1203", "1202", "1201", "1200",
343 "1103", "1102", "1101", "1100",
344 "1003", "1002", "1001", "1000",
345 "952", "951", "950",
346 "911", "910", "903", "902",
347 "811", "801", "752"};
348 // clang-format on
349 potential_paths.reserve(kGurobiVersions.size() * 3);
350
351 // Look for libraries pointed by GUROBI_HOME first.
352 const char* gurobi_home_from_env = getenv("GUROBI_HOME");
353 if (gurobi_home_from_env != nullptr) {
354 for (const absl::string_view version : kGurobiVersions) {
355 const absl::string_view lib = version.substr(0, version.size() - 1);
356#if defined(_MSC_VER) // Windows
357 potential_paths.push_back(
358 absl::StrCat(gurobi_home_from_env, "\\bin\\gurobi", lib, ".dll"));
359#elif defined(__APPLE__) // OS X
360 potential_paths.push_back(
361 absl::StrCat(gurobi_home_from_env, "/lib/libgurobi", lib, ".dylib"));
362#elif defined(__GNUC__) // Linux
363 potential_paths.push_back(
364 absl::StrCat(gurobi_home_from_env, "/lib/libgurobi", lib, ".so"));
365 potential_paths.push_back(
366 absl::StrCat(gurobi_home_from_env, "/lib64/libgurobi", lib, ".so"));
367#else
368 LOG(ERROR) << "OS Not recognized by gurobi_environment.cc."
369 << " You won't be able to use Gurobi.";
370#endif
371 }
372 }
373
374 // Search for canonical places.
375 for (const absl::string_view version : kGurobiVersions) {
376 const absl::string_view lib = version.substr(0, version.size() - 1);
377#if defined(_MSC_VER) // Windows
378 potential_paths.push_back(absl::StrCat("C:\\Program Files\\gurobi", version,
379 "\\win64\\bin\\gurobi", lib,
380 ".dll"));
381 potential_paths.push_back(absl::StrCat(
382 "C:\\gurobi", version, "\\win64\\bin\\gurobi", lib, ".dll"));
383 potential_paths.push_back(absl::StrCat("gurobi", lib, ".dll"));
384#elif defined(__APPLE__) // OS X
385 potential_paths.push_back(absl::StrCat(
386 "/Library/gurobi", version, "/mac64/lib/libgurobi", lib, ".dylib"));
387 potential_paths.push_back(absl::StrCat("/Library/gurobi", version,
388 "/macos_universal2/lib/libgurobi",
389 lib, ".dylib"));
390#elif defined(__GNUC__) // Linux
391 potential_paths.push_back(absl::StrCat(
392 "/opt/gurobi", version, "/linux64/lib/libgurobi", lib, ".so"));
393 potential_paths.push_back(absl::StrCat(
394 "/opt/gurobi", version, "/linux64/lib64/libgurobi", lib, ".so"));
395 potential_paths.push_back(
396 absl::StrCat("/opt/gurobi/linux64/lib/libgurobi", lib, ".so"));
397 potential_paths.push_back(
398 absl::StrCat("/opt/gurobi/linux64/lib64/libgurobi", lib, ".so"));
399#else
400 LOG(ERROR) << "OS Not recognized by gurobi_environment.cc."
401 << " You won't be able to use Gurobi.";
402#endif
403 }
404
405#if defined(__GNUC__) // path in linux64 gurobi/optimizer docker image.
406 for (const absl::string_view version :
407 {"12.0.2", "12.0.1", "12.0.0", "11.0.3", "11.0.2", "11.0.1", "11.0.0",
408 "10.0.3", "10.0.2", "10.0.1", "10.0.0", "9.5.2", "9.5.1", "9.5.0"}) {
409 potential_paths.push_back(
410 absl::StrCat("/opt/gurobi/linux64/lib/libgurobi.so.", version));
411 }
412#endif
413 return potential_paths;
414}
415
417 std::vector<absl::string_view> potential_paths) {
418 struct GurobiLibraryStruct {
419 absl::Status gurobi_load_status;
420 DynamicLibrary gurobi_library;
421 };
422
423 static absl::NoDestructor<GurobiLibraryStruct> loaded([&potential_paths]() {
424 GurobiLibraryStruct result;
425 // Try to load the library from the potential paths.
426 for (const absl::string_view path : potential_paths) {
427 if (result.gurobi_library.TryToLoad(path)) {
428 VLOG(1) << "Found the Gurobi library in '" << path << ".";
429 break;
430 }
431 }
432
433 // Fallback to the canonical paths.
434 if (!result.gurobi_library.LibraryIsLoaded()) {
435 const std::vector<std::string> canonical_paths =
437 for (const absl::string_view path : canonical_paths) {
438 if (result.gurobi_library.TryToLoad(path)) {
439 VLOG(1) << "Found the Gurobi library in '" << path << ".";
440 break;
441 }
442 }
443 }
444
445 if (result.gurobi_library.LibraryIsLoaded()) {
446 LoadGurobiFunctions(&result.gurobi_library);
447 result.gurobi_load_status = absl::OkStatus();
448 } else {
449 result.gurobi_load_status = absl::NotFoundError(absl::StrCat(
450 "Could not find the Gurobi shared library. Looked in: [",
451 absl::StrJoin(potential_paths, "', '"),
452 "]. If you know where it"
453 " is, pass the full path to 'LoadGurobiDynamicLibrary()'."));
454 }
455 return result;
456 }());
457
458 return loaded->gurobi_load_status;
459}
460
461} // namespace operations_research
std::function< T > GetFunction(const char *function_name)
struct _GRBenv GRBenv
struct _GRBmodel GRBmodel
#define CB_ARGS
#define GUROBI_STDCALL
OR-Tools root namespace.
std::function< int(GRBmodel *model, int numnz, int *cind, double *cval, char sense, double rhs, const char *constrname)> GRBaddconstr
std::function< void(GRBenv *env)> GRBfreeenv
std::function< int(GRBmodel *model, const char *attrname, double *valueP)> GRBgetdblattr
std::function< int(GRBmodel *model, const char *attrname, int first, int len, double *values)> GRBgetdblattrarray
std::function< int(GRBmodel *model, const char *attrname, int first, int len, int *values)> GRBgetintattrarray
std::function< int(GRBmodel *model, const char *attrname, double newvalue)> GRBsetdblattr
std::function< int(GRBmodel *model, int len, int *ind)> GRBdelsos
std::function< int(GRBmodel *model, int numvars, int numnz, int *vbeg, int *vind, double *vval, double *obj, double *lb, double *ub, char *vtype, char **varnames)> GRBaddvars
std::function< int(GRBmodel *model, int(GUROBI_STDCALL *cb)(CB_ARGS), void *usrdata)> GRBsetcallbackfunc
std::function< int(GRBenv *dest, GRBenv *src)> GRBcopyparams
std::function< int(GRBmodel *model, int *numnzP, int *vbeg, int *vind, double *vval, int start, int len)> GRBgetvars
std::function< int(GRBmodel *model, const char *attrname, int len, int *ind, int *newvalues)> GRBsetintattrlist
std::function< int(GRBmodel *model, int cnt, int *cind, int *vind, double *val)> GRBchgcoeffs
std::function< int(GRBmodel *model, const char *attrname, int first, int len, char *values)> GRBgetcharattrarray
std::function< int(void *cbdata, int cutlen, const int *cutind, const double *cutval, char cutsense, double cutrhs)> GRBcbcut
std::function< int(GRBenv *env, const char *paramname, double *valueP)> GRBgetdblparam
std::function< int(GRBmodel *model, int numlnz, int *lind, double *lval, int numqnz, int *qrow, int *qcol, double *qval, char sense, double rhs, const char *QCname)> GRBaddqconstr
std::function< int(GRBmodel *model, int len, int *ind)> GRBdelvars
std::function< int(GRBmodel *model, const char *attrname, int newvalue)> GRBsetintattr
std::function< int(GRBenv *env, const char *paramname, const char *value)> GRBsetparam
std::function< int(GRBmodel *model, const char *attrname, int element, int *valueP)> GRBgetintattrelement
Select next search node to expand Select next item_i to add this new search node to the search Generate a new search node where item_i is not in the knapsack Check validity of this new partial solution(using propagators) - If valid
std::function< int(GRBenv *env, GRBmodel **modelP, const char *Pname, int numvars, double *obj, double *lb, double *ub, char *vtype, char **varnames)> GRBnewmodel
std::function< int(GRBmodel *model, int numnz, int *vind, double *vval, double obj, double lb, double ub, char vtype, const char *varname)> GRBaddvar
std::function< int(GRBmodel *model, const char *attrname, int first, int len, int *newvalues)> GRBsetintattrarray
std::function< int(GRBmodel *model)> GRBupdatemodel
std::function< void(int *majorP, int *minorP, int *technicalP)> GRBversion
std::function< GRBenv *(GRBmodel *model)> GRBgetenv
std::function< int(GRBmodel *model, const char *attrname, int len, int *ind, char *newvalues)> GRBsetcharattrlist
std::function< int(GRBenv *env, const char *paramname, char *valueP)> GRBgetstrparam
std::function< int(GRBmodel *model, const char *attrname, int element, double *valueP)> GRBgetdblattrelement
std::function< int(GRBmodel *model, const char *attrname, int first, int len, char *newvalues)> GRBsetcharattrarray
std::function< int(GRBmodel *model)> GRBfreemodel
std::function< int(GRBmodel *model, int len, int *ind)> GRBdelqconstrs
std::function< int(void *cbdata, int lazylen, const int *lazyind, const double *lazyval, char lazysense, double lazyrhs)> GRBcblazy
std::function< int(GRBmodel *model)> GRBcomputeIIS
void LoadGurobiFunctions(DynamicLibrary *gurobi_dynamic_library)
std::function< int(void *cbdata, int where, int what, void *resultP)> GRBcbget
std::function< int(GRBenv *env, const char *paramname, int value)> GRBsetintparam
std::function< int(GRBmodel *model, const char *attrname)> GRBisattravailable
std::function< int(GRBenv *env, const char *paramname, const char *value)> GRBsetstrparam
std::function< int(GRBenv *env, const char *paramname, char *valueP, char *defP)> GRBgetstrparaminfo
std::function< int(GRBmodel *model, const char *attrname, int first, int len, double *newvalues)> GRBsetdblattrarray
std::function< int(GRBmodel *model, const char *name, int resvar, int nvars, const int *vars, double constant)> GRBaddgenconstrMin
std::function< int(GRBmodel *model, int numnz, int *cind, double *cval, double lower, double upper, const char *constrname)> GRBaddrangeconstr
std::function< int(GRBmodel *model, const char *name, int binvar, int binval, int nvars, const int *vars, const double *vals, char sense, double rhs)> GRBaddgenconstrIndicator
std::function< int(GRBmodel *model, const char *attrname, int element, char newvalue)> GRBsetcharattrelement
std::function< int(GRBmodel *model, const char *attrname, int element, int newvalue)> GRBsetintattrelement
std::function< int(GRBenv *env)> GRBresetparams
std::function< int(GRBmodel *model, const char *attrname, const char *newvalue)> GRBsetstrattr
absl::Status LoadGurobiDynamicLibrary(std::vector< absl::string_view > potential_paths)
std::function< GRBenv *(GRBmodel *model)> GRBdiscardmultiobjenvs
std::function< int(GRBmodel *model)> GRBoptimize
std::function< int(GRBenv **envP, const char *logfilename)> GRBloadenv
std::function< int(GRBmodel *model, int numqnz, int *qrow, int *qcol, double *qval)> GRBaddqpterms
std::function< GRBenv *(GRBmodel *model, int num)> GRBgetmultiobjenv
std::function< int(GRBenv **envP)> GRBemptyenv
std::function< int(GRBenv *env, const char *paramname)> GRBgetparamtype
std::function< int(GRBmodel *model, int len, int *ind)> GRBdelconstrs
std::function< int(GRBmodel *model, const char *name, int resvar, int argvar)> GRBaddgenconstrAbs
std::vector< std::string > GurobiDynamicLibraryPotentialPaths()
std::function< int(GRBenv *env, int i, char **paramnameP)> GRBgetparamname
std::function< int(GRBmodel *model, const char *attrname, int *valueP)> GRBgetintattr
std::function< int(GRBmodel *model, int len, int *ind)> GRBdelgenconstrs
std::function< int(GRBmodel *model, int index, int priority, double weight, double abstol, double reltol, const char *name, double constant, int lnz, int *lind, double *lval)> GRBsetobjectiven
std::function< const char *(GRBenv *env)> GRBgeterrormsg
std::function< int(GRBmodel *model, const char *filename)> GRBwrite
std::function< int(GRBenv *env, const char *paramname, double *valueP, double *minP, double *maxP, double *defP)> GRBgetdblparaminfo
std::function< int(GRBenv *env, const char *paramname, int *valueP)> GRBgetintparam
std::function< int(GRBmodel *model, const char *name, int resvar, int nvars, const int *vars)> GRBaddgenconstrAnd
std::function< int(GRBenv *env)> GRBstartenv
std::function< int(GRBmodel *model, const char *name, int resvar, int nvars, const int *vars)> GRBaddgenconstrOr
std::function< int(GRBmodel *model, int numconstrs, int numnz, int *cbeg, int *cind, double *cval, char *sense, double *rhs, char **constrnames)> GRBaddconstrs
std::function< int(GRBmodel *model, const char *attrname, int len, int *ind, double *newvalues)> GRBsetdblattrlist
std::function< int(GRBmodel *model, const char *name, int resvar, int nvars, const int *vars, double constant)> GRBaddgenconstrMax
std::function< char *(void)> GRBplatform
std::function< int(GRBenv *env, const char *paramname, int *valueP, int *minP, int *maxP, int *defP)> GRBgetintparaminfo
std::function< int(GRBmodel *model, int numsos, int nummembers, int *types, int *beg, int *ind, double *weight)> GRBaddsos
std::function< int(GRBenv *env)> GRBgetnumparams
std::function< int(GRBmodel *model, const char *attrname, int element, char *valueP)> GRBgetcharattrelement
std::function< int(GRBmodel *model, const char *attrname, char **valueP)> GRBgetstrattr
std::function< int(GRBmodel *model)> GRBdelq
std::function< int(void *cbdata, const double *solution, double *objvalP)> GRBcbsolution
std::function< void(GRBmodel *model)> GRBterminate
std::function< int(GRBenv *env, const char *paramname, double value)> GRBsetdblparam
std::function< int(GRBmodel *model, const char *attrname, int element, double newvalue)> GRBsetdblattrelement