/** This is a tester for Frink's constraint solver for a pseudo-sorter algorithm to test the LessThan constraint. */ n = 4 if length[ARGS] > 0 // Parse command-line argument n = parseInt[ARGS@0] solver = newJava["frink.constraint.ConstraintSolver"] q = new array for i = 0 to n-1 q@i = solver.makeIntRangeVariable[1, 2n] for i = 0 to n-2 solver.greaterThan[q@i, q@(i+1)] solver.equals[q@0, q@(n-1), n+2] listener = newJava["frink.constraint.PrintingSolutionListener"] //listener.setFirstOnly[true] // Comment this in to find only one solution. solver.solve[listener]