22#include "absl/log/check.h"
23#include "absl/log/die_if_null.h"
24#include "absl/memory/memory.h"
25#include "absl/status/status.h"
26#include "absl/status/statusor.h"
27#include "absl/strings/str_format.h"
28#include "absl/types/span.h"
35#include "ortools/math_opt/solvers/gurobi.pb.h"
40constexpr int kGrbOk = 0;
42struct UserCallbackData {
44 absl::Status
status = absl::OkStatus();
49 const int where,
void*
const usrdata) {
50 CHECK(usrdata !=
nullptr);
51 CHECK(
model !=
nullptr);
52 auto user_cb_data =
static_cast<UserCallbackData*
>(usrdata);
53 CHECK_EQ(
model, user_cb_data->gurobi->model());
55 if (!user_cb_data->status.ok()) {
58 const Gurobi::CallbackContext
context(user_cb_data->gurobi, cbdata,
where);
59 user_cb_data->status = user_cb_data->user_cb(
context);
60 if (!user_cb_data->status.ok()) {
61 user_cb_data->gurobi->Terminate();
84 ScopedCallback(
const ScopedCallback&) =
delete;
85 ScopedCallback& operator=(
const ScopedCallback&) =
delete;
86 ScopedCallback(ScopedCallback&&) =
delete;
87 ScopedCallback& operator=(ScopedCallback&&) =
delete;
90 static absl::StatusOr<std::unique_ptr<ScopedCallback>> New(
93 auto scope = absl::WrapUnique(
new ScopedCallback(
gurobi));
95 scope->user_cb_data_.user_cb = std::move(cb);
96 scope->user_cb_data_.gurobi =
gurobi;
98 gurobi->model(), GurobiCallback, &scope->user_cb_data_)));
99 scope->needs_cleanup_ =
true;
105 absl::Status Flush() {
106 const absl::Status
status = std::move(user_cb_data_.status);
107 user_cb_data_.status = absl::OkStatus();
112 absl::Status Release() {
113 if (needs_cleanup_) {
114 needs_cleanup_ =
false;
115 return gurobi_->ToStatus(
118 return absl::OkStatus();
122 if (
const absl::Status s = Flush(); !s.ok()) {
123 LOG(ERROR) <<
"Error returned from callback: " << s;
125 if (
const absl::Status s = Release(); !s.ok()) {
126 LOG(ERROR) <<
"Error cleaning up callback: " << s;
131 explicit ScopedCallback(Gurobi*
const gurobi) : gurobi_(
gurobi) {}
133 bool needs_cleanup_ =
false;
135 UserCallbackData user_cb_data_;
139bool AreISVKeyEqual(
const GurobiIsvKey& key,
140 const GurobiInitializerProto::ISVKey& proto_key) {
141 return key.name == proto_key.name() &&
142 key.application_name == proto_key.application_name() &&
143 key.expiration == proto_key.expiration() && key.key == proto_key.key();
149 if (env !=
nullptr) {
155 const std::optional<GurobiIsvKey>& isv_key) {
156 if (isv_key.has_value()) {
161 GRBenv* naked_primary_env =
nullptr;
162 const int err =
GRBloadenv(&naked_primary_env,
nullptr);
170 <<
"failed to create Gurobi primary environment, GRBloadenv() "
171 "returned the error ("
176 GRBenv*
const primary_env) {
177 CHECK(primary_env !=
nullptr);
178 return New(
nullptr, primary_env);
183 if (primary_env ==
nullptr) {
186 GRBenv*
const raw_primary_env = primary_env.get();
187 return New(std::move(primary_env), raw_primary_env);
192 : owned_primary_env_(
std::move(optional_owned_primary_env)),
193 gurobi_model_(ABSL_DIE_IF_NULL(
model)),
194 model_env_(ABSL_DIE_IF_NULL(model_env)) {}
196absl::StatusOr<std::unique_ptr<Gurobi>>
Gurobi::New(
198 CHECK(primary_env !=
nullptr);
208 <<
"Error creating gurobi model on GRBnewmodel(), error code: "
211 CHECK(
model !=
nullptr);
215 int gurobi_major, gurobi_minor, gurobi_technical;
216 GRBversion(&gurobi_major, &gurobi_minor, &gurobi_technical);
217 VLOG(3) << absl::StrFormat(
218 "Successfully created model for Gurobi v%d.%d.%d (%s)", gurobi_major,
221 return absl::WrapUnique(
222 new Gurobi(std::move(optional_owned_primary_env),
model, model_env));
228 LOG(ERROR) <<
"Error freeing gurobi model, code: " << err
235 if (grb_err == kGrbOk) {
236 return absl::OkStatus();
240 <<
"Gurobi error code: " << grb_err
245 const char vtype,
const std::string&
name) {
246 return AddVar({}, {}, obj, lb, ub, vtype,
name);
250 const absl::Span<const double> vval,
251 const double obj,
const double lb,
const double ub,
252 const char vtype,
const std::string&
name) {
253 CHECK_EQ(vind.size(), vval.size());
254 const int numnz =
static_cast<int>(vind.size());
256 const_cast<int*
>(vind.data()),
257 const_cast<double*
>(vval.data()),
262 name.empty() ?
nullptr :
name.data()));
265absl::Status Gurobi::AddVars(
const absl::Span<const double> obj,
266 const absl::Span<const double> lb,
267 const absl::Span<const double> ub,
268 const absl::Span<const char> vtype,
269 const absl::Span<const std::string> names) {
270 return AddVars({}, {}, {}, obj, lb, ub, vtype, names);
273absl::Status Gurobi::AddVars(
const absl::Span<const int> vbegin,
274 const absl::Span<const int> vind,
275 const absl::Span<const double> vval,
276 const absl::Span<const double> obj,
277 const absl::Span<const double> lb,
278 const absl::Span<const double> ub,
279 const absl::Span<const char> vtype,
280 const absl::Span<const std::string> names) {
281 CHECK_EQ(vind.size(), vval.size());
282 const int num_vars =
static_cast<int>(lb.size());
283 CHECK_EQ(ub.size(), num_vars);
284 CHECK_EQ(vtype.size(), num_vars);
285 double* c_obj =
nullptr;
287 CHECK_EQ(obj.size(), num_vars);
288 c_obj =
const_cast<double*
>(obj.data());
290 if (!vbegin.empty()) {
291 CHECK_EQ(vbegin.size(), num_vars);
293 char** c_names =
nullptr;
294 std::vector<char*> c_names_data;
295 if (!names.empty()) {
296 CHECK_EQ(num_vars, names.size());
297 for (
const std::string&
name : names) {
298 c_names_data.push_back(
const_cast<char*
>(
name.c_str()));
300 c_names = c_names_data.data();
304 const_cast<int*
>(vbegin.data()),
305 const_cast<int*
>(vind.data()),
306 const_cast<double*
>(vval.data()),
308 const_cast<double*
>(lb.data()),
309 const_cast<double*
>(ub.data()),
310 const_cast<char*
>(vtype.data()),
316 GRBdelvars(gurobi_model_, ind.size(),
const_cast<int*
>(ind.data())));
320 const std::string&
name) {
325 const absl::Span<const double> cval,
326 const char sense,
const double rhs,
327 const std::string&
name) {
328 CHECK_EQ(cind.size(), cval.size());
329 const int numnz =
static_cast<int>(cind.size());
332 const_cast<int*
>(cind.data()),
333 const_cast<double*
>(cval.data()),
336 name.empty() ?
nullptr :
name.data()));
339absl::Status Gurobi::AddConstrs(
const absl::Span<const char> sense,
340 const absl::Span<const double> rhs,
341 const absl::Span<const std::string> names) {
342 const int num_cons =
static_cast<int>(sense.size());
343 CHECK_EQ(rhs.size(), num_cons);
344 char** c_names =
nullptr;
345 std::vector<char*> c_names_data;
346 if (!names.empty()) {
347 CHECK_EQ(num_cons, names.size());
348 for (
const std::string&
name : names) {
349 c_names_data.push_back(
const_cast<char*
>(
name.c_str()));
351 c_names = c_names_data.data();
357 nullptr,
const_cast<char*
>(sense.data()),
358 const_cast<double*
>(rhs.data()), c_names));
363 GRBdelconstrs(gurobi_model_, ind.size(),
const_cast<int*
>(ind.data())));
367 const absl::Span<const int> qcol,
368 const absl::Span<const double> qval) {
369 const int numqnz =
static_cast<int>(qrow.size());
370 CHECK_EQ(qcol.size(), numqnz);
371 CHECK_EQ(qval.size(), numqnz);
373 gurobi_model_, numqnz,
const_cast<int*
>(qcol.data()),
374 const_cast<int*
>(qrow.data()),
const_cast<double*
>(qval.data())));
380 const double weight,
const double abs_tol,
381 const double rel_tol,
382 const std::string&
name,
383 const double constant,
384 const absl::Span<const int> lind,
385 const absl::Span<const double> lval) {
386 const int numlnz =
static_cast<int>(lind.size());
387 CHECK_EQ(lval.size(), numlnz);
395 const_cast<char*
>(
name.c_str()),
398 const_cast<int*
>(lind.data()),
399 const_cast<double*
>(lval.data())));
403 const absl::Span<const double> lval,
404 const absl::Span<const int> qrow,
405 const absl::Span<const int> qcol,
406 const absl::Span<const double> qval,
407 const char sense,
const double rhs,
408 const std::string&
name) {
409 const int numlnz =
static_cast<int>(lind.size());
410 CHECK_EQ(lval.size(), numlnz);
412 const int numqlnz =
static_cast<int>(qrow.size());
413 CHECK_EQ(qcol.size(), numqlnz);
414 CHECK_EQ(qval.size(), numqlnz);
419 const_cast<int*
>(lind.data()),
420 const_cast<double*
>(lval.data()),
422 const_cast<int*
>(qrow.data()),
423 const_cast<int*
>(qcol.data()),
424 const_cast<double*
>(qval.data()),
427 const_cast<char*
>(
name.c_str())));
432 const_cast<int*
>(ind.data())));
436 const absl::Span<const int> beg,
437 const absl::Span<const int> ind,
438 const absl::Span<const double>
weight) {
439 const int num_sos =
static_cast<int>(types.size());
440 CHECK_EQ(beg.size(), num_sos);
442 const int num_members =
static_cast<int>(ind.size());
443 CHECK_EQ(
weight.size(), num_members);
447 const_cast<int*
>(types.data()),
448 const_cast<int*
>(beg.data()),
449 const_cast<int*
>(ind.data()),
450 const_cast<double*
>(
weight.data())));
455 const_cast<int*
>(ind.data())));
460 const absl::Span<const int> ind,
461 const absl::Span<const double> val,
462 const char sense,
const double rhs) {
463 const int nvars =
static_cast<int>(ind.size());
464 CHECK_EQ(val.size(), nvars);
466 gurobi_model_,
const_cast<char*
>(
name.c_str()),
467 binvar, binval, nvars,
468 const_cast<int*
>(ind.data()),
469 const_cast<double*
>(val.data()), sense, rhs));
474 const_cast<int*
>(ind.data())));
478 const absl::Span<const int> vind,
479 const absl::Span<const double> val) {
480 const int num_changes =
static_cast<int>(cind.size());
481 CHECK_EQ(vind.size(), num_changes);
482 CHECK_EQ(val.size(), num_changes);
484 gurobi_model_, num_changes,
const_cast<int*
>(cind.data()),
485 const_cast<int*
>(vind.data()),
const_cast<double*
>(val.data())));
491 nullptr, first_var, num_vars)));
496 const absl::Span<int> vind,
497 const absl::Span<double> vval,
const int first_var,
498 const int num_vars) {
499 CHECK_EQ(vbegin.size(), num_vars);
500 CHECK_EQ(vind.size(), vval.size());
504 vval.data(), first_var, num_vars)));
505 CHECK_EQ(nnz, vind.size());
506 return absl::OkStatus();
510 const int num_vars) {
513 result.
begins.resize(num_vars);
514 result.
inds.resize(nnz);
515 result.
vals.resize(nnz);
519 result.
inds.data(), result.
vals.data(), first_var, num_vars)));
520 CHECK_EQ(read_nnz, nnz);
529 ASSIGN_OR_RETURN(
const auto scope, ScopedCallback::New(
this, std::move(cb)));
533 return scope->Release();
537 ASSIGN_OR_RETURN(
const auto scope, ScopedCallback::New(
this, std::move(cb)));
543 }
else if (error == kGrbOk) {
555 return scope->Release();
565 <<
"Error getting Gurobi int attribute: " <<
name;
572 <<
"Error getting Gurobi double attribute: " <<
name;
577 const char*
const name)
const {
580 char* result =
nullptr;
582 <<
"Error getting Gurobi string attribute: " <<
name;
583 if (result ==
nullptr) {
584 return std::string();
586 return std::string(result);
590 const std::string&
value) {
599 const double value) {
604 const absl::Span<const int> new_values) {
606 const_cast<int*
>(new_values.data())));
610 const char*
const name,
const absl::Span<const double> new_values) {
612 const_cast<double*
>(new_values.data())));
616 const absl::Span<const char> new_values) {
618 const_cast<char*
>(new_values.data())));
622 const absl::Span<int> attr_out)
const {
624 gurobi_model_,
name, 0, attr_out.size(), attr_out.data())))
625 <<
"Error getting Gurobi int array attribute: " <<
name;
626 return absl::OkStatus();
630 const int len)
const {
631 std::vector<int> result(len);
637 const char*
const name,
const absl::Span<double> attr_out)
const {
639 gurobi_model_,
name, 0, attr_out.size(), attr_out.data())))
640 <<
"Error getting Gurobi double array attribute: " <<
name;
641 return absl::OkStatus();
645 const char*
const name,
const int len)
const {
646 std::vector<double> result(len);
652 const absl::Span<char> attr_out)
const {
654 gurobi_model_,
name, 0, attr_out.size(), attr_out.data())))
655 <<
"Error getting Gurobi char array attribute: " <<
name;
656 return absl::OkStatus();
660 const char*
const name,
const int len)
const {
661 std::vector<char> result(len);
667 const absl::Span<const int> ind,
668 const absl::Span<const int> new_values) {
669 const int len =
static_cast<int>(ind.size());
670 CHECK_EQ(new_values.size(), len);
672 const_cast<int*
>(ind.data()),
673 const_cast<int*
>(new_values.data())));
677 const char*
const name,
const absl::Span<const int> ind,
678 const absl::Span<const double> new_values) {
679 const int len =
static_cast<int>(ind.size());
680 CHECK_EQ(new_values.size(), len);
682 const_cast<int*
>(ind.data()),
683 const_cast<double*
>(new_values.data())));
687 const absl::Span<const int> ind,
688 const absl::Span<const char> new_values) {
689 const int len =
static_cast<int>(ind.size());
690 CHECK_EQ(new_values.size(), len);
692 const_cast<int*
>(ind.data()),
693 const_cast<char*
>(new_values.data())));
697 const int element)
const {
705 const int element,
const int new_value) {
711 const int element)
const {
725 const int element)
const {
734 const char new_value) {
740 const std::string&
value) {
749 const double value) {
754 const std::string&
value) {
773 return std::string(result.data());
783 void*
const cb_data,
const int where)
784 : gurobi_(ABSL_DIE_IF_NULL(
gurobi)), cb_data_(cb_data), where_(
where) {}
789 GRBcbget(cb_data_, where_, what,
static_cast<void*
>(&result))));
794 const int what)
const {
797 GRBcbget(cb_data_, where_, what,
static_cast<void*
>(&result))));
802 const int what,
const absl::Span<double> result)
const {
803 return gurobi_->ToStatus(
804 GRBcbget(cb_data_, where_, what,
static_cast<void*
>(result.data())));
808 char* result =
nullptr;
811 if (result ==
nullptr) {
812 return std::string();
814 return std::string(result);
818 const absl::Span<const int> cutind,
const absl::Span<const double> cutval,
819 const char cutsense,
const double cutrhs)
const {
820 const int cut_len =
static_cast<int>(cutind.size());
821 CHECK_EQ(cutval.size(), cut_len);
822 return gurobi_->ToStatus(
823 GRBcbcut(cb_data_, cut_len,
const_cast<int*
>(cutind.data()),
824 const_cast<double*
>(cutval.data()), cutsense, cutrhs));
828 const absl::Span<const int> lazyind,
const absl::Span<const double> lazyval,
829 const char lazysense,
const double lazyrhs)
const {
830 const int lazy_len =
static_cast<int>(lazyind.size());
831 CHECK_EQ(lazyval.size(), lazy_len);
832 return gurobi_->ToStatus(
833 GRBcblazy(cb_data_, lazy_len,
const_cast<int*
>(lazyind.data()),
834 const_cast<double*
>(lazyval.data()), lazysense, lazyrhs));
838 const absl::Span<const double>
solution)
const {
#define ASSIGN_OR_RETURN(lhs, rexpr)
#define RETURN_IF_ERROR(expr)
absl::StatusOr< std::string > CbGetMessage() const
Calls GRBcbget() where what=MSG_STRING (call only at where=MESSAGE).
absl::Status CbLazy(absl::Span< const int > lazyind, absl::Span< const double > lazyval, char lazysense, double lazyrhs) const
Calls GRBcblazy().
CallbackContext(Gurobi *gurobi, void *cb_data, int where)
For internal use only.
absl::StatusOr< double > CbGetDouble(int what) const
absl::Status CbCut(absl::Span< const int > cutind, absl::Span< const double > cutval, char cutsense, double cutrhs) const
Calls GRBcbcut().
absl::StatusOr< double > CbSolution(absl::Span< const double > solution) const
Calls GRBcbsolution().
absl::Status CbGetDoubleArray(int what, absl::Span< double > result) const
absl::StatusOr< int > CbGetInt(int what) const
absl::Status AddIndicator(const std::string &name, int binvar, int binval, absl::Span< const int > ind, absl::Span< const double > val, char sense, double rhs)
absl::Status GetIntAttrArray(const char *name, absl::Span< int > attr_out) const
absl::Status ToStatus(int grb_err, absl::StatusCode code=absl::StatusCode::kInvalidArgument, absl::SourceLocation loc=absl::SourceLocation::current()) const
absl::Status DelGenConstrs(absl::Span< const int > ind)
absl::Status SetDoubleAttrElement(const char *name, int element, double new_value)
static absl::StatusOr< std::unique_ptr< Gurobi > > NewWithSharedPrimaryEnv(GRBenv *primary_env)
absl::StatusOr< bool > ComputeIIS(Callback cb=nullptr)
absl::Status AddVar(double obj, double lb, double ub, char vtype, const std::string &name)
Calls GRBaddvar() to add a variable to the model.
bool IsAttrAvailable(const char *name) const
absl::StatusOr< char > GetCharAttrElement(const char *name, int element) const
absl::Status SetIntAttrElement(const char *name, int element, int new_value)
absl::Status SetCharAttrArray(const char *name, absl::Span< const char > new_values)
absl::Status SetDoubleAttrArray(const char *name, absl::Span< const double > new_values)
absl::StatusOr< int > GetIntAttr(const char *name) const
absl::Status SetStringParam(const char *name, const std::string &value)
Calls GRBsetstrparam().
absl::Status DelSos(absl::Span< const int > ind)
absl::StatusOr< int > GetNnz(int first_var, int num_vars)
absl::Status SetDoubleAttrList(const char *name, absl::Span< const int > ind, absl::Span< const double > new_values)
absl::Status AddSos(absl::Span< const int > types, absl::Span< const int > beg, absl::Span< const int > ind, absl::Span< const double > weight)
absl::Status SetIntAttr(const char *attr_name, int value)
absl::Status AddConstr(char sense, double rhs, const std::string &name)
absl::Status SetParam(const char *name, const std::string &value)
absl::Status SetStringAttr(const char *attr_name, const std::string &value)
std::function< absl::Status(const CallbackContext &)> Callback
absl::Status GetVars(absl::Span< int > vbegin, absl::Span< int > vind, absl::Span< double > vval, int first_var, int num_vars)
absl::Status ChgCoeffs(absl::Span< const int > cind, absl::Span< const int > vind, absl::Span< const double > val)
void Terminate()
Calls GRBterminate().
static absl::StatusOr< std::unique_ptr< Gurobi > > New(GRBenvUniquePtr primary_env=nullptr)
GRBmodel * model() const
Typically not needed.
absl::Status Optimize(Callback cb=nullptr)
absl::Status GetCharAttrArray(const char *name, absl::Span< char > attr_out) const
absl::StatusOr< double > GetDoubleAttrElement(const char *name, int element) const
absl::StatusOr< double > GetDoubleAttr(const char *name) const
absl::Status SetCharAttrElement(const char *name, int element, char new_value)
absl::Status SetIntParam(const char *name, int value)
Calls GRBsetintparam().
absl::StatusOr< std::string > GetStringAttr(const char *name) const
absl::Status SetIntAttrArray(const char *name, absl::Span< const int > new_values)
absl::StatusOr< int > GetIntParam(const char *name)
Calls GRBgetintparam().
absl::StatusOr< int > GetIntAttrElement(const char *name, int element) const
absl::Status AddQpTerms(absl::Span< const int > qrow, absl::Span< const int > qcol, absl::Span< const double > qval)
absl::Status SetDoubleParam(const char *name, double value)
Calls GRBsetdblparam().
absl::StatusOr< double > GetDoubleParam(const char *name)
Calls GRBgetdblparam().
absl::Status SetNthObjective(int index, int priority, double weight, double abs_tol, double rel_tol, const std::string &name, double constant, absl::Span< const int > lind, absl::Span< const double > lval)
absl::Status GetDoubleAttrArray(const char *name, absl::Span< double > attr_out) const
absl::Status ResetParameters()
Calls GRBresetparams().
absl::Status UpdateModel()
Calls GRBupdatemodel().
absl::Status SetDoubleAttr(const char *attr_name, double value)
absl::StatusOr< std::string > GetStringParam(const char *name)
Calls GRBgetstrparam().
absl::Status DelQConstrs(absl::Span< const int > ind)
absl::Status AddQConstr(absl::Span< const int > lind, absl::Span< const double > lval, absl::Span< const int > qrow, absl::Span< const int > qcol, absl::Span< const double > qval, char sense, double rhs, const std::string &name)
have size equal to the number of new be empty(all new constraints have name ""). absl absl::Status DelConstrs(absl::Span< const int > ind)
Calls GRBdelconstrs().
absl::Status SetIntAttrList(const char *name, absl::Span< const int > ind, absl::Span< const int > new_values)
absl::Status SetCharAttrList(const char *name, absl::Span< const int > ind, absl::Span< const char > new_values)
have size equal to the number of new be be empty(all new variables have name ""). absl have size equal to the number of new be be empty(all new variables have name ""). absl absl::Status DelVars(absl::Span< const int > ind)
Calls GRBdelvars().
const std::string name
A name for logging purposes.
#define GRB_ERROR_CALLBACK
#define GRB_CB_MSG_STRING
struct _GRBmodel GRBmodel
#define GRB_ERROR_IIS_NOT_INFEASIBLE
#define GRB_INT_ATTR_IIS_MINIMAL
GurobiMPCallbackContext * context
An object oriented wrapper for quadratic constraints in ModelStorage.
absl::StatusOr< GRBenvUniquePtr > GurobiNewPrimaryEnv(const std::optional< GurobiIsvKey > &isv_key)
std::unique_ptr< GRBenv, GurobiFreeEnv > GRBenvUniquePtr
absl::StatusOr< GRBenv * > NewPrimaryEnvFromISVKey(const GurobiIsvKey &isv_key)
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(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
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
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(GRBmodel *model, const char *attrname, int first, int len, double *newvalues)> GRBsetdblattrarray
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
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< int(GRBmodel *model, int len, int *ind)> GRBdelconstrs
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(GRBenv *env, const char *paramname, int *valueP)> GRBgetintparam
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< char *(void)> GRBplatform
std::function< int(GRBmodel *model, int numsos, int nummembers, int *types, int *beg, int *ind, double *weight)> GRBaddsos
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
StatusBuilder InvalidArgumentErrorBuilder()
void operator()(GRBenv *env) const
std::vector< double > vals
std::vector< int > begins