Try our new documentation site (beta).


GRBModel::set()

Set the value(s) of an attribute. Use this method for scalar model attributes and for arrays of constraint or variable attributes.

void set ( GRB_CharAttr attr,
    const GRBVar* vars,
    char* newvalues,
    int count )
    Set a char-valued variable attribute for an array of variables.

    Arguments:

    attr: The attribute being modified.

    vars: An array of variables whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input variable.

    count: The number of variable attributes to set.

void set ( GRB_CharAttr attr,
    const GRBConstr* constrs,
    char* newvalues,
    int count )
    Set a char-valued constraint attribute for an array of constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input constraint.

    count: The number of constraint attributes to set.

void set ( GRB_CharAttr attr,
    const GRBQConstr* qconstrs,
    char* newvalues,
    int count )
    Set a char-valued quadratic constraint attribute for an array of quadratic constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of quadratic constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input quadratic constraint.

    count: The number of quadratic constraint attributes to set.

void set ( GRB_DoubleAttr attr,
    double newvalue )
    Set the value of a double-valued model attribute.

    Arguments:

    attr: The attribute being modified.

    newvalue: The desired new value for the attribute.

void set ( GRB_DoubleAttr attr,
    const GRBVar* vars,
    double* newvalues,
    int count )
    Set a double-valued variable attribute for an array of variables.

    Arguments:

    attr: The attribute being modified.

    vars: An array of variables whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input variable.

    count: The number of variable attributes to set.

void set ( GRB_DoubleAttr attr,
    const GRBConstr* constrs,
    double* newvalues,
    int count )
    Set a double-valued constraint attribute for an array of constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input constraint.

    count: The number of constraint attributes to set.

void set ( GRB_DoubleAttr attr,
    const GRBQConstr* qconstrs,
    double* newvalues,
    int count )
    Set a double-valued quadratic constraint attribute for an array of quadratic constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of quadratic constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input quadratic constraint.

    count: The number of quadratic constraint attributes to set.

void set ( GRB_IntAttr attr,
    int newvalue )
    Set the value of an int-valued model attribute.

    Arguments:

    attr: The attribute being modified.

    newvalue: The desired new value for the attribute.

void set ( GRB_IntAttr attr,
    const GRBVar* vars,
    int* newvalues,
    int count )
    Set an int-valued variable attribute for an array of variables.

    Arguments:

    attr: The attribute being modified.

    vars: An array of variables whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input variable.

    count: The number of variable attributes to set.

void set ( GRB_IntAttr attr,
    const GRBConstr* constrs,
    int* newvalues,
    int count )
    Set an int-valued constraint attribute for an array of constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input constraint.

    count: The number of constraint attributes to set.

void set ( GRB_StringAttr attr,
    string newvalue )
    Set the value of a string-valued model attribute.

    Arguments:

    attr: The attribute being modified.

    newvalue: The desired new value for the attribute.

void set ( GRB_StringAttr attr,
    const GRBVar* vars,
    string* newvalues,
    int count )
    Set a string-valued variable attribute for an array of variables.

    Arguments:

    attr: The attribute being modified.

    vars: An array of variables whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input variable.

    count: The number of variable attributes to set.

void set ( GRB_StringAttr attr,
    const GRBConstr* constrs,
    string* newvalues,
    int count )
    Set a string-valued constraint attribute for an array of constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input constraint.

    count: The number of constraint attributes to set.

void set ( GRB_StringAttr attr,
    const GRBQConstr* qconstrs,
    string* newvalues,
    int count )
    Set a string-valued quadratic constraint attribute for an array of quadratic constraints.

    Arguments:

    attr: The attribute being modified.

    constrs: An array of quadratic constraints whose attribute values are being modified.

    newvalues: The desired new values for the attribute for each input quadratic constraint.

    count: The number of quadratic constraint attributes to set.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization