[ library(gfd) | Reference Manual | Alphabetic Index ]

<ConsistencyModule:> circuit(+Succ)

Constrains elements in Succ to form a Hamiltonian circuit.
Succ
A collection of different (domain) variables or integers

Description

Succ is a collection of N elements presenting a digraph of N nodes, where the i'th element of Succ represents the successor to node i. The constraint enforces Succ to form a Hamiltonian circuit, a path through every node in the graph, visiting each node once and forming a circuit.

Note that the Gecode implementation of this constraint has index (node id) starting from 0, rather than 1. This constraint is actually posted as circuit_offset_g/2 with an offset of 1. A version of this constraint with native Gecode indexing is available as circuit_g/1.

ConsistencyModule is the optional module specification to give the consistency level for the propagation for this constraint: gfd_gac for generalised arc consistency (domain consistency), and gfd_vc for value consistency.

This constraint is known as circuit in the global constraint catalog. It is implemented with Gecode's circuit() constraint with an offset of 1.

Examples

[eclipse 7]: circuit([2,A,4,1]).

A = 3

[eclipse 2]: circuit([]).

No (0.00s cpu)

[eclipse 11]: circuit([A]).

A = 1

See Also

circuit_g / 1, circuit_offset_g / 2