VIEWS: 38 PAGES: 106 POSTED ON: 6/6/2012 Public Domain
Perspective of supply chain optimization Tokyo University of Marine Science and Technology Mikio Kubo Agenda • Supply Chain and Analytic IT • Mathematical Programming Solver Gurobi with Python language • Constrained Programming Solver SCOP • Scheduling Solver OptSeq What’s the Supply Chain? IT(Information Technology)＋Logistics ＝Supply Chain Logistics Network Design ロジスティクス・ネットワーク設計 Vehicle Routing/Scheduling 配送計画 安全在庫配置 Safety Stock Allocation 在庫方策 Forecasting 需要予測 収益管理 Revenue Management Lot-Sizing スケジューリング Scheduling ロットサイズ決定 Logistic System, Transactional IT, Analytic IT Analytic IT brain 解析的IT Model＋Algorithm= Decision Support System Transactional IT POS, ERP, MRP, DRP… nerve 処理的IT Automatic Information Flow Logistic System=Truck, Ship, Plant, Product, Machine, … muscle 実システム Levels of Decision Making Strategic Level A year to several years; long-term decision making Analytic IT Tactical Level A week to several months; mid-term decision making Transactional IT Operational Level Real time to several days; short-term decision making Models in Analytic IT Supplier Plant DC Retailer Strategic Logistics Network Design Multi-period Logistics Network Design Tactical Inventory Production Transportation Delivery Safety stock allocation Lot-sizing Inventory policy Scheduling Vehicle Routing Operational optimization How to Solve Real SC Optimization Problems Quickly • Mixed Integer Programming (MIP) Solver Gurobi =>Logistics Network Design, Lot-Sizing • Constraint Programming (CP) Solver SCOP =>Lot-Sizing, Staff Scheduling • Scheduling Solver OptSeq =>Scheduling • Vehicle Routing Solver • Inventory Policy Optimization Solver ... using Python Language Why Python? • We can do anything by importing some modules • Optimization import gurobipy (MIP) import SCOP (CP) • Draw graphs import networkX • Also fly! import antigravity ? http://xkcd.com/353 / What’s Gurobi? MIP solver Developed by: Zonghao Gu, Edward Rothberg，Robert Bixby Free academic license Introduction to Gurobi (1) • Create a model object model = Model("Wine Blending") Introduction to Gurobi (2) • Add variable objects x1 = model.addVar(name="x1") x2 = model.addVar(name="x2") x3 = model.addVar(name="x3") • Model update (needed before adding constraints; lazy update!) model.update() Introduction to Gurobi (3) • Set the objective model.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) • Optimize model.optimize() Mr. Python is too lazy. His room is always mess. He asked to the God of Python. “How can I tide up my toys?” The God replied from the heaven. “Use the list. The charm is “Abracadabra [ ].” Mr. Python said “L=[ ].” What a miracle! Some boxes were fallen from the heaven. The God said. “Tide up the toys using these boxes.” OK. Everything is packed into the list. To pick up “Teddy”, just say “L[3].” To sort the toys in alphabetical order, just say “L.sort().” Note that L is a list object and sort() is a function defined in the object called “method.” Modeling with Lists • Add variable objects into list x=[] for i in range(3): 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 ) Mr. Python is impatient, too. He complained to the God. “I’d like to pick my toys immediately.” The God replied from the heaven again. “Use the dictionary. The charm is “Abracadabra {}.” Using lists and dictionaries, Mr. Python could manage his toys efficiently and lived happily ever after. 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”) • Add constraint model.addConstr( 2*x[“Dry”]+ x[“Medium”] +x[“Sweet”] <=30 ) Wine Blending with Dictionaries (1) Blends, Profit = multidict({"Dry":15, "Medium":18, "Sweet":30}) => Blends=["Dry", "Medium“, "Sweet“] List of Keys Profit[“Dry”]=15, Profit[“Medium”]=18, ... Grapes, Inventory = multidict({"Alfrocheiro":60, "Baga":60, "Castelao":30}) Use = { ("Alfrocheiro","Dry"):2, ("Alfrocheiro","Medium"):1, ("Alfrocheiro","Sweet"):1, ("Baga","Dry"):1, .... } Wine Blending with Dictionaries (2) x = {} for j in Blends: x[j] = model.addVar(vtype="C", name="x[%s]"%j) model.update() model.setObjective(quicksum(Profit[j]*x[j] for j in Blends), GRB.MAXIMIZE) for i in Grapes: model.addConstr(quicksum(Use[i,j]*x[j] for j in Blends) <= Inventory[i], name="use[%s]"%i) model.optimize() k-median problem • A facility location problem with min-sum object • Number of customers n=200, number of facilities selected from customer sites k=20 • Euclidian distance，coordinates are random Formulation weak formulation Python Code（1） from gurobipy import * model = Model("k-median") x, y = {}, {} # empty dictionaries Dictionary Data Structure Key Value “Hanako”, “127cm” (1,2) Mapping Variable Object Python Code （２） Add variable objects I=range(n) “B” means binary variable J=range(n) or GRB.BINARY 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)) Python Code （３） 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") 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 Upper and lower bounds 18 (Weak Formulation) 16 14 Obj. Func. Value 12 10 8 6 4 2 0 0 10 20 30 40 50 60 70 CPU 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 k-center problem • A facility location problem with min-max object • 100 customers，10 facilities k-center (n=30,k=3) k-median (n=30,k=3) Formulation Upper and lower bounds 1.2 (n=100,k=10) 1 Obj. Fun. Value 0.8 0.6 0.4 0.2 0 0 50 100 150 200 250 300 350 400 CPU Time k-Covering Problem # of uncovered customers =1 if customer is not covered parameter that is =1 if distance is less than or equal to θ 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 = θ Computational Experiments Traveling salesman problem • Find a minimum cost (distance) Hamiltonian circuit • World record 85,900 nodes (symmetric instance) -> We try to solve asymmetric ones. Miller-Tucker-Zemlin formulation Upper and lower bounds 45 （80 nodes，Euclid TSP） 40 35 30 Non-lifted MTZ constraints -> Out of memory Obj. Func. Value 25 after running 1 day 20 15 10 5 0 0 50 100 150 200 250 300 350 400 CPU Result Optimize a model with 6480 Rows, 6400 Columns and 37762 NonZeros … Cutting planes: Gomory: 62 Implied bound: 470 MIR: 299 Zero half: 34 Explored 125799 nodes (2799697 simplex iterations) in 359.01 seconds Optimal solution found (tolerance 1.00e-04) Best objective 7.4532855108e+00, best bound 7.4525704995e+00, gap 0.0096% Opt.value= 7.45328551084 Graph coloring problem • An example that has symmetric structure of solutions • Number of nodes n=40，maximum number of colors Kmax=10 • Random graph G(n,p=0.5) Formulation Weak formulation n=40， Kmax=10 12 10 Obj. Func. Value 8 6 4 2 0 0 200 400 600 800 1000 1200 1400 CPU Time Optimize a model with 3820 Rows, 410 Columns and 11740 NonZeros Explored 17149 nodes (3425130 simplex iterations) in 1321.63 seconds Improvement of the formulation Avoid symmetric variables SOS: Special Ordered Set） Type 1 model.addSOS(1,list of var.s) Avoid symmetric variables 12 10 Obj. Func. Value 8 6 4 2 0 0 50 100 150 200 250 300 350 400 450 CPU Optimize a model with 3829 Rows, 410 Columns and 11758 NonZeros Explored 4399 nodes (1013290 simplex iterations) in 384.53 seconds MIPFocus=2（priority=proving the optimality) 67sec MIPFocus=3 (priority=lower bound) 70 sec. +SOS constraints 12 10 Obj. Func. Val. 8 6 4 2 0 0 5 10 15 20 25 CPU Optimize a model with 3829 Rows, 410 Columns and 11758 NonZerosExplored 109 nodes (58792 simplex iterations) in 22.02 seconds MIPFocus=2 65 sec.，MIPFocus=3 126 sec. Fixed-K approach Number of “bad” edges If the end vertices of an edge have the same color, the edge is called bad, and the corresponding variable z is equal to 1 Fixed-K Approach +Binary Search UB, LB := Upper and lower bounds of K while UB – LB >1: K= [ (UB+LB)/2 ] [ ] : Gauss notation if obj. fun. of Fixd-K model = 0 then UB = K else LB = K Improved Formulation Fixed-K Approach +Binary Search SCOP Solver for COnstraint Programming Log Opt Co., Ltd. Agenda • Introduction • SCOP Interfaces • Demonstration • Benchmark • Case Study What’s Constraint Programming Constraint Programming is a paradigm to solve combinatorial problems efficiently • Constraint Satisfaction Problem (CSP) – seeks an assignment of values to variables such that all the given constraints are satisfied Constraint Satisfaction Problem Constraint satisfaction problem consists of: • variable: variable chooses a value from its domain. • domain: a finite set of values for each variable. • constraint: a logical relation among several variables. Weighted Constraint Satisfaction Problem (WCSP) • WCSP is an enhanced framework of CSP • Not just seeks an assignment that satisfies all of the constraints but to minimize the weighted sum of infeasibility of constraints (called penalties): – Hard Constraint weight is infinity, i.e., constraint must be satisfied – Soft Constraint weight is a positive integer, i.e., constraint may be violated by paying penalty • The goal is to minimize the total penalties =>optimization model. What’s SCOP Solver to solve a large combinatorial problems effectively • Based on Metaheuristics by Ibaraki (Kyotyo-University), Nonobe (Hosey-University) • Trial version （１５ variables available） http://www.logopt.com/scop.htm • 1. Simple modeling language (text file) • 2. Python interface SCOP is a • 3. Library （C++, .Visual Basic, C# ） solver for solving WCSP SCOP Model • variable • domain • constraint: – weight = positive integer （soft constraint） inf （hard constraint） – type = linear，alldiff, quadratic Assignment Problem • Assign 5 workers A,B,C,D,E to 3 jobs 0,1,2 • Each job (0,1,2) needs at least (1,2,2) workers • Worker A and worker C have to assign to different jobs • Assignment cost ＝ 0 1 2 A 15 20 30 B 7 15 12 C 25 10 13 The object is to minimize sum of the D 15 18 3 assignment cost E 5 12 17 Variable and domain • Variables are workers A,B,C,D,E • Domain for each variables is set of jobs {0,1,2} variable var-name in { domain } domain = value1, value2, value3, ... variable A in {0, 1, 2} variable B in {0, 1, 2} variable C in {0, 1, 2} variable D in {0, 1, 2} variable E in {0, 1, 2} Linear constraint （1） • Each job (0,1,2) needs at least (1,2,2) workers Con-name：weight= integer or inf type= linear coeff1(var-name1,value1) coeff2(var-name2,value2).... <= (>=, =) right hand side 0 1 2 hard constraint A 15 20 30 B 7 15 12 constraint0: weight=inf type=linear C 25 10 13 1(A,0) 1(B,0) 1(C,0) 1(D,0) 1(E,0) >=1 D 15 18 3 constraint1: weight=inf type=linear E 5 12 17 1(A,1) 1(B,1) 1(C,1) 1(D,1) 1(E,1) >=2 constraint2: weight=inf type=linear 1(A,2) 1(B,2) 1(C,2) 1(D,2) 1(E,2) >=2 Linear constraint （2） Wright objective function as linear constraint （object value = sum of the penalty cost） 0 1 2 A 15 20 30 B 7 15 12 Sum of the assignment C 25 10 13 hard constraint cost <=0 D 15 18 3 E 5 12 17 obj: weight=1 type=linear 15 (A, 0) 20(A, 1) 30(A, 2) 7 (B, 0) 15(B, 1) 12(B, 2) 25 (C, 0) 10(C, 1) 13(C, 2) 15 (D, 0) 18(D, 1) 3(D, 2) 5 (E, 0) 12(E, 1) 17(E, 2) <=0 Quadratic constraint Worker A and worker C have to assign to different jobs Con-name：weight= integer or inf type= quadratic coeff1(var-name1,value1) (var-name2,value2) coeff2(var-name3,value3) (var-name4,value4) .... larger than the weitht in objective function quad: weight=100 type=quadratic 1 (A,0) (C,0) 1 (A,1) (C,1) 1 (A,2) (C,2) <=0 Alldifferent constraint Worker A and worker C have to assign to different jobs Con-name：weight= integer or inf type= alldiff var-name1 var-name2 var-name3 .... ; AllDiff: weight= 100 type=alldiff A C ; How to use SCOP solver • Start with Command Poompt (or Colsole) • scop < file name • scop -（option） <file name • scop -help (display all of the SCOP options) SCOP options -noadjust deactivate weight adjustment mechanism -display # set log display level -iteration # set iteration limit -interval # set log display interval -noimprovement # set iteration limit for no improvement -seed # set random seed -target # set target -time #.# set CPU time limit in second Result (solved by SCOP) scop <ex3-scop.dat # reading data ... done: 0.00(s) penalty = 1/52 (hard/soft), time = 0.00(s), iteration = 0 Obj : 52 =15+12+10+3+12 # improving the initial solution greedily penalty = 0/157 (hard/soft), time = 0.00(s), iteration = 0 # start tabu search penalty = 0/60 (hard/soft), time = 0.01(s), iteration = 0 1 2 2 penalty = 0/52 (hard/soft), time = 0.01(s), iteration = A 15 20 30 8 # penalty = 0/52 (hard/soft) B 7 15 12 # cpu time = 0.01/0.03(s) # iteration = 8/100 C 25 10 13 [best solution] A: 0 B: 2 D 15 18 3 C: 1 D: 2 E: 1 E 5 12 17 penalty: 0/52 (hard/soft) [Violated constraints] obj: 52 Summary 1. variable & domain variable var-name in { value1, value2, ... } 2. target （sum of the penalty） target = target-value 3. constraints con-name: weight = interger / inf type = linear / quadratic / alldiff cnstraint Steps 1 and 2 have to declare before Step 3！ Graph Coloring ・・・ Have to assign to different color class! Graph Coloring Graph Coloring Programs SCOP Gurobi Test results (Graph Coloring) • Fixed the number of color # of nodes # of edges # of colors SCOP Gurobi (seconds) (seconds) 30 0.5 7 0.01 0.07 50 0.5 9 0.16 29 100 0.5 15 0.66 - *(1) 500 0.5 54 50.9 - 800 0.5 80 74.45 - *(1) 16 constraint violation after 828 seconds Quadratic Assignment Problem 3 2 5km 2km 1 1km - - The number of times Distances between who meets each other two houses in one week Quadratic Assignment Problem - - 1 2 5km 2km 1km 3 - - 2×2＋5×1＋1×3＝12km Test result (QAP) nodes Gurobi (seconds) SCOP Gaps % (seconds) (Gurobi/SCOP) 5 0.03 0.01 0 8 12.84 0.23 0 10 1589 1.76 0 20 140 138.2 4.9 25 300 298.2 3.5 30 540 534.4 1.5 Application of SCOP • Staff scheduling problem • Time tabling problem • Graph partition problem • Maximum stable set problem • Graph coloring problem • Quadric assignment problem • Travelling sails man problem • Multiple knapsack problem • Process Scheduling in Chemical Plants Scheduling optimization system OptSeq Log Opt Co., Ltd. http://www.logopt.com/OptSeq/OptSeq.htm What is the scheduling? • Allocation of activities (jobs, tasks) over time – Resource constraints. For example, machines, workers, raw material, etc. may be scare resources. – Precedence (or temporal) relation between activities. For example., some activities cannot start unless other activities finish. Take off the airplane a.s.a.p. ! You’re a consultant of an airline company. Your job is to find a schedule that takes off the airplane as soon as possible. We need several activities before taking off the airplane. Firstly let the passengers get off and unload their baggage; secondly clean up the cabin; finally let new passengers get on and load their baggage. What is the best (shortest) schedule for taking off the airplane? PERT • PERT: Program Evaluation and Review Technique that was used to get a schedule during World War II 作業1 Act 1 Act 3 作業3 Act 4 作業4 Completion time (make-span) is minimized 13分 15分 27分 Act sink ダミー作業 Temporal relation Dummy activity (take-off) Act 2 作業2 Act 5 作業5 Activity1：Get off passengers (13 min.) Activity2：Unload baggage (25 min.) 25分 22分 Activity3：Clean up the cabin (15 min.) Activity4：Get on passengers (27 min.) Activity5 ：Load baggage (22 min.) Modeling with OptSeq （１） Activity Duedate is optional Description of activity Activity-Name duedate Integer+ Activity mode duration Integer+ Activity must have at least one mode (the way to execute the activity) E.g., to add an activity named act1 with duration (processing time) 13 : activity act1 mode duration 13 Modeling with OptSeq （2） Temporal Constraint Description of Temporal Constraint temporal Predecessor Successor E.g., to define that activity act3 must start after finishing activity act1: temporal act1 act3 Modeling with OptSeq （3） Objective Objective Minimize the latest completion time (makespan) sink: the dummy activity that must be executed after all activities We minimize the delay time of sink: Description of activity Activity-Name duedate Integer+ Activity activity sink duedate 0 Optimization and Result Time Limit is 3 sec. optseq -time 3 < Input-file-name Result --- best solution --- source ---: 0 0 dummy source starts and finishes at time 0 sink ---: 55 55 dummy sink starts and finished at time 55 activity[1] ---: 0 0--13 13 activity[2] ---: 0 0--25 25 activity[3] ---: 13 13--28 28 activity[4] ---: 28 28--55 55 activity[5] ---: 25 25--47 47 objective value = 55 latest completion time (makespan) is 55 cpu time = 0.00/3.00(s) computational time is 0 sec. iteration = 1/62605 number of iteration of tabu search is 1 PERT with Resource Constraint Description of resource Resource-Name Resource interval Time1 Time2 capacity Integer+ ... “Interval 1 3” means period 1, 2 Period Time Modeling Resources with OptSeq Resource “worker” can be used from resource worker interval 0 inf capacity 1 0 to infinity （inf） with capacity 1 Activity requires activity Activity-Name resource Resource-Name interval Time1 Time2 requirement Integer+ ... Activity “act1” activity act1 requires resource mode duration 13 “worker” by 1 unit worker interval 0 13 requirement 1 Optimization and Result Result source ---: 0 0 sink ---: 102 102 activity[1] ---: 47 47--60 60 activity[2] ---: 0 0--25 25 activity[3] ---: 60 60--75 75 activity[4] ---: 75 75--102 102 activity[5] ---: 25 25--47 47 objective value = 102 cpu time = 0.00/3.00(s) iteration = 0/64983 Optimal solution （Gantt’s chart） 作業1 作業3 作業4 13分 15分 27分 作業2 作業5 25分 22分 ０ 55 時間 Resource constrained schedule (unit resource upper bound) 作業3 作業2 作業1 作業4 作業5 15分 25分 13分 27分 22分 ０ 時間 102 Example 2 Minimize the Pit-in time! You’re a staff of F1 race. There are three pit staffs who have to do some tasks for your F1 car. Find the best schedule that minimizes the pit-in time. Temporal (Precedence) relation and the processing time gas 3秒 3 sec. 作 １ 業 Task 作 業 Task ９ 3 staffs 11 sec. 11 秒 (resource constraint) WA TE R 2 2 sec. 秒 作 業 Task ２ 業 作 ５ Task 4 sec. 4 2秒 秒 2 sec. 作 業 Task ６ 作 ３ 業 Task 4 sec. 4 秒 Task ７ 作 業 22sec. 秒 4秒 4 sec. 業 Task ０ 作 １ Task ８ 作 業 2 sec. 2秒 4 sec. 4 秒 業 作 ４ Task Modeling with OptSeq -using a resource with capacity 3- Define a resource “worker” with resource worker interval 0 inf capacity 3 capacity 3 activity prepare mode duration 3 worker interval 0 3 requirement 1 ．．． temporal prepare oil Temporal temporal jackup tire1 constraints ．．． Minimize the makespan activity sink duedate 0 Optimization by OptSeq and Gantt’s chart source ---: 0 0 sink ---: 14 14 prepare ---: 0 0--3 3 water ---: 0 0--2 2 front ---: 0 0--2 2 jackup ---: 2 2--4 4 tire1 ---: 8 8--12 12 tire2 ---: 4 4--8 8 tire3 ---: 8 8--12 12 tire4 ---: 4 4--8 8 oil ---: 3 3--14 14 jackdown ---: 12 12--14 14 objective value = 14 cpu time = 0.00/3.00(s) iteration = 0/37644 Another Model - using multiple modes - Mode ： The way for processing an activity Example： Activity “Buy a juice” 1. Convenience Store Mode： Duration (Processing Time) 20 min. requires Money Resource 110 yen and human resource 1 2. Vending Machine Mode： Duration 20 min. requires Money 120 yen and human resource 1 3. Supermarket Mode: Duration 20 min. requires Money 120 yen, human resource 1 and car resource 1 Mode (1) Description of Mode mode Mode-Name duration Processing-Time Resource-Name interval Time1 Time2 requirement Integer+ ... Add modes activity Activity-Name to activity Mode-Name1 Mode-Name2 .... Mode (2) E.g., an activity has 3 difference modes; m1, m2 and m3： Mode Resource mode m1 duration 3 worker interval 0 3 requirement 1 single worker mode mode m2 duration 2 worker interval 0 2 requirement 2 double worker mode mode m3 duration 1 worker interval 0 1 requirement 3 triple worker mode activity prepare Add 3 modes to m1 m2 m3 activity “prepare” Result and Gantt’s chart --- best solution --- source ---: 0 0 sink ---: 13 13 prepare m3: 0 0--1 1 water ---: 1 1--3 3 front ---: 11 11--13 13 jackup ---: 1 1--3 3 tire1 ---: 7 7--11 11 tire2 ---: 3 3--7 7 tire3 ---: 7 7--11 11 tire4 ---: 3 3--7 7 oil ---: 1 1--12 12 jackdown ---: 11 11--13 13 activity “prepare” was done by mode m3, i.e., objective value = 13 execute by 3 worker with duration 1 cpu time = 0.00/3.00(s) iteration = 7/23318 Resource Constrained Project Scheduling Duration : 2 days １ worker on the 1st dat １階 屋根 2 workers on the 2nd day First Floor Ceiling Basement 土台 Completion! 1 worker rests on 完成！ the 3rd day Workers 資源量（人） 2 内装 Interior 0 3 時間（日） Modeling with OptSeq (1) resource worker Time Dependent interval 0 2 capacity 2 Resource Capacity interval 2 3 capacity 1 interval 3 inf capacity 2 Resource Capacity １ ０ ２ ３ Modeling with OptSeq (2) activity first Time Dependent mode duration 3 Resource Usage of worker interval 0 1 requirement 2 Activity worker interval 1 3 requirement 1 Optimal Solution Resource Capacity 資源量（人） 時間（日） Resource Constrained Project Scheduling (RCPSP) is a generic model （job shop and flow shop scheduling problems are special cases.) Critical Path Method (CPM) Consider “Take off the airplane” again! However, each activity has an emergency mode Activity1：Get off passengers (13min.) => Emergency mode (10 min. ) requires 10000 yen Activity2：Unload baggage (25min.) => Emergency mode (20 min. ) requires 10000 yen Activity3：Clean up the cabin (15min.) => Emergency mode (10 min. ) requires 10000 yen Activity4：Get on passengers (27 min.) => Emergency mode (25 min. ) requires 10000 yen Activity5 ：Load baggage (22 min.) => Emergency mode (20 min. ) requires 10000 yen Renewable Resources and Non-renewable Resources • Renewable resources can be used again after the completion of activities; for example, machines and/or workers are renewable • Non-renewable resources are not renewed after the completion of activities; for example, money and/or ingredients are non-renewable CPM can be modeled using a non-renewable resource Modeling with OptSeq (1) Activity 1 “Get off passengers” takes: 13 minutes (normal mode) m[1][1] or 10 minutes (emergency mode) m[1][2] mode m[1][1] duration 13 mode m[1][2] duration 10 activity activity[1] m[1][1] m[1][2] Modeling with OptSeq (2) Declaration of nonrenewable non-renewable Amount1 (Activity-Name1,Mode-Name1) resource Amount2 (Activity-Name2,Mode-Name2) ... <= Upper-Bound (or Capacity) Budget (Capacity of money resource) is 40000 yen. nonrenewable +1 (activity[1],m[1][2]) +1 (activity[2],m[2][2]) +1 (activity[3],m[3][2]) +1 (activity[4],m[4][2]) +1 (activity[5],m[5][2]) <= 4 Note that Amounts and Capacity may be 0 or negative integer. Results Emergency mode 作業1 作業3 作業4 4万 円 10分 10分 25分 Budget is 作業2 作業5 40000 yen. 20分 2 2分 ０ 45 時間 作業1 作業3 作業4 1万 円 13分 10分 27分 Budget is 作業2 作業5 10000 yen. 25分 2 2分 ０ 52 時間 作業1 作業3 作業4 0万 円 13分 15分 27分 Budget is 作業2 作業5 25分 2 2分 0 yen. ０ 55 時間 Type of precedence relation – ＝１：Finish ->Start – ＝２：Finish ->Finish – ＝３：Start ->Start – ＝４：Start ->Finish Finish Start Predecessor Successor Set-up time lower bound Set-up time upper bound OptSeq Capability • OptSeq is a solver for Resource Constrained Project Scheduling Problem with: – Time-Dependent Resource Usage and Capacity – Non-renewable Resource Constraints – Generic Temporal Constraints also it is possible to: – declare activities are breakable and/or processed in parallel – add “states” to represents the generic states of the system