Initializing help system before first use

XPRBnewprec

XPRBnewprec


Purpose
Create a precedence constraint v1 + dur ≤ v2.
Synopsis
XPRBctr XPRBnewprec(XPRBprob prob, const char *name, XPRBvar v1, double dur, XPRBvar v2);
Arguments
prob 
Reference to a problem.
name 
The constraint name (of unlimited length). May be NULL if not required.
v1 
Reference to a variable.
dur 
Double or integer constant.
v2 
Reference to a variable.
Return value
Reference to the new constraint if function executed successfully, NULL otherwise.
Example
The following creates the inequality constraint ty12 + 5.4 ≤ ty14.
XPRBprob prob;
XPRBctr ctr5;
XPRBarrvar ty1;
   ...
ty1 = XPRBnewarrvar(prob, 5, XPRB_PL, "arry1", 0, 500);
ctr5 = XPRBnewprec(prob, "r5", ty1[2], 5.4, ty1[4]);
Further information
This function creates a so-called precedence constraint (where the first variable plus constant is not larger than a second variable). This function replaces XPRBnewctr and XPRBaddterm. If the indicated name is already in use, BCL adds an index to it. If no constraint name is given, BCL generates a default name starting with CTR. (The generation of unique names will only take place if the names dictionary is enabled, see XPRBsetdictionarysize.)
Note:
all terms that are added to a constraint must belong to the same problem as the constraint itself.

Related topics