Namespace: ILOG.CP
Assembly: ILOG.CP (in ILOG.CP.dll)
Syntax
| C# |
|---|
public virtual IConstraint SubCircuit( IIntExpr[] next ) |
| Visual Basic |
|---|
Public Overridable Function SubCircuit ( _ next As IIntExpr() _ ) As IConstraint |
Parameters
- next
- Type: array<ILOG.Concert..::..IIntExpr>[]()[][]
The array of successor or predecessor variables or expressions.
Return Value
The newly created circuit constraint.Remarks
Given an array of n successor variables next, this constraint imposes the next variables to all have values in [0, n-1] and also imposes that all of their values are different. We can understand next[i]=j as meaning that node j is immediately after node i. Additionally, this constraint ensures that at most one circuit (a path which forms a loop) of length at least two can exist (called the "main" circuit) and all nodes not involved in this circuit have next[i] = i. We can see that if next[i] = j, where i and j are different values, then nodes i and j are both on the main circuit. Any node i where next[i] = i is not on the main circuit, so to ensure that a particular node i appears on the main circuit, one can impose a constraint next[i] != i.
Note: By symmetry, one may also consider the next parameter to represent the predecessor nodes rather than successor nodes. The method CP.Inverse(next, pred) can be used to create a constraint which maintains an array of predecessor variables pred given the next variables.
Note: This constraint cannot be used in a logical constraint.