/* Global constraint orth_on_the_ground in Picat. From Global Constraint Catalogue http://www.emn.fr/x-info/sdemasse/gccat/Corth_on_the_ground.html """ Constraint orth_on_the_ground(ORTHOTOPE,VERTICAL_DIM) Purpose The ori attribute of the VERTICAL_DIMth item of the ORTHOTOPES collection should be fixed to one. Example (,1) The orth_on_the_ground constraint holds since the ori attribute of its 1th item (i.e., 1th item since VERTICAL_DIM=1) is set to one. """ 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 ?=> N = 2, Orthotope = new_array(N,3), Orthotope :: 1..5, VerticalDim :: 1..N, Orthotope = {{1,2,3}, {2,3,5}}, % VerticalDim #= 1, orth_on_the_ground(Orthotope, VerticalDim), Vars = Orthotope.vars ++ [VerticalDim], solve(Vars), foreach(Row in Orthotope) println(Row) end, println(verticalDim=VerticalDim), nl, fail, nl. go => true. orth_on_the_ground(Orthotope,VerticalDim) => % Orthotope[VerticalDim,1] #= 1. matrix_element(Orthotope,VerticalDim,1,1).