![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
#include <g_gurobi.h>
Classes | |
class | CallbackContext |
struct | SparseMat |
Public Types | |
using | Callback = std::function<absl::Status(const CallbackContext&)> |
Public Member Functions | |
~Gurobi () | |
absl::Status | AddVar (double obj, double lb, double ub, char vtype, const std::string &name) |
Calls GRBaddvar() to add a variable to the model. | |
absl::Status | AddVar (absl::Span< const int > vind, absl::Span< const double > vval, double obj, double lb, double ub, char vtype, const std::string &name) |
have size equal to the number of new be | empty (all new variables have objective coefficient 0). - have size equal to the number of new variables |
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 | empty (all new variables have objective coefficient 0). - have size equal to the number of new variables |
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(). | |
absl::Status | AddConstr (char sense, double rhs, const std::string &name) |
absl::Status | AddConstr (absl::Span< const int > cind, absl::Span< const double > cval, 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 | ChgCoeffs (absl::Span< const int > cind, absl::Span< const int > vind, absl::Span< const double > val) |
absl::Status | AddQpTerms (absl::Span< const int > qrow, absl::Span< const int > qcol, absl::Span< const double > qval) |
absl::Status | DelQ () |
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 | 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) |
absl::Status | DelQConstrs (absl::Span< const int > ind) |
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 | DelSos (absl::Span< const int > ind) |
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 | DelGenConstrs (absl::Span< const int > ind) |
absl::StatusOr< int > | GetNnz (int first_var, int num_vars) |
absl::Status | GetVars (absl::Span< int > vbegin, absl::Span< int > vind, absl::Span< double > vval, int first_var, int num_vars) |
absl::StatusOr< SparseMat > | GetVars (int first_var, int num_vars) |
absl::Status | UpdateModel () |
Calls GRBupdatemodel(). | |
absl::Status | Optimize (Callback cb=nullptr) |
void | Terminate () |
Calls GRBterminate(). | |
absl::StatusOr< bool > | ComputeIIS (Callback cb=nullptr) |
bool | IsAttrAvailable (const char *name) const |
absl::StatusOr< int > | GetIntAttr (const char *name) const |
absl::Status | SetIntAttr (const char *attr_name, int value) |
absl::StatusOr< double > | GetDoubleAttr (const char *name) const |
absl::Status | SetDoubleAttr (const char *attr_name, double value) |
absl::StatusOr< std::string > | GetStringAttr (const char *name) const |
absl::Status | SetStringAttr (const char *attr_name, const std::string &value) |
absl::Status | GetIntAttrArray (const char *name, absl::Span< int > attr_out) const |
absl::StatusOr< std::vector< int > > | GetIntAttrArray (const char *name, int len) const |
absl::Status | SetIntAttrArray (const char *name, absl::Span< const int > new_values) |
absl::Status | SetIntAttrList (const char *name, absl::Span< const int > ind, absl::Span< const int > new_values) |
absl::Status | GetDoubleAttrArray (const char *name, absl::Span< double > attr_out) const |
absl::StatusOr< std::vector< double > > | GetDoubleAttrArray (const char *name, int len) const |
absl::Status | SetDoubleAttrArray (const char *name, absl::Span< const double > new_values) |
absl::Status | SetDoubleAttrList (const char *name, absl::Span< const int > ind, absl::Span< const double > new_values) |
absl::Status | GetCharAttrArray (const char *name, absl::Span< char > attr_out) const |
absl::StatusOr< std::vector< char > > | GetCharAttrArray (const char *name, int len) const |
absl::Status | SetCharAttrArray (const char *name, absl::Span< const char > new_values) |
absl::Status | SetCharAttrList (const char *name, absl::Span< const int > ind, absl::Span< const char > new_values) |
absl::StatusOr< int > | GetIntAttrElement (const char *name, int element) const |
absl::Status | SetIntAttrElement (const char *name, int element, int new_value) |
absl::StatusOr< double > | GetDoubleAttrElement (const char *name, int element) const |
absl::Status | SetDoubleAttrElement (const char *name, int element, double new_value) |
absl::StatusOr< char > | GetCharAttrElement (const char *name, int element) const |
absl::Status | SetCharAttrElement (const char *name, int element, char new_value) |
absl::Status | SetParam (const char *name, const std::string &value) |
absl::Status | SetIntParam (const char *name, int value) |
Calls GRBsetintparam(). | |
absl::Status | SetDoubleParam (const char *name, double value) |
Calls GRBsetdblparam(). | |
absl::Status | SetStringParam (const char *name, const std::string &value) |
Calls GRBsetstrparam(). | |
absl::StatusOr< int > | GetIntParam (const char *name) |
Calls GRBgetintparam(). | |
absl::StatusOr< double > | GetDoubleParam (const char *name) |
Calls GRBgetdblparam(). | |
absl::StatusOr< std::string > | GetStringParam (const char *name) |
Calls GRBgetstrparam(). | |
absl::Status | ResetParameters () |
Calls GRBresetparams(). | |
absl::Status | SetMultiObjectiveDoubleParam (const char *name, int obj_index, double value) |
absl::StatusOr< double > | GetMultiObjectiveDoubleParam (const char *name, int obj_index) |
GRBmodel * | model () const |
Typically not needed. | |
absl::Status | ToStatus (int grb_err, absl::StatusCode code=absl::StatusCode::kInvalidArgument, absl::SourceLocation loc=absl::SourceLocation::current()) const |
Static Public Member Functions | |
static absl::StatusOr< std::unique_ptr< Gurobi > > | New (GRBenvUniquePtr primary_env=nullptr) |
static absl::StatusOr< std::unique_ptr< Gurobi > > | NewWithSharedPrimaryEnv (GRBenv *primary_env) |
Public Attributes | |
have size equal to the number of new | variables |
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 | variables |
have size equal to the number of new | constraints |
Models and solves optimization problems with Gurobi.
This is a thin wrapper on the Gurobi C API, holding a GRBmodel, associated GRBenv that GRBnewmodel creates, and optionally the primary environment to clean up on deletion.
Throughout, we refer to the child GRBenv created by GRBnewmodel as the "model environment" while the GRBenv that was used to create the model as the "primary environment", for details see: https://www.gurobi.com/documentation/9.1/refman/c_newmodel.html Attributes Most properties of a Gurobi optimization model are set and read with attributes, using the attribute names defined in the Gurobi C API. There are scalar attributes returning a single value of the following types:
You set a scalar attribute with the methods SetXXXAttr, e.g. std::unique_ptr<Gurobi> gurobi = Gurobi::New().value(); absl::Status s = gurobi->SetIntAttr(GRB_INT_ATTR_MODELSENSE, 1);
Attributes can also be read. However, attributes can be unavailable depending on the context, e.g. the solution objective value is not available before solving. You can determine when an attribute is available either from the Gurobi documentation or by directly testing: std::unique_ptr<Gurobi> gurobi = Gurobi::New().value(); bool is_avail = gurobi->IsAttrAvailable(GRB_DBL_ATTR_OBJVAL); To read an attribute: std::unique_ptr<Gurobi> gurobi = Gurobi::New().value(); absl::StatusOr<double> obj = gurobi->GetDoubleAttr(GRB_DBL_ATTR_OBJVAL); (The method should succeed when IsAttrAvailable() is true and you have specified the type of attribute correctly.)
Array attributes are similar, but the API differs slightly. E.g. to set the first three variable lower bounds to 1.0: std::unique_ptr<Gurobi> gurobi = Gurobi::New().value(); absl::Status s = gurobi->SetDoubleAttrArray(GRB_DBL_ATTR_LB, {1, 1, 1}); You can also set specific indices, see SetDoubleAttrList. To read, use: Gurobi* gurobi = ...; int num_vars = ...; absl::StatusOr<std::vector<double>> lbs = gurobi->GetDoubleAttrArray(GRB_DBL_ATTR_LB, num_vars); An overload to write the result into an absl::Span is also provided.
Definition at line 149 of file g_gurobi.h.
using operations_research::math_opt::Gurobi::Callback = std::function<absl::Status(const CallbackContext&)> |
Invoked regularly by Gurobi while solving if provided as an argument to Gurobi::Optimize(). If the user returns a status error in the callback:
Definition at line 222 of file g_gurobi.h.
operations_research::math_opt::Gurobi::~Gurobi | ( | ) |
Definition at line 227 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddConstr | ( | absl::Span< const int > | cind, |
absl::Span< const double > | cval, | ||
char | sense, | ||
double | rhs, | ||
const std::string & | name ) |
Calls GRBaddconstr() to add a constraint to the model.
The inputs cind and cval must have the same size.
Definition at line 326 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddConstr | ( | char | sense, |
double | rhs, | ||
const std::string & | name ) |
Calls GRBaddconstr() to add a constraint to the model.
This overload does not add any variable coefficients to the constraint.
Definition at line 321 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddIndicator | ( | const std::string & | name, |
int | binvar, | ||
int | binval, | ||
absl::Span< const int > | ind, | ||
absl::Span< const double > | val, | ||
char | sense, | ||
double | rhs ) |
Calls GRBaddgenconstrIndicator().
ind and val must be of equal length.
Definition at line 460 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::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 ) |
Calls GRBaddqconstr().
Requirements:
Definition at line 404 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddQpTerms | ( | absl::Span< const int > | qrow, |
absl::Span< const int > | qcol, | ||
absl::Span< const double > | qval ) |
Calls GRBaddqpterms().
Requirements:
Definition at line 368 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddSos | ( | absl::Span< const int > | types, |
absl::Span< const int > | beg, | ||
absl::Span< const int > | ind, | ||
absl::Span< const double > | weight ) |
Calls GRBaddsos().
This adds SOS constraints to the model. You may specify multiple SOS constraints at once, and may mix the types (SOS1 and SOS2) in a single call. The data is specified in CSR format, meaning that the entries of beg indicate the contiguous subranges of ind and weight associated with a particular SOS constraint. Please see the Gurobi documentation for more detail (https://www.gurobi.com/documentation/9.5/refman/c_addsos.html).
Requirements:
Definition at line 437 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddVar | ( | absl::Span< const int > | vind, |
absl::Span< const double > | vval, | ||
double | obj, | ||
double | lb, | ||
double | ub, | ||
char | vtype, | ||
const std::string & | name ) |
Calls GRBaddvar() to add a variable and linear constraint column to the model.
The inputs vind and vval must have the same size. Both can be empty if you do not want to modify the constraint matrix, though this is equivalent to the simpler overload above.
Definition at line 251 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::AddVar | ( | double | obj, |
double | lb, | ||
double | ub, | ||
char | vtype, | ||
const std::string & | name ) |
Calls GRBaddvar() to add a variable to the model.
Model Building
Definition at line 246 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::ChgCoeffs | ( | absl::Span< const int > | cind, |
absl::Span< const int > | vind, | ||
absl::Span< const double > | val ) |
Calls GRBchgcoeffs().
Requirements:
Definition at line 479 of file g_gurobi.cc.
absl::StatusOr< bool > operations_research::math_opt::Gurobi::ComputeIIS | ( | Callback | cb = nullptr | ) |
Calls GRBcomputeIIS().
Returns:
The callback, if specified, is set before solving and cleared after.
If Gurobi v11 terminates at a limit before determining if the model is feasible or not, it will return an OK error code but then will fail to return anything about the IIS it does not have. To detect this case, we query the minimality attribute: we know that our env is valid at this point, and this should fail iff an IIS is present, i.e., Gurobi proved that the model was infeasible.
Definition at line 538 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::DelConstrs | ( | absl::Span< const int > | ind | ) |
Calls GRBdelconstrs().
Definition at line 363 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::DelGenConstrs | ( | absl::Span< const int > | ind | ) |
Calls GRBdelgenconstrs().
Deletes the specified general constraints.
Definition at line 474 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::DelQ | ( | ) |
Calls GRBdelq().
Deletes all quadratic objective coefficients.
Definition at line 379 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::DelQConstrs | ( | absl::Span< const int > | ind | ) |
Calls GRBdelqconstrs().
Deletes the specified quadratic constraints.
Definition at line 432 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::DelSos | ( | absl::Span< const int > | ind | ) |
Calls GRBdelsos().
Deletes the specified SOS constraints.
Definition at line 455 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::DelVars | ( | absl::Span< const int > | ind | ) |
Calls GRBdelvars().
Definition at line 316 of file g_gurobi.cc.
|
new |
|
new |
absl::Status operations_research::math_opt::Gurobi::GetCharAttrArray | ( | const char * | name, |
absl::Span< char > | attr_out ) const |
Definition at line 653 of file g_gurobi.cc.
absl::StatusOr< std::vector< char > > operations_research::math_opt::Gurobi::GetCharAttrArray | ( | const char * | name, |
int | len ) const |
Definition at line 661 of file g_gurobi.cc.
absl::StatusOr< char > operations_research::math_opt::Gurobi::GetCharAttrElement | ( | const char * | name, |
int | element ) const |
Definition at line 726 of file g_gurobi.cc.
absl::StatusOr< double > operations_research::math_opt::Gurobi::GetDoubleAttr | ( | const char * | name | ) | const |
Definition at line 571 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::GetDoubleAttrArray | ( | const char * | name, |
absl::Span< double > | attr_out ) const |
Definition at line 638 of file g_gurobi.cc.
absl::StatusOr< std::vector< double > > operations_research::math_opt::Gurobi::GetDoubleAttrArray | ( | const char * | name, |
int | len ) const |
Definition at line 646 of file g_gurobi.cc.
absl::StatusOr< double > operations_research::math_opt::Gurobi::GetDoubleAttrElement | ( | const char * | name, |
int | element ) const |
Definition at line 712 of file g_gurobi.cc.
absl::StatusOr< double > operations_research::math_opt::Gurobi::GetDoubleParam | ( | const char * | name | ) |
Calls GRBgetdblparam().
Definition at line 766 of file g_gurobi.cc.
absl::StatusOr< int > operations_research::math_opt::Gurobi::GetIntAttr | ( | const char * | name | ) | const |
Definition at line 564 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::GetIntAttrArray | ( | const char * | name, |
absl::Span< int > | attr_out ) const |
Definition at line 623 of file g_gurobi.cc.
absl::StatusOr< std::vector< int > > operations_research::math_opt::Gurobi::GetIntAttrArray | ( | const char * | name, |
int | len ) const |
Definition at line 631 of file g_gurobi.cc.
absl::StatusOr< int > operations_research::math_opt::Gurobi::GetIntAttrElement | ( | const char * | name, |
int | element ) const |
Definition at line 698 of file g_gurobi.cc.
absl::StatusOr< int > operations_research::math_opt::Gurobi::GetIntParam | ( | const char * | name | ) |
Calls GRBgetintparam().
Definition at line 760 of file g_gurobi.cc.
absl::StatusOr< double > operations_research::math_opt::Gurobi::GetMultiObjectiveDoubleParam | ( | const char * | name, |
int | obj_index ) |
Calls GRBgetdblparam() on the environment associated with the obj_index-th objective.
Definition at line 790 of file g_gurobi.cc.
absl::StatusOr< int > operations_research::math_opt::Gurobi::GetNnz | ( | int | first_var, |
int | num_vars ) |
Linear constraint matrix queries. Calls GRBgetvars().
The number of nonzeros in the constraint matrix for the num_vars columns starting with first_var.
Definition at line 490 of file g_gurobi.cc.
absl::StatusOr< std::string > operations_research::math_opt::Gurobi::GetStringAttr | ( | const char * | name | ) | const |
Definition at line 578 of file g_gurobi.cc.
absl::StatusOr< std::string > operations_research::math_opt::Gurobi::GetStringParam | ( | const char * | name | ) |
Calls GRBgetstrparam().
Definition at line 772 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::GetVars | ( | absl::Span< int > | vbegin, |
absl::Span< int > | vind, | ||
absl::Span< double > | vval, | ||
int | first_var, | ||
int | num_vars ) |
Calls GRBgetvars().
Write the nonzeros of the constraint matrix for the num_vars columns starting with first_var out in CSC format to (vbegin, vind, vval).
The user is responsible for ensuring that the output Spans are exactly the correct size. See the other GetVars() overload for a simpler version.
Definition at line 497 of file g_gurobi.cc.
absl::StatusOr< Gurobi::SparseMat > operations_research::math_opt::Gurobi::GetVars | ( | int | first_var, |
int | num_vars ) |
Calls GRBgetvars().
Returns the nonzeros of the constraint matrix for the num_vars columns starting with first_var out in CSC format.
Definition at line 511 of file g_gurobi.cc.
bool operations_research::math_opt::Gurobi::IsAttrAvailable | ( | const char * | name | ) | const |
Attributes
Definition at line 560 of file g_gurobi.cc.
|
inline |
Typically not needed.
Definition at line 590 of file g_gurobi.h.
|
static |
Creates a new Gurobi, taking ownership of primary_env if provided (if no environment is given, a new one is created internally from the license file).
Definition at line 183 of file g_gurobi.cc.
|
static |
Creates a new Gurobi using an existing GRBenv, where primary_env cannot be nullptr. Unlike Gurobi::New(), the returned Gurobi will not clean up the primary environment on destruction.
A GurobiEnv can be shared between models with the following restrictions:
Definition at line 177 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::Optimize | ( | Callback | cb = nullptr | ) |
Calls GRBoptimize().
The callback, if specified, is set before solving and cleared after.
Definition at line 530 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::ResetParameters | ( | ) |
Calls GRBresetparams().
Definition at line 778 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetCharAttrArray | ( | const char * | name, |
absl::Span< const char > | new_values ) |
Definition at line 617 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetCharAttrElement | ( | const char * | name, |
int | element, | ||
char | new_value ) |
Definition at line 734 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetCharAttrList | ( | const char * | name, |
absl::Span< const int > | ind, | ||
absl::Span< const char > | new_values ) |
Definition at line 688 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetDoubleAttr | ( | const char * | attr_name, |
double | value ) |
Definition at line 600 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetDoubleAttrArray | ( | const char * | name, |
absl::Span< const double > | new_values ) |
Definition at line 611 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetDoubleAttrElement | ( | const char * | name, |
int | element, | ||
double | new_value ) |
Definition at line 720 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetDoubleAttrList | ( | const char * | name, |
absl::Span< const int > | ind, | ||
absl::Span< const double > | new_values ) |
Definition at line 678 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetDoubleParam | ( | const char * | name, |
double | value ) |
Calls GRBsetdblparam().
Definition at line 750 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetIntAttr | ( | const char * | attr_name, |
int | value ) |
Definition at line 596 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetIntAttrArray | ( | const char * | name, |
absl::Span< const int > | new_values ) |
Definition at line 605 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetIntAttrElement | ( | const char * | name, |
int | element, | ||
int | new_value ) |
Definition at line 706 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetIntAttrList | ( | const char * | name, |
absl::Span< const int > | ind, | ||
absl::Span< const int > | new_values ) |
Definition at line 668 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetIntParam | ( | const char * | name, |
int | value ) |
Calls GRBsetintparam().
Definition at line 746 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetMultiObjectiveDoubleParam | ( | const char * | name, |
int | obj_index, | ||
double | value ) |
Multi-objective Parameters Calls GRBsetdblparam() on the environment associated with the obj_index-th objective.
Definition at line 782 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::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 ) |
Calls GRBsetobjectiven().
Sets the n-th objective in a multi-objective model.
Requirement:
Definition at line 381 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetParam | ( | const char * | name, |
const std::string & | value ) |
Parameters Calls GRBsetparam().
Prefer the typed versions (e.g. SetIntParam()) defined below.
Definition at line 741 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetStringAttr | ( | const char * | attr_name, |
const std::string & | value ) |
Definition at line 591 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::SetStringParam | ( | const char * | name, |
const std::string & | value ) |
Calls GRBsetstrparam().
Definition at line 755 of file g_gurobi.cc.
void operations_research::math_opt::Gurobi::Terminate | ( | ) |
Calls GRBterminate().
Definition at line 799 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::ToStatus | ( | int | grb_err, |
absl::StatusCode | code = absl::StatusCode::kInvalidArgument, | ||
absl::SourceLocation | loc = absl::SourceLocation::current() ) const |
Definition at line 235 of file g_gurobi.cc.
absl::Status operations_research::math_opt::Gurobi::UpdateModel | ( | ) |
have size equal to the number of new operations_research::math_opt::Gurobi::constraints |
Calls GRBaddconstrs().
Requirements:
Definition at line 327 of file g_gurobi.h.
have size equal to the number of new operations_research::math_opt::Gurobi::variables |
Calls GRBaddvars() to add variables to the model.
Requirements:
Definition at line 271 of file g_gurobi.h.
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 operations_research::math_opt::Gurobi::variables |
Calls GRBaddvars() to add variables and linear constraint columns to the model.
The new linear constraint matrix columns are given in CSC format (see SparseMat above for an example).
Requirements:
Definition at line 290 of file g_gurobi.h.