# GRBXchgcoeffs

Filter Content By
Version
Languages

### GRBXchgcoeffs

 int GRBXchgcoeffs ( GRBmodel *model, size_t numchgs, int *cind, int *vind, double *val )

The size_t version of GRBchgcoeffs. The argument that counts non-zero values is of type size_t in this version to support models with more than 2 billion non-zero values.

Change a set of constraint matrix coefficients. This routine can be used to set a non-zero coefficient to zero, to create a non-zero coefficient where the coefficient is currently zero, or to change an existing non-zero coefficient to a new non-zero value. If you make multiple changes to the same coefficient, the last one will be applied.

Note that, due to our lazy update approach, the changes won't actually be integrated into the model until you update the model (using GRBupdatemodel), optimize the model (using GRBoptimize), or write the model to disk (using GRBwrite).

Return value:

A non-zero return value indicates that a problem occurred while performing the modification. Refer to the Error Code table for a list of possible return values. Details on the error can be obtained by calling GRBgeterrormsg.

Arguments:

model: The model to modify.

numchgs: The number of coefficients to modify.

cind: Constraint indices for the coefficients to modify.

vind: Variable indices for the coefficients to modify.

val: The new values for the coefficients. For example, if cind[0] = 1, vind[0] = 3, and val[0] = 2.0, then the coefficient in constraint 1 associated with variable 3 would be changed to 2.0.

Example usage:

  int cind[] = {0, 1};
int vind[] = {0, 0};
double val[] = {1.0, 1.0};
error = GRBXchgcoeffs(model, 2, cind, vind, val);