/* Global constraint in_interval in Picat. From Global Constraint Catalogue http://www.emn.fr/x-info/sdemasse/gccat/Cin_interval.html """ in_interval(VAR,LOW,UP) Purpose Enforce the domain variable VAR to take a value within the interval [LOW, UP]. Example (3,2,5) The in_interval constraint holds since its first argument VAR=3 is greater than or equal to its second argument LOW=2 and less than or equal to its third argument UP=5. """ This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> V :: 0..10, Low :: 0..10, Up :: 0..10, V #= 3, % Low #= 2, Up #= 5, in_interval(V, Low, Up), Vars = [V,Low,Up], solve(Vars), println([v=V,low=Low,up=Up]), fail, nl. go => true. in_interval(V, Low, Up) => V #>= Low, V #<= Up.