Initializing help system before first use

getcoeff

Purpose
Get a constraint coefficient or constant term.
Synopsis
function getcoeff(c:linctr):real
function getcoeff(c:linctr, x:mpvar):real
function getcoeff(c:linctr, n:integer):real
Arguments
A linear constraint
A decision variable
-1 for constant term, -2 for range lower bound
Return value
Coefficient of the variable or a constant term.
Example
In this example a single constraint with three variables is defined. The calls to getcoeff result in r taking the value -1 and s taking the value -12.
declarations
 x,y,z:mpvar
end-declarations

c:= 4*x + y -z <= 12
r:= getcoeff(c, z)
s:= getcoeff(c)
Further information
This function returns the coefficient of a given variable in a constraint, or if no variable is given, the constant term (= -RHS) of the constraint. The returned values correspond to a normalised constraint representation with all variable and constant terms on the left side of the (in)equality sign.
Related topics

© 2001-2022 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.