My friends and I cook dinner almost every night. One of us cooks a main dish, and someone else cooks a side.
A dynamic scheduling algorithm that takes into account people's differing availability, days that no one is around, and weights to favor people that haven't cooked in a while, is preferrable to signing people up for a consistent day of the week.
Pre-requisites: pip3 install requests
Usage: python3 main.py
Current behavior:
- Assign nights based on rudimentary weights system. The person who cooked the longest ago is preferred; if unavailable, the next least-recent chef is selected, and so on.
- The method "find_fair" introduces randomization of the order of chefs in the schedule as presented to the scheduling algorithm. It randomizes the input order, then attempts to find a fair schedule by running the algorithm. If it fails, it tries again.
- Filters:
- The same person cannot cook twice in one day.
- Roommates are not assigned the same day.
- No chef is assigned to cook two days in a row.
By uncommenting the other versions of the
roommates
andyesterday
schedules, conditions 2. and 3. will be allowed, but not unless they are necessary to generate a viable schedule.
REFACTORING PLAN:
- Algorithm needs a better way to keep track of the past schedule. Pickle file? Needs easy conversion to json consumable by Adam's service.
- User response: confirm/deny suggested schedule, or input manual schedule.
- Fairness then becomes a ratio: how many times has this person cooked out of all nights that there were? Is that above or below the desired average?
- Support for "x is on vacation for # weeks"; take them out of the schedule and adjust the fairness ratio accordingly. Since they weren't in town to cook that week, "missing" the week shouldn't be a punishment.
Future plans:
- (DONE) Don't assign someone both a main and a side on the same day
- (DONE) Assign weights
- (DONE) Obey limited schedules
- (DONE) Test for constraints: no more than 1x per week, no less than 2x in a 3 week period
- (DONE) Manually set 'since' variable to add data from previous weeks
- (DONE) Add tests for fairness
- (DONE) Send SMS via Nexmo API
- (DONE) Allow starting algorithm on a Thursday (or any other day)
- (DONE) Two cooks that live in the same apartment shouldn’t cook on the same day
- Support people being gone on vacation
- Send updates to one shared google calendar that everyone can see
- (DONE) Attempt to find a fair schedule by randomly shuffling chef entry order until one is found.
- (DONE) Use curl instead of nexmo python package in order to use python3
- Clean up and separate logic