import choco.Problem; import choco.integer.constraints.AbstractLargeIntConstraint; import choco.integer.*; import choco.ContradictionException; import choco.mem.StoredBitSet; import choco.mem.StoredInt; import choco.mem.Environment; import choco.Solver; // // Subtour Elimination Constraint // see "Solving Small TSPs with Constraints" by Caseau & Laburthe // public class SubtourElimination extends AbstractLargeIntConstraint { private StoredInt[] start; // the start of a chain private StoredInt[] end; // the end of a chain private StoredInt[] length; // the length of the chain private int n; public SubtourElimination(Problem pb,IntDomainVar[] S) { super(S); n = S.length; problem = pb; Environment e = pb.getEnvironment(); start = new StoredInt[n]; end = new StoredInt[n]; length = new StoredInt[n]; for (int i=0;i