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

# <ConsistencyModule:> circuit_g(+Succ,++CostMatrix,?Cost)

Constrains elements in Succ to form a Hamiltonian circuit with cost Cost. This version uses native Gecode indexing.

Succ
  A collection of N different (domain) variables or integers
CostMatrix
  A NxN matrix of integers.
Cost
  A (domain) variable or integer (array notation accepted).

## Description

This version of circuit/3 uses the native Gecode indexing, which starts from 0. This is different from normal ECLiPSe's indexing, which starts from 1.

This constraint can be embedded in a constraint expression in its functional form (without the last argument).

See circuit/3 for a more detailed description of this predicate.

## Examples

    [eclipse 10]: CostM = []([](0,3,5,7),[](4,0,9,6),[](2,1,0,5),[](-7,8,-2,0)),
            circuit_g([1,2,3,0], CostM, C).

    CostM = []([](0, 3, 5, 7), [](4, 0, 9, 6), [](2, 1, 0, 5), [](-7, 8, -2, 0))
    C = 10

    [eclipse 6]: CostM = []([](0,3,5,7),[](4,0,9,6),[](2,1,0,5),[](-7,8,-2,0)),
            C #= circuit([2,3,4,1], CostM) + 1.

    CostM = []([](0, 3, 5, 7), [](4, 0, 9, 6), [](2, 1, 0, 5), [](-7, 8, -2, 0))
    C = 11

## See Also

circuit / 3