getctrnextterm
Purpose
Synopsis
void *getctrnextterm(XPRMcontext ctx, XPRMlinctr ctr, void *prev, XPRMmpvar *var, double *coeff);
Arguments
|
ctx
|
Mosel's execution context
|
|
ctr
|
Reference to a linear constraint
|
|
prev
|
Last value returned by this function. Should be
NULL for the first call
|
|
var
|
Pointer to return the decision variable reference for the current term
|
|
coeff
|
Pointer to return the coefficient of the current term
|
Return value
The value to be used as
prev for the next call or
NULL when all terms have been returned.
Example
The following function displays the terms of a linear constraint.
void displinctr(XPRMcontext ctx, XPRMlinctr ctr)
{
void *prev;
XPRMmpvar v;
double coeff;
prev=mm->getctrnextterm(ctx, ctr, NULL, &v, &coeff);
mm->printf(ctx, "%g ",coeff);
while(prev!=NULL) {
prev=mm->getctrnextterm(ctx, ctr, prev, &v, &coeff);
mm->printf(ctx, "%+g %p ", coeff, v);
}
mm->printf(ctx, "\n");
}
Further information
1. This function can be called repeatedly to enumerate all terms of a linear constraint. For the first call, the parameter prev must be
NULL and the function returns the constant term of the linear constraint (the value returned for
var is then
NULL and
coeff contains the constant term). For the following calls, the value of prev must be the last value returned by the function. The enumeration is completed when the function returns NULL.
2. With a range constraint it is possible to retrieve the lower bound of the range using the special value
-1 for the
prev parameter. In this case the function returns always
NULL.
© 2001-2024 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.
