/* Production-planning in Picat. From the OPL model production.mod. This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import mip. main => go. go => Products = [kluski, capellini, fettucine], NumProducts = Products.length, Resources = [flour, eggs], % Consumption[Products, Resources] Consumption = [ [0.5, 0.2], [0.4, 0.4], [0.3, 0.6] ], Capacity = [ 20, 40 ], Demand = [ 100, 200, 300 ], InsideCost = [0.6, 0.8, 0.3 ], OutsideCost = [0.8, 0.9, 0.4], % decision variables Inside = new_list(NumProducts), Outside = new_list(NumProducts), Z #= sum([InsideCost[P]*Inside[P] + OutsideCost[P] * Outside[P] : P in 1..NumProducts]), foreach(R in 1..Resources.length) sum([Consumption[P,R]*Inside[P] : P in 1..NumProducts]) #<= Capacity[R] end, foreach(P in 1..NumProducts) Inside[P] + Outside[P] #>= Demand[P] end, solve($[min(Z)], Inside ++ Outside), println(z=Z), println(inside=Inside), println(outside=Outside), nl.