1 / 37

Perspective of mathematical optimization and its applications

Perspective of mathematical optimization and its applications. Tokyo University of Marine Science and Technology Mikio Kubo. How to Solve Real Combinatorial Optimization Problems Quickly. Mixed Integer Programming (MIP) Solver Constraint Programming (CP) Solver Scheduling Solver

florrie
Download Presentation

Perspective of mathematical optimization and its applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Perspective of mathematical optimization and its applications Tokyo University of Marine Science and Technology Mikio Kubo

  2. How to Solve Real Combinatorial Optimization Problems Quickly • Mixed Integer Programming (MIP) Solver • Constraint Programming (CP) Solver • Scheduling Solver • (or develop (meta)heuristics) ... using Python Language

  3. Why Python? • We can do anything by importing some modules • Optimization import gurobipy (MIP)import SCOP (CP) • Draw graphsimport networkX • Also fly! import antigravity ? http://xkcd.com/353/

  4. Mixed Integer Programming (MIP) • Variables x : Real or Integer or Binary • Constraints Linear or (convex) Quadratic Expressions minimize c’x+x’Qx (objective function)subject to Ax=b (constraints)

  5. What’s Gurobi? MIP solver Developed by: Zonghao Gu, Edward Rothberg,Robert Bixby Current version 4.6.1Free academic license

  6. Gurobi Objects GRBError Variable addVar Model Column addSOS addConstr Constraint SOS Callbacks LinExpr QuadExpr

  7. Introduction to Gurobi (1) • Create a model objectmodel = Model("Wine Blending")

  8. Introduction to Gurobi (2) • Add variable objectsx1 = model.addVar(name="x1")x2 = model.addVar(name="x2")x3 = model.addVar(name="x3") • Model update (needed before adding constraints; lazy update!)model.update()

  9. Introduction to Gurobi (3) • Set the objectivemodel.setObjective(15*x1 + 18*x2 + 30*x3, GRB.MAXIMIZE) • Add constraints model.addConstr(2*x1 + x2 + x3 <= 60)model.addConstr(x1 + 2*x2 + x3 <= 60)model.addConstr(x3 <= 30) • Optimizemodel.optimize()

  10. Modeling with Lists • Add variable objects into listx=[] for i in range(1,4): var=model.addVar(name=“x[%s]”%i) x.append(var) • Add constraint “x1 + x2 + x3 <= 2”model.addConstr( sum(x) <= 2 ) or model.addConstr( quicksum(x) <= 2 ) X[1] X[2] X[3] ・・・

  11. Modeling with Dictionaries • Dictionary that maps keys (“Dry”, “Medium”, “Sweet”) to variable objects x={ } x[“Dry”]= model.addVar(name=“Dry”) x[“Medium”]= model.addVar(name=“Medium”) x[“Sweet”]= model.addVar(name=“Sweet”) Value “Nihao” Variable Object Key “Hello”, “DryWine” Mapping

  12. Modeling with Dictionaries • Add constraint “2 x1 + x2 + x3 <= 30”model.addConstr( 2*x[“Dry”]+ x[“Medium”] +x[“Sweet”] <=30 ) Blends, Profit = multidict({"Dry":15, "Medium":18, "Sweet":30})=> Blends=["Dry", "Medium“, "Sweet“] Profit[“Dry”]=15, Profit[“Medium”]=18, ...

  13. k-median problem • A facility location problem with min-sum objective function • Number of customers n=200 • Number of facilities selected from customer sites k=20

  14. Formulation week formulation

  15. Python Code(1) from gurobipy import * model = Model("k-median") x, y = {}, {} # empty dictionaries Dictionary Data Structure Value “127cm” Variable Object Key “Hanako”, (1,2) Mapping

  16. Python Code (2) Add variable objects “B” means binary variable or GRB.BINARY I=range(n)J=range(n)for j in J: y[j] = model.addVar(vtype="B", name="y[%s]"%j) for i in I: x[i,j] =model.addVar( vtype="B",name="x[%s,%s]"%(i,j)) model.update() Set the objective model.setObjective(quicksum(c[i,j]*x[i,j] for i in I for j in J))

  17. Python Code (3) for i in I: model.addConstr(quicksum(x[i,j] for j in J) = = 1, "Assign[%s]"%i) for j in J: model.addConstr(x[i,j] <= y[j], "Strong[%s,%s]"%(i,j))model.addConstr(quicksum(y[j] for j in J) = = k, "k_median")

  18. Weak formulation (result)n=200,k=20 Optimize a model with 401 Rows, 40200 Columns and 80400 NonZeros … Explored 1445 nodes (63581 simplex iterations) in 67.08 seconds Thread count was 2 (of 2 available processors) Optimal solution found (tolerance 1.00e-04) Best objective 1.0180195861e+01, best bound 1.0179189780e+01, gap 0.0099% Opt.value= 10.1801958607

  19. Upper and lower bounds (Weak Formulation)

  20. Strong formulation (result) Optimize a model with 40401 Rows, 40200 Columns and 160400 NonZeros … Explored 0 nodes (1697 simplex iterations) in 3.33 seconds(No branching!) Thread count was 2 (of 2 available processors) Optimal solution found (tolerance 1.00e-04) Best objective 1.0180195861e+01, best bound 1.0180195861e+01, gap 0.0% Opt.value= 10.1801958607

  21. k-center problem • A facility location problem with min-max object • n=100 customers,k=10 facilities k-center (n=30,k=3) k-median (n=30,k=3)

  22. Formulation

  23. Upper and lower bounds (n=100,k=10)

  24. k-Covering Problem # of uncovered customers =1 if customer is not covered parameter that is =1 if distance is less than or equal to θ

  25. k-Covering+Binary Search Upper and Lower Bounds UB, LB while UB – LB >ε: θ= (UB+LB)/2 if opt. val. of k-covering is 0 then UB = θ else LB = θ

  26. Computational Experiments

  27. Constraint Programming (CP) • Variables x has to be selected from a finite domain (set of values) • Constraints Linear, (non-convex) Quadratic, All Different or Any Types of Combinatorial Expressions

  28. Assignment Problem (MIP/CP) • Assign three jobs A,B,C to three workers 1,2,3 • MIP formulation: xij Binary • CP formulation : x[i] with domain {A,B,C} AllDiff ( x[1], x[2], x[3] )

  29. Constraint Programming Solver SCOP (Solver for COnstraint or Programming) developed by Prof. Ibaraki and Prof. Nonobe • ITC (International Timetabling Competition) 2007 –Finalist for all 3 tracks (3rd, 2nd, 3rd among 5 finalists) • International Nurse Rostering Competition (INRC) 2010 – Finalists for all 3 tracks (2nd,3rd, 4th among 5 finalists)

  30. SCOP Objects Variable addVariable(s) Model Linear Quadratic addConstraint Alldiff

  31. Scheduling • Activities (=Variables) x has to be selected from a set of modes (=domain of CP) • Resource Renewable or Non-renewable Resources (=Constraints) • Temporal Constraints

  32. Scheduling Solver OptSeq II developed by Prof. Ibaraki and Prof. Nonobe Multi-mode RCPSP PSPLIB [Kolisch and Sprecher, 1997] 1. [De Reyck and Herroelen, 1999] 333MHz PC 2. [Heilmann, 2001] 333MHz PC 3. 1GHz PC

  33. OptSeq Objects Attribute addActivity addMode Model Mode addResource Resource addTemporal Temporal

  34. Applications • Train scheduling in a steel plant:Flow optimization using Gurobi +Detailed scheduling using OptSeq • Supply Chain Modeling Language (SCML)

  35. What’s SCML? Supply Chain Optimization Models Solvers (metaheuristics, MIP/CP solvers) SCML SCML.py Combinatorial Optimization Models

  36. Supply Chain Optimization Models • resource constrained scheduling • lot-sizing • logistics network design • safety stock allocation • economic order quantity • inventory policy optimization • vehicle routing

  37. 謝謝 Thank You ご清聴ありがとうございました

More Related