/* Popsicle stand (PuzzlOR) in Picat. From PuzzlOr Feb, 2012 http://www.informs.org/ORMS-Today/Private-Articles/February-Volume-39-Number-1/THE-PUZZLOR """ This is no way to run a Popsicle stand By John Toczek Workforce management is central to efficient operations and good customer service. Proper scheduling of employees can mean the difference between profitability and business failure. As the manager of a Popsicle stand, you are required to hire and set the weekly work schedule for your employees. The required levels for the week are as follows: Total employees required: Monday = 5, Tuesday = 7, Wednesday = 7, Thursday = 10, Friday = 16, Saturday = 18; Sunday = 12. Assume the same staffing requirements continue week after week. Full-time employees work five consecutive days and earn $100 per day. Part-time employees work two consecutive days and earn $150 per day. Question: What is the minimal weekly staffing cost you can achieve while meeting the required staffing levels? """ z = 8200 fullTime = [0, 4, 5, 1, 4, 0, 0] partTime = [0, 0, 0, 0, 2, 2, 0] allF = [5, 8, 9,10,14,14,10] allP = [0, 0, 0, 0, 2, 4, 2] all = [5, 8, 9,10,16,18,12] demand = [5, 7, 7,10,16,18,12] 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 ?=> N = 7, % number of required employees per per day Demand = [5,7,7,10,16,18,12], FullTime = new_list(N), FullTime :: 0..120, PartTime = new_list(N), PartTime :: 0..120, % full time employees AllF = new_list(N), AllF :: 0..30, % part time employees AllP = new_list(N), AllP :: 0..30, All = new_list(N), All :: 0..130, % cost % full time, $100 per day, work for 5 days % part time, $150 per day, work 2 days Z #= sum([5*FullTime[I]*100 + 2*PartTime[I]*150 : I in 1..N]), foreach(I in 0..N-1) F = [FullTime[abs((7+J) mod 7)+1] : J in I-4..I], P = [PartTime[abs((7+J) mod 7)+1] : J in I-1..I], AllF[I+1] #= sum(F), AllP[I+1] #= sum(P), All[I+1] #= AllF[I+1] + AllP[I+1], All[I+1] #>= Demand[I+1] end, Vars = FullTime ++ PartTime ++ AllF ++ AllP ++ All, solve($[min(Z)],Vars), println(z=Z), println(fullTime=FullTime), println(partTime=PartTime), println(allF=AllF), println(allP=AllP), println(all=All), println(demand=Demand), nl, fail, nl. go => true.