. . . . . . Example usage: obj = model.getObjective() print obj.getValue() LinExpr.getVar() getVar ( i ) Retrieve the variable object from a single term of the expression. . . . . You can still request that the optimization be terminated from any of the callbacks you receive. . . . . . . . . Return value: The value of the specified variable in the current solution vector. . minrelax: The type of feasibility relaxation to perform. . . double[] Get ( GRB.DoubleAttr attr, GRBVar[] vars, int start, int len ) 301, 302 If multiple variables have the same name, this method chooses one arbitrarily. len: The number of variables to add. . . . . Return value: The current value of the requested attribute. . . . . . . . . . Details on the error can be obtained by calling GRBgeterrormsg. 77 GRBsetintattrelement . . The clear method is mainly included for consistency with our interfaces to non-overloaded languages. . . . . . . . . . . . Return value: The current values of the requested attribute for each input variable. . Note that the solution that is computed for this model is automatically transformed into a solution for the original problem once barrier finishes (in a process often called uncrushing), but this uncrush step is transparent and produces no log output. . Example usage: double lb[NUMVARS]; error = GRBgetdblattrarray(model, "LB", 0, cols, lb); GRBsetdblattrarray int GRBsetdblattrarray ( GRBmodel *model, const char *attrname, int start, int len, double *values ) Set the values of a double-valued array attribute. . . . . . . . . For examples of how to query or modify parameter values from our different APIs, refer to our Parameter Examples. . . . GRBConstr[] getConstrs ( ) Return value: All linear constraints in the model. . One entry for each variable in argument vars. . . . . The attribute name can be passed to these routines as a string, or you can use the constants defined in the GRB.Attr class (e.g., GRB.Attr.rhs). . . . 174, 175 We also include an automated parameter tuning tool that explores many different sets of pa- rameter changes in order to find a set that improves performance. . . . . Return value: The current value of the requested attribute. If the objective is quadratic, the model is a Quadratic Program (QP). . . You can create concurrent environments to choose your own parameter settings (refer to the concurrent optimization section for details). . . GRBModel.AddRanges() Add new range constraints to a model. Return value: Variable with the specified name. The SOS section begins with the SOS header on its own line (capitalization isnt important). . . . . . . . . . . . 182, 183 . Return value: The current value of the requested attribute. Example usage: col = Column([1.0, 2.0], [c0, c1]) col.remove(c0) 421, 422 . . . . The corresponding OPB file for this example is given by * This is a dummy pseduo-boolean optimization model min: y - 1.3 x ~z + ~z; 2 y - 3 x + 1.7 w = 1.7; -1 y + x + x z ~v >= 0; -1 y, 552 Return value: Array of new constraint objects. . You can also type: gurobi_cl --help to get help on the use of the tool, or: gurobi_cl --version 565, 566 . . . . We should reiterate a point that is raised in the Quick Start Guide: you do not need a Gurobi license to run Gurobi Remote Services on a machine. Available Gurobi Parameters Termination: These parameters affect the termination of the algorithms. newvalue: Desired new value for parameter. . . . . . . . The attribute name can be passed to these routines as a string, or you can use the constants defined in the GRB.Attr class (e.g., GRB.Attr.lb). . A SOS constraint can be of type 1 or 2. . . . . . Once the baseline run is complete, the time for that run becomes the time to beat. . . . Distributed Worker Distributed Worker Manager/Distributed Worker Distributed Worker 583, 584 Note that you must create contiguously numbered concurrent environments, starting with num=0. . . Return value: A non-zero return value indicates that a problem occurred while optimizing the model. will discard the start. Constraints Section The next section is the constraints section. . . . . . 347, 348 . . An environment acts as the container for all data associated with a set of optimization runs. . . . 476 BoundVioIndex . For examples of how to query or modify attributes, refer to our Attribute Examples. 522 Quad . . . . . . 106 GRBterminate . . . . . . . 474 IISSOS . BoundSVio Type: double Modifiable: No Maximum (scaled) bound violation. . . attrname: The name of a string-valued array attribute. . . . . GRBQuadExpr GRBQuadExpr ( GRBQuadExpr orig ) Copy an existing quadratic expression. . . . vars: A three-dimensional array of variables whose attribute values are being queried. . . Important note: Note that this method should be used for scalar attributes only (i.e., model attributes). . . . . . . . . . . . . ImproveStartTime Type: double Default value: Infinity Solution improvement strategy control Minimum value: 0.0 Maximum value: Infinity The MIP solver can change parameter settings in the middle of the search in order to adopt a strategy that gives up on moving the best bound and instead devotes all of its effort towards finding better feasible solutions. . . If you pass an object of this subclass to method GRBModel.SetCallback before calling GRBModel.Optimize, the callback() method of the class will be called periodically. For examples of how to query or modify parameter values from our different APIs, refer to our Parameter Examples. If you run into a question or an issue and you would like to get help from Gurobi, your recording will allow Gurobi technical support to reproduce the exact results that you are seeing without requiring you to send your entire application. . . . . . . . . . . . . Note that this heuristic is only applied at the end of the MIP root, and only when no other root heuristic finds a feasible solution. Importing a priority order file is equivalent to replacing the BranchPriority attribute value for each variable in the model. . . . Other options are off (0), conservative (1), or aggressive (2). . . SOS constraint objects have one attribute, IISSOS, which can be queried with the SOS.getAttr method. . . . . . . Note that the name of the user data field must begin with an underscore. . len: The number of constraints. If more than one parameter matches, the matching names are listed and none are modified. . . . . . valueP (optional): The location in which the current value of the specified parameter should be placed. . . 350 GRBColumn.Remove() . . . . This isnt always strictly true for interior point solutions. . . You would refer to them using a GRB. . . Memory Management Users typically do not need to concern themselves with memory management in Java, since it is handled automatically by the garbage collector. . . . . . . . . . . . . . . . Distributed Worker Distributed Worker Manager Distributed Worker Distributed Worker Note that once the distributed algorithm completes, only the manager retains any information about the solution. . . . . . MIPGapAbs Type: double Default value: 1e-10 Absolute MIP optimality gap Minimum value: 0 Maximum value: Infinity The MIP solver will terminate (with an optimal result) when the absolute gap between the lower and upper objective bound is less than MIPGapAbs. start: The index of the first quadratic constraint of interest in the list. vars: A one-dimensional array of variables whose attribute values are being queried. Return value: New model object. numqnz: The number of new quadratic objective terms to add. . . Each linear or quadratic constraint has an associated sense (less-than- or-equal, greater-than-or-equal, or equal), and right-hand side value. This argument can be NULL, in which case the constraint is given a default name. . . Larger values for this attribute cause the constraint to be pulled into the model more aggres- sively. . . . . . . . The default variable branch priority value is zero. . . . . . . . By default, GRBoptimize() will use the concurrent optimizer to solve LP models, the barrier algorithm to solve QP and QCP models, and the branch-and-cut algorithm to solve mixed integer models. . Example usage: error = GRBsetintparam(GRBgetenv(model), "SolutionLimit", 5); GRBsetstrparam int GRBsetstrparam ( GRBenv *env, const char *paramname, const char *newvalue ) Modify the value of a string-valued parameter. . . maxP (optional): The location in which the maximum allowed value of the specified pa- rameter should be placed. . . . . . . . . var1: First variable for new quadratic term. . . . . . . . . . . . . Call this method with null values for x and y if you just want the number of points. . . When the optimization stops, the Status attribute will be equal to GRB.Status.INTERRUPTED. Arguments: model: The model to which the new SOSs should be added. Model.setParam() setParam ( paramname, newvalue ) Set the value of a parameter to a new value. . . . . . Return value: The current value of the requested attribute. . . attrname: The name of an integer-valued array attribute. . . . . . Note that if you use lazy constraints by setting the Lazy attribute (and not through a callback), theres no need to set this parameter. . . . . . . 5.11 GRBColumn Gurobi column object. . . To give an example, the statement l.select(1, *, 5) would select all member tuples whose first field is equal to 1 and whose third field is equal to 5. Arguments: constr: Constraint for coefficient to be changed. . . . . . . . rhs: Right-hand-side values for the new constraints. . 128 GRBModel::addVars() . . double get ( GRB.DoubleAttr attr ) Query the value of a double-valued model attribute. . . Arguments: attr: The attribute being queried. . . . . . . . . lb: Lower bound for the new variable. . . . . void remove ( GRBVar var ) Remove a variable from the model. . . . The third and fourth columns show the primal and dual objective values for the current solution. . . Solution Improvement The ImproveStartTime and ImproveStartGap parameters can also be used to modify your high- level solution strategy, but in a different way. This section is devoted to the configuration and administration of Gurobi Remote Services. . . . . . . However, further removing any one member of the IIS produces a feasible result. . Exceptions can be thrown by nearly every method in the Gurobi C++ API. . . . . . . You can ask the command-line tool to write a .ilp format file. . Solutions are sorted in order of worsening objective value. . . . . Return value: A non-zero return value indicates that a problem occurred while retrieving the coefficient. . . . . double[] Get ( GRB.DoubleAttr attr, GRBQConstr[] qconstrs ) Query a double-valued quadratic constraint attribute for an array of quadratic constraints. The full list of available attributes can be found in the Attributes section of this manual. . . . This is done using the attribute query method on the GRBModel object (GRBModel.get). attrname: The name of an integer-valued array attribute. . 180, 181 . . . . View refman.pdf from BIO 123 at San Diego Continuing Education. Refer to the Error Code table for a list of possible return values. . Summary Section The final section of the barrier log provides summary information. . One important note about integer-valued parameters: while the maximum value that can be stored in a signed integer is 231 1, we use a MAXINT value of 2,000,000,000. . . . len: The number of quadratic constraints. sense: Sense for new cutting plane (GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL). Arguments: attr: The attribute being queried. . . . . Arguments: lhsExpr: Left-hand side expression for new quadratic constraint. We report the former as ConstrVio and the latter as ConstrResidual. qconstrs: A two-dimensional array of quadratic constraints whose attribute values are being modified. . . . . . Pi Type: double Modifiable: No The constraint dual value in the current solution (also known as the shadow price). . . 460 ObjBound . Arguments: attr: The attribute being modified. Return value: Array of new constraint objects. . . . . . Return value: Constraint with the specified name. . . . . 459 NumBinVars . . . . The easiest way to do this is with a gurobi.env file. . . Important notes: Note that a model gets its own copy of the environment when it is created. . QCSlack Type: double Modifiable: No The constraint slack in the current solution. . . . . . . . . . . You can then call addVar and addConstr to populate the model with variables and constraints. . . The Gurobi Python interface maintains a reference to the default environment, so by default it will never be garbage collected. . . . Note that while quicksum is much faster than sum, it isnt the fastest approach for building a large expression. . . . . Return value: The current values of the requested attribute for each input quadratic constraint. . . . . . . . . . . . . . . . . . . . . . The default is no password. . . . Note that this method can be used to compute IISs for both continuous and MIP models. constrs: The constraints whose attribute values are being queried. . . void Terminate ( ) GRBModel.Tune() Perform an automated search for parameter settings that improve performance. . . . . . . . . Thus, in our example, f (1) = 0 and f (6) = 5. . . The actual settings can be retrieved using getTuneResult Please refer to the parameter tuning section for details on the tuning tool. . . boolean remove ( GRBConstr constr ) Remove the term associated with constraint constr from the column. . Between these two lines are basis status lines, each consisting of two or three fields. . . . . . . . . . . . Return value: All linear constraints in the model. . . . . . . For examples of how to query or modify attributes, refer to our Attribute Examples. . . . . minrelax: The type of feasibility relaxation to perform. . . void Set ( GRB.DoubleAttr attr, GRBConstr[] constrs, double[] newvalues, int start, int len ) Set a double-valued constraint attribute for a sub-array of constraints. . start: The index of the first variable to retrieve. . len: The number of constraints. . The suffix may optionally be followed by .zip, .gz, .bz2, or .7z. . . . . . . . . . . Lazy Updates One very important item to note about attribute and model modifications in the Gurobi optimizer is that they are performed in a lazy fashion, meaning that they dont actually affect the model until the next call to optimize or update on that model object. vars: A one-dimensional array of variables whose attribute values are being modified. To leave a variable value unspecified, set the variable to GRB_UNDEFINED in the solution vector. Example usage: int cbasis[] = {GRB_BASIC, GRB_BASIC, GRB_NONBASIC_LOWER, GRB_BASIC}; error = GRBsetintattrarray(model, "CBasis", 0, 4, cbasis); GRBgetintattrlist int GRBgetintattrlist ( GRBmodel *model, const char *attrname, int len, int *ind, int *values ) Query the values of an integer-valued array attribute. ind: The indices of the quadratic constraints remove. void writeParams ( String paramfile ) Arguments: paramfile: Name of the file to which non-default parameter settings should be written. Note that this method can only be invoked when the where member variable is equal to GRB.CB_MIPNODE or GRB.CB_MIPSOL (see the Callback Codes section for more information). . . . newvalues: The desired new values for the attribute for each input variable. . . The second set, the 29, 30 . This setting shuts off a few presolve reductions that sometimes prevent cuts on the original model from being applied to the presolved model. . Note that this software is covered by the Gurobi End User License Agreement. . Note that the lengths of the two argument arrays must be equal. 90 GRBgetstrattrarray . . . A number of tuning-related parameters allow you to control the operation of the tuning tool. . You can change the names of these files using the ResultFile parameter. . . cind: Constraint indices for the coefficients to modify. . Return value: Negation of expression. . Note that the start can be partially populated the MIP solver will attempt to fill in values for missing start values. . . . constr: Constraint for new term. . . . . . . . . . . . . . Return value: New model object. numvars: The number of variables in the model. . . . . For examples of how to query or modify attributes, refer to our Attribute Examples. . . . The lbpen, ubpen, and rhspen arguments specify the coefficients on the squares of the lower bound, upper bound, and linear constraint violations, respectively. . . . vals: Desired new values for coefficients. . . operator* Overloaded operator on expression objects. . Return value: Expression that represents the result of multiplying the variable by a constant. . rhsVal: Right-hand side value for new lazy constraint. With these arguments we define f (1) = 1, f (3) = 2 and f (5) = 4. . . . . See the description of the vbeg argument for more information. . . . . . double[] get ( GRB.DoubleAttr attr, GRBConstr[] constrs, int start, int len ) Query a double-valued constraint attribute for a sub-array of constraints. . o)4y f:ciyrol"rFKni%AfI-?$Dyv_s?^A7?GRI^2J8#v[heG:AP*@G=.SFPiPM, 1D'49E,gkai}}?>6n, 75_ . The two arguments that count non-zero values are of type size_t in this version to support models with more than 2 billion non-zero values. . . . We often refer to the class of an optimization model. . . GRBConstr[] addRanges ( GRBLinExpr[] exprs, double[] lower, double[] upper, String[] names ) Arguments: exprs: Linear expressions for the new range constraints. . . . . . Distributed parameter tuning, which automatically searches for parameter settings that improve performance on your optimization model. Important notes: We recommend that you build a model one constraint or one variable at a time, using GRBad- dconstr or GRBaddvar, rather than using this routine to load the entire constraint matrix at once. . 132 GRBModel::feasRelax() . . . . If you are more interested in finding feasible solutions quickly, you can select MIPFocus=1. . . . . . Important notes: Note that all interface routines that return string-valued attributes are returning pointers into internal Gurobi data structures. Return value: An environment object (with no associated log file). . . . 246 GRBConstr.sameAs() . . . . . Can be null, in which case the variables get lower bounds of 0.0. ub: Upper bounds for new variables. 48 GRBdelq . . . . . Arguments: attr: The attribute being modified. . . . . Lazy Updates One very important item to note about attribute and model modifications in the Gurobi optimizer is that they are performed in a lazy fashion, meaning that they dont actually affect the model until the next call to optimize or update on that model object. . If you specify relaxobjtype=1, the objective of the feasibility relaxation is to minimize the weighted sum of the squares of the bound and constraint violations. . . . . . void set ( GRB.DoubleAttr attr, GRBConstr[][] constrs, double[][] newvalues ) Set a double-valued constraint attribute for a two-dimensional array of constraints. . . . Integrality markers The COLUMNS section can optionally include integrality markers. . . . . port: The port number used to connect to the compute server. . . Terms can be added individually (using AddTerm) or in groups (using AddTerms or MultAdd). VBasis Type: int Modifiable: Yes The status of a given variable in the current basis. . char[] get (GRB.CharAttr attr, GRBQConstr[] qconstrs ) Query a char-valued quadratic constraint attribute for an array of quadratic constraints. Example usage: int change[] = {0, 1, 3}; int newbas[] = {GRB_BASIC, GRB_NONBASIC_LOWER, GRB_NONBASIC_LOWER}; error = GRBsetintattrlist(model, "VBasis", 3, change, newbas); 80, 81 . . . Use discardConcurrentEnvs to revert back to default concurrent optimizer behavior. . . . It indicates whether Gurobi was able to find a proven optimal solution to the model. . . . . In particular, the Gurobi library and the user program share the same C++ heap, so the user must be aware of certain aspects of how the Gurobi library uses this heap. . . . . . . 3.9 GRBQuadExpr Gurobi quadratic expression object. . . . Used to provide an advanced starting point for the simplex algorithm. . . Arguments: attr: The attribute being modified. GRBSOS addSOS ( const GRBVar* vars, const double* weights, int len, int type ) Arguments: vars: Array of variables that participate in the SOS constraint. . The Gurobi Optimizer handles all of these model classes. . . 465 Obj . . . . . string Get ( GRB.StringAttr attr ) Query the value of a string-valued attribute. This setting does have a few downsides, though. . . . The more complex one takes a list of variables and constraints, as well as penalties associated with relaxing the corresponding lower bounds, upper bounds, and constraints. . . . . . . . . . newvalue: The desired new value of the attribute.