danidiaz / scheduling-or-tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Playing with Google's OR-tools

Google OR-Tools

Route. Schedule. Plan. Assign. Pack. Solve

Employee Scheduling

Organizations whose employees work multiple shifts need to schedule sufficient workers for each daily shift. Typically, the schedules will have constraints, such as "no employee should work two shifts in a row". Finding a schedule that satisfies all constraints can be computationally difficult.

The following sections present two examples of employee scheduling problems, and show how to solve them using the CP-SAT solver.

Using and Understanding ortools' CP-SAT: A Primer and Cheat Sheet

CP-SAT over CBC for MIP, is it worthwhile?

SAT solver vs. CP solver

The CP solver was developed 10 years ago. 3-4 years ago, we started the SAT/CP solver. Its performances are way better than the CP one.

How to speed up sat cp using strategies

Set the amount of possible unique values for variables in ORTOOLS CP-SAT

[or-tools/examples/python/shift_scheduling_sat.py](https://github.com/google/or-tools/blob/stable/examples/python/shift_scheduling_sat.py()

def AddLinearExpressionInDomain(self, linear_expr, domain):

OR-Tools CP-SAT solver: count successive NewBoolVar occurrences

If you want to constrain the length of a sequence, you should look at the shift_scheduling example

In particular, the soft sequence constraint. The idea is the following, for every starting point, you want to forbid 010, 0110, 01110, ..., 0111110 and 01111111111110 (0110 means work[start] is false, work[start + 1] is true, work[start + 2] is true, work[start + 3] is false.

CP-SAT Solver

To increase computational speed, the CP-SAT solver works over the integers. This means you must define your optimization problem using integers only.

let's start with a simple example problem in which there are:

Three variables, x, y, and z, each of which can take on the values: 0, 1, or 2. One constraint: x ≠ y

Google OR Tools CP-SAT Solver - scheduling problem with objective to even out shift distribution without hard constraints (max/min per period)

Fairness is the most complex question in OR. You need to try to capture what you want with equations as sample as possible.

Std deviation, variance are not simple. Minimizing max(worked per person) - min(worked per person);is simple.

Using SMT solvers

Ortools module not found under nix-shell

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 97.0%Language:Nix 3.0%