Code Monkey home page Code Monkey logo

scheduling-or-tools's Introduction

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

scheduling-or-tools's People

Watchers

Daniel Díaz Carrete avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.