/* Restaurant Scheduling problem (PuzzlOR) in Picat. From PuzzlOR Restaurant Scheduling (April 2008) http://puzzlor.editme.com/Scheduling """ April 2008 - Restaurant Scheduling After faithfully serving the O.R. profession for 50 years, you decide to retire and open a restaurant. Among the hundreds of details with opening a restaurant, you need to hire and schedule employees. Based on the foot traffic of other restaurants in the area, you expect that you will need the following number of employees each day: Employees Schedule Day of week Employees Needed Monday 4 Tuesday 5 Wednesday 5 Thursday 10 Friday 12 Saturday 12 Sunday 2 Your employees will work four consecutive days and then have three days off. They will be paid $100 for each day they work. In your rush to get the restaurant started, you haphazardly hire 17 employees. Five will start on Monday, five will start on Thursday and seven will start on Friday. This schedule satisfies the above work requirements, but you have no idea how optimal this is. Questions: 1. How much money would you save each week from your current schedule if you optimized your workforce? 2. How much additional money would you save or lose each week if you switched your employees to a "five days on, two days off" schedule at $80 per day? """ This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => Days = 7, WorkDays = 4, % WorkDays = 5, FreeDays = Days-WorkDays, CostPerDay = 100, % CostPerDay = 80, % Needed per day % M T W T F S S Needed = [4,5,5,10,12,12,2], % decision variables % Number to hire each day X = new_list(Days), X :: 0..20, % number of people working this day Working = new_list(Days), Working :: 0..20, TotalCost #= sum([WorkDays*CostPerDay*X[I] : I in 1..Days]), foreach(D in 1..Days) Tmp = [X[I] : I in D..min(Days,D+WorkDays-1)] ++ [X[I] : I in 1..D-WorkDays, D + WorkDays-1 > Days], Working[D] #= sum(Tmp), Working[D] #>= Needed[D] end, Vars = X ++ Working, solve($[min(TotalCost)],Vars), println('needed '=Needed), println('x '=X), println('working'=Working), println(num_workers=sum(X)), println(total_cost=TotalCost), nl.