problem.chgmcoef
problem.chgmcoef |
Purpose
Change multiple coefficients in the problem. The coefficients that do not exist yet will be added to the problem. If many coefficients are being added to a row of the matrix, it may be more efficient to delete the old row of the matrix and add a new one.
Synopsis
problem.chgmcoef (mrow, mcol, dval)
Arguments
mrow
|
Array containing the row indices of the coefficients to be changed.
|
mcol
|
Array containing the column indices of the coefficients to be changed.
|
dval
|
Array containing the new coefficient values. If an element of
dval is zero, the coefficient will be deleted.
|
Example
con1 = x + y + z <= 2 con2 = x + y >= 1 con3 = x + 3*y = 1 p.addVariable (x,y,z) p.addConstraint (con1, con2, con3) p.chgmcoef ([con1,con1,con1,con2,con3], [x,y,z,x,x], [-2, -3, -3.2, 1, 3])
This changes five coefficients, three of which in the first constraint and one in each of the second and third constraints.
Further information
chgmcoef is more efficient than repeated calls to
problem.chgcoef and should be used in its place if many coefficients are to be changed.
Related topics
problem.chgcoef,
problem.chgmqobj,
problem.chgobj,
problem.chgqobj,
problem.chgrhs,
problem.getcols,
problem.getrhs.