Next: , Previous: , Up: Available Constraints   [Contents][Index]


10.10.4.6 Graph Constraints

The following constraint can be thought of as constraining n nodes in a graph to form a Hamiltonian (sub-)circuit. The nodes are numbered from 1 to n. A full circuit visits each node exactly once and returns to the origin. A subcircuit visits a subset of the nodes exactly once and returns to the origin.

circuit(+Succ)
circuit(+Succ, +Pred)

where Succ is a list of length n of domain variables. The value of the i:th element of Succ (Pred) is the successor (predecessor) of node i in the graph. True if the nodes form exacty one Hamiltonian circuit.

Corresponds to circuit in MiniZinc.

subcircuit(+Succ)   since release 4.6
subcircuit(+Succ, +Pred)   since release 4.6

where Succ is a list of length n of domain variables. If the value of the i:th element of Succ (Pred) is i, then that corresponds to a node not in the graph. Otherwise, the value is the successor (predecessor) of node i in the graph. True if the nodes that are included form at most one Hamiltonian subcircuit.

Corresponds to subcircuit in MiniZinc.


Send feedback on this subject.