/* Assignment problem in Picat. This example is from http://www.dashoptimization.com/home/cgi-bin/example.pl?id=kalis_features_2 """ All-different constraint: solving an assignment problem """ 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 ?=> X = [Sebastian, Frederic, Jan_Georg, Krzysztof, Maarten, Luca], X :: 1..6, % A different time slot for every person all_different(X), % 3 #<= Sebastian, Sebastian #<= 6, % 3 #<= Frederic , Frederic #<= 4, % 2 #<= Jan_Georg, Jan_Georg #<= 5, % 2 #<= Krzysztof, Krzysztof #<= 4, % 3 #<= Maarten , Maarten #<= 4, % 1 #<= Luca , Luca #<= 6, % simpler Sebastian :: 3..6, Frederic :: 3..4, Jan_Georg :: 2..5, Krzysztof :: 2..4, Maarten :: 3..4, Luca :: 1..6, solve(X), println(X), fail, nl. go => true.