forbiddenAssignments
OPL function for illegal value combinations
Purpose
OPL function to define forbidden combinations of values.
context | type |
---|---|
Model files (.mod) - Not allowed in a CPLEX constraint block. |
boolean (1 if the constraint is true, 0 otherwise) |
Syntax
forbiddenAssignments({tuple-type}, int, ...) forbiddenAssignments({tuple-type}, dvar int, ...)
Description
This constraint allows you to easily define the forbidden combinations of values for several integer decision variables. This constraint can apply to any number of variables (and therefore each has a variable number of arguments). The set of forbidden combinations is given by a tuple with an arity (number of fields) equal to the number of considered variables. Each tuple defines a forbidden combination.
You can use this function within IBM ILOG Script statements by specifying the OPL namespace:
( Opl.xxx() )
Example
using CP;
tuple C {
int a;
int b;
};
{C} possibles = {<1,1>, <2,4>};
{C} forbidden = {<3,5>};
dvar int+ x;
dvar int+ y;
subject to {
allowedAssignments(possibles, x, y);
forbiddenAssignments(forbidden, 3, y);
}