View source with raw comments or as raw
    1# Traveling salesman
    2
    3A variant of the traveling salesman problem (visiting every city in a
    4country only once, starting and ending in the same city, and moving
    5between cities using the existing connections) where, in addition, we
    6want to find out the length of the Hamiltonian cycle.
    7
    8Solutions for this problem using `CLP(FD)` and `ASP` appear in
    9([Dovier et al. 2005](https://users.dimi.uniud.it/~agostino.dovier/PAPERS/DFP05-cilc.pdf)),
   10with comparable performance. However, they show that the `ASP`
   11encoding is more compact, even if the `CLP(FD)` version uses the
   12library predicate `circuit/1`, which does the bulk of the work and
   13whose code is non-trivial.
   14
   15We will show that also in this problem, where the `ASP` solution is more
   16compact than that of `CLP(FD)`, `s(CASP) `is more expressive.
   17
   18## s(CASP) implementation
   19
   20```
   21scasp hamiltonian_scasp.pl
   22
   23```