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

# <ConsistencyModule:> ham_path_g(?Start,?End,+Succ,++CostMatrix,+ArcCosts,?Cost)

Constrains elements in Succ to form a Hamiltonian path from Start to End, with cost Cost, using native Gecode indexing.
Start
An integer or (domain) variable (array notation accepted)
End
An integer or (domain) variable (array notation accepted)
Succ
A collection of N different (domain) variables or integers
CostMatrix
A NxN matrix collection of integers
ArcCosts
A collection of N (domain) variables or integers.
Cost
A (domain) variable or integer (array notation accepted).

## Description

This version of ham_path/6 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 ham_path/6 for a more detailed description of this constraint.

## Examples

```[eclipse 3]: CostM = []([](0,3,5,7),[](4,0,9,6),[](2,1,0,5),[](-7,8,-2,0)),
ham_path_g(3,2,[1,2,4,0], CostM, [C0,C1,C2,C3], C).

CostM = []([](0, 3, 5, 7), [](4, 0, 9, 6), [](2, 1, 0, 5), [](-7, 8, -2, 0))
C0 = 3
C1 = 9
C2 = 0
C3 = -7
C = 5
```