[ library(cycle) | Reference Manual | Alphabetic Index ]
# cycle(+Edges, ++EdgeWeights, -CycleCost, ++Configuration)

A constraint that forces a Hamiltonian cycle in a directed graph
*Edges*
- A list of ic variables
*EdgeWeights*
- A square matrix of integers
*CycleCost*
- The cost of the cycle
*Configuration*
- A list of key:value configuration elements

## Description

Edges is a list of length VertexCount of ic variables, where VertexCount is the number of
vertices in the graph. Each variable needs to have a domain which is the subset of
[1..VertexCount]. The values in the i-th variable's domain correspond to edges in the
graph, so the domain value j of the i-th variable corresponds to an edge (i,j).
EdgeWeights is a square matrix (array of arrays) of size VertexCount*VertexCount of nonnegative
integers. The value indexed [i,j] corresponds to the cost of the edge (i,j). Values on the diagonal
([i,i]) are unimportant since the correspond to edges (i,i) which are automatically removed by
the constraint.
CycleCost is an ic variable that corresponds to the cost of the cycle.
Configuration is a list of key:value pairs that configure the filtering level of the constraint.
rc_varfix:yes/no (default is yes), enables or disables the propagation of reduced cost variable
fixing constraints. These constraints are based on the solution of the LP relaxation for the cycle.
cut_planes:yes/no (default is yes), enables or disables the iterative strengthening of the LP
relaxation by generation of cutting planes for the LP model.
bound_upd:yes/no (default is yes), enables or disables the tightening of the upper bound on cost
by solving a LP relaxation.
opt_dir:min/max (default is min), the propagation is optimised for minimisation (min)
or maximisation (max) of the CycleCost.
The default configuration for the constraint is to use the maximal available propagation
and cost tightening. This setting is also used by the cycle/3.
The most basic propagation level for cycle is achieved by setting
Configuration=[rc_varfix:no,cut_planes:no,bound_upd:no].

### Modes and Determinism

- cycle(+, ++, -, ++) is semidet

### Fail Conditions

It is impossible to find any Hamiltonian cycle in the graph
### Exceptions

*(1) general error *
- Wrong edge weigh matrix size.
*(1) general error *
- Wrong edge list length.
*(6) out of range *
- Wrong edge domain values.
*(1) general error *
- Wrong weight value.
*(8) bad argument list *
- Unknown options

## See Also

cycle / 3