Purpose
Return the coefficient or constant term in a constraint
Synopsis
function getcoeff(c:genctr [, x:mpvar]) :real
Arguments
c
|
a general constraint
|
x
|
a decision variable
|
Return value
If a variable is specified as well as a constraint, the return value is the
coefficient in that variable and constraint.
If no variable is specified, the return value is the constant term in the constraint
Example
The following example retrieves a coefficient and the constant term of
a constraint:
declarations
c1, c2: genctr
x, y: mpvar
end-declarations
c1:= x^2 + y^2 <= 4 - x
c2:= x*y >= 1
SLPloadprob(x+y)
SLPmaximize
writeln("(c1,x)=",getcoeff(c1,x)," c2=",getact(c2))
Further information
See the discussion on
General Constraint
Expressions for more details on the way in which the formulation of a constraint
affects the way it is loaded into the problem.
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.