GRBModel.AddGenConstrPWL()


GRBModel.AddGenConstrPWL()

Add a new general constraint of type GRB.GENCONSTR_PWL to a model.

A piecewise-linear (PWL) constraint states that the relationship <span>$</span>y =
f(x)<span>$</span> must hold between variables <span>$</span>x<span>$</span> and <span>$</span>y<span>$</span>, where <span>$</span>f<span>$</span> is a piecewise-linear function. The breakpoints for <span>$</span>f<span>$</span> are provided as arguments. Refer to the description of piecewise-linear objectives for details of how piecewise-linear functions are defined.

GRBGenConstr AddGenConstrPWL ( GRBVar xvar,
    GRBVar yvar,
    double[] xpts,
    double[] ypts,
    string name )

Arguments:

xvar: The <span>$</span>x<span>$</span> variable.

yvar: The <span>$</span>y<span>$</span> variable.

xpts: The <span>$</span>x<span>$</span> values for the points that define the piecewise-linear function. Must be in non-decreasing order.

ypts: The <span>$</span>y<span>$</span> values for the points that define the piecewise-linear function.

name: Name for the new general constraint.

Return value:

New general constraint.