Initializing help system before first use

problem.chgcoef

problem.chgcoef


Purpose
Changes a single coefficient in the problem. If the coefficient does not already exist, a new coefficient will be added to the problem. If many coefficients are being added to a row of the problem, it may be more efficient to delete the old row and add a new row.
Synopsis
problem.chgcoef (irow, icol, dval)
Arguments
irow 
Row index for the coefficient.
icol 
Column index for the coefficient.
dval 
New value for the coefficient. If dval is zero, any existing coefficient will be deleted.
Example
In the following, the constraint is introduced in the problem and then its linear coefficient for x is changed to 3:
p = xpress.problem ()
x = xpress.var ()
c = x + x**2 <= 3
p.addVariable (x)
p.addConstraint (c)
p.chgcoef (c,x,3)
Further information
problem.chgmcoef is more efficient than multiple calls to chgcoef and should be used in its place in such circumstances.
Related topics