Concepts
Features
Reference
Gurobi quadratic constraint object. Quadratic constraints are alwaysassociated with a particular model. You create a quadratic constraintobject by adding a quadratic constraint to a model (usingGRBModel.addQConstr), rather than by using aGRBQConstrconstructor.
The methods on quadratic constraint objects are used to get and setconstraint attributes. For example, quadratic constraint right-handsides can be queried by callingget(GRB.DoubleAttr.QCRHS). Note, however, that it is generally moreefficient to query attributes for a set of constraints at once. This isdone using the attribute query method on theGRBModel object(GRBModel.get).
The full list of attributescan be found in theAttributes section of thisdocument. Examples of how to query and set attributes can also be foundinthis section.
Query the value of a quadratic constraint attribute.
attr – The attribute being queried.
The current value of the requested attribute.
// Get constraint sensecharsense=constr.get(GRB.CharAttr.QCSense);// Get RHSdoublerhs=constr.get(GRB.DoubleAttr.QCRHS);// Get information whether constraint participates in a previously computed IISintiisqconstr=constr.get(GRB.IntAttr.IISQConstr);// Get constraint nameStringname=constr.get(GRB.StringAttr.QCName);
Set the value of a quadratic constraint attribute.
attr – The attribute being modified.
newval – The desired new value of the attribute.
// Set constraint senseconstr.set(GRB.CharAttr.QCSense,'>');// Set RHSconstr.set(GRB.DoubleAttr.QCRHS,2.0);// Force constraint into IISconstr.set(GRB.IntAttr.IISQConstrForce,1);// Set constraint nameconstr.set(GRB.StringAttr.QCName,"newName");
Help and Feedback