Build an optimal schedule for a distributed development team for this Friday.
Happy Friday Project Requirements
The algorithm for scheduling job is primarily based on Branch and Bound algorithm which is addressed in this Job Assignment Problem Using Branch and Bound article.
To get a local copy up and running, follow these simple steps.
- Clone the repo
git clone git@github.com:buithehoa/happy_friday.git
- Install dependencies
bundle install
From the root folder of the project, execute ./bin/schedule
with parameters as follows
./bin/schedule <performance_csv_path> <tasks_csv_path> <teams_csv_path> <output_path>
Here's an example using existing CSV files included in the project. When option -v
is provided, the content of the exported CSV will be printed out.
./bin/schedule -v ./spec/fixtures/files/sample_input/performance.csv spec/fixtures/files/sample_input/tasks.csv spec/fixtures/files/sample_input/teams.csv /tmp
The output will be similar to the following
+--------+-----------------------------+-----------------------------+---------+
| Team | Local Time | UTC Time | Task No |
| Moscow | Fri 09:00 AM - Fri 01:00 PM | Fri 06:00 AM - Fri 10:00 AM | 1 |
| Moscow | Fri 01:00 PM - Fri 07:00 PM | Fri 10:00 AM - Fri 04:00 PM | 4 |
| London | Fri 09:00 AM - Fri 02:00 PM | Fri 09:00 AM - Fri 02:00 PM | 2 |
| London | Fri 02:00 PM - Fri 06:00 PM | Fri 02:00 PM - Fri 06:00 PM | 3 |
+--------+-----------------------------+-----------------------------+---------+
Exported file path: /tmp/schedule-20210915-104856.csv
The content of /tmp/schedule-20210915-104856.csv
will be as follows
Team,Local Time,UTC Time,Task No
Moscow,09:00 AM - 01:00 PM,06:00 AM - 10:00 AM,1
Moscow,10:00 AM - 04:00 PM,10:00 AM - 04:00 PM,4
London,09:00 AM - 02:00 PM,09:00 AM - 02:00 PM,2
London,02:00 PM - 06:00 PM,02:00 PM - 06:00 PM,3
To run all specs, execute rspec
$ bundle exec rspec
Finished in 1.13 seconds (files took 0.14603 seconds to load)
24 examples, 0 failures
- The entry point of the program is
Main#run
which is called inbin/schedule
as follows
Main.new(*ARGV).run
- The scheduling algorithm is implemented in
Scheduler::BranchAndBound
and 2 supporting models:Scheduler::Node
andScheduler::Workload
which can be found underlib/scheduler
. The algorithm is triggered as follows inMain
schedule = Scheduler::BranchAndBound.new(
workload.estimated_effort,
workload.timezone_offsets).run
- The functionality of
CSVHandler
class includes
- Read input CSV files to collect input data
- Export calculated schedule to CSV files
Bui The Hoa - @buithehoa
Project Link: https://github.com/buithehoa/happy_friday