/* Giapetto's problem in Picat. From the article "The GNU Linear Programming Kit, Part 1: Introduction to linear optimization" http://www-128.ibm.com/developerworks/library/l-glpk1/index.html?ca=drs- (Translation of the GLPK MathProg model.) This finds the optimal solution for maximizing Giapetto's profit. This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ % import util. import cp. main => go. go => % Decision variables % X1 :: 0..100, % soldier % X2 :: 0..100, % train % Objective function (Giapetto's profit, to maximize) Z #= 3*X1 + 2*X2, X1 #>= 0, X2 #>= 0, 2*X1 + X2 #<= 100, % Finishing X1 + X2 #<= 80, % Carpentry X1 #<= 40, % Demand solve($[max(Z)], [X1,X2]), println(x1=X1), println(x2=X2), nl.