Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Operations Research, Linear Programming & Python

Cammil
January 08, 2016

Operations Research, Linear Programming & Python

A very brief intro into the importance of Operations Research and Linear Programming, and how you can use Python to solve LP problems.

Cammil

January 08, 2016
Tweet

Other Decks in Technology

Transcript

  1. Operations Research (or AI?) Shortest Path Problems Bin Packing We

    found an answer, and it’s optimal! Cost Minimisation Network Optimisation (?) The major difference between OR and AI, is that OR often finds the one optimal result, and often is immediately applicable to real world, physical organisation of costly resources.
  2. One Formula(tion) to Rule Them All min () What can

    we choose? (Scope) How good/bad is it? (Objective Function) Make it as small as possible. Please. If we had to generalise what we do, whether it’s OR, AI, machine learning etc. This formulation would be the way to do it.
  3. Linear Programming is to Optimisation what Regression is to Statistics

    min ≤2,>4 3 − Linear programming is one of the simplest subsets of the generalised optimisation problem, and it is precisely for this reason, that it is so important.
  4. PuLP: Python wrapper for GLPK x = LpVariable(‘x’) y =

    LpVariable(‘y’) prob += x <= 2 prob += y > 4 prob += 3*y – x GLPK().solve(prob) Python makes LP problem solving very easy. See example code.
  5. Case Study: Scheduling Staff to Cover Tasks Whilst Minimising Labour

    The variables: Di – demand for labour at hour I X_i_j – contribution to hour I by employee j (0 or 1) S_min_j – minimum allowed shift length for employee j S_max_j – maximum allowed shift length for employee j The constraint: Sum of X_i_j >= Di The objective: Cost of labour x total labour The difficulty with LP problems, in general, is formulating the problem. This is often the case, but in LP, it can be significantly more challenging due to the limited model space you have to work in.
  6. Shift Scheduling Solved Examples: 1. 2. All suggested shift are

    optimal Labour Overshoot reduced from c.10% to 2.5% An example of shift scheduling. Turning a few days work into a multi-million pound saving solution.
  7. • Some known alternatives to PuLP • PyMathProg, PyGLPK (uses

    GNU Linear Programming Kit) • SciPy (.optimize.linprog) • Google OR-Tools • CVXOPT (convex optimisation in Python) Cammil Taank [email protected] Fortunately there are many tools available to solve LP problems. Here are but a few.