/* Integer programming in Picat. Problem from http://forums.topcoder.com/;jsessionid=106E29747627F66C41B2F1FC31AEF971?module=Thread&threadID=610243&start=0&mc=4#961241 """ maximize ab + bc subject to 1<=a<=10 1<=b<=10 1<=c<=10 a,b,c are integers and unique (not equal) """ 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 ?=> L = [A,B,C], L :: 1..10, Z #= A*B + B*C, all_different(L), solve($[max(Z)],L), println(L), println(z=Z), nl. go => true.