Inchon2012

advertisement
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
brain
解析的IT
処理的IT
nerve
Analytic IT
Model+Algorithm=
Decision Support System
Transactional IT
POS, ERP, MRP, DRP…
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
Operational Level
Transactional IT
Real time to several days;
short-term decision making
Models in Analytic IT
Supplier
Plant
Retailer
DC
Logistics Network Design
Strategic
Multi-period Logistics Network Design
Tactical
Operational
Inventory
Production
Safety stock allocation
Inventory policy
optimization
Lot-sizing
Scheduling
Transportation
Delivery
Vehicle Routing
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
“Hanako”,
(1,2)
Mapping
Value
“127cm”
Variable Object
Python Code (2)
Add variable objects
I=range(n)
J=range(n)
for j in J:
“B” means binary variable
or GRB.BINARY
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 (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")
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
(Weak Formulation)
18
16
Obj. Func. Value
14
12
10
8
6
4
2
0
0
10
20
30
40
CPU
50
60
70
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
(n=100,k=10)
1.2
Obj. Fun. Value
1
0.8
0.6
0.4
0.2
0
0
50
100
150
200
CPU Time
250
300
350
400
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
(80 nodes,Euclid TSP)
45
40
35
Non-lifted MTZ constraints
-> Out of memory
after running 1 day
Obj. Func. Value
30
25
20
15
10
5
0
0
50
100
150
200
CPU
250
300
350
400
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
Obj. Func. Value
10
8
6
4
2
0
0
200
400
600
800
1000
1200
CPU Time
Optimize a model with 3820 Rows, 410 Columns and 11740 NonZeros
Explored 17149 nodes (3425130 simplex iterations) in 1321.63 seconds
1400
Improvement of the formulation
Avoid symmetric variables
SOS: Special Ordered Set) Type 1
model.addSOS(1,list of var.s)
Avoid symmetric variables
12
Obj. Func. Value
10
8
6
4
2
0
0
50
100
150
200
250
300
350
400
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.
450
+SOS constraints
12
Obj. Func. Val.
10
8
6
4
2
0
0
5
10
15
20
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.
25
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 (15 variables available)
http://www.logopt.com/scop.htm
• 1. Simple modeling language (text file)
• 2. Python interface
• 3. Library (C++, .Visual Basic, C# )
SCOP is a
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
0
1
2
• Assignment cost =
The object is to
minimize sum of the
assignment cost
A
15
20
30
B
7
15
12
C
25
10
13
D
15
18
3
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
variable
variable
variable
variable
A in {0, 1, 2}
B in {0, 1, 2}
C in {0, 1, 2}
D in {0, 1, 2}
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
hard constraint
constraint0: weight=inf type=linear
1(A,0) 1(B,0) 1(C,0) 1(D,0) 1(E,0) >=1
constraint1: weight=inf type=linear
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
0
1
2
A
15
20
30
B
7
15
12
C
25
10
13
D
15
18
3
E
5
12
17
Linear constraint (2)
Wright objective function as linear constraint
0
(object value = sum of the penalty cost)
1
2
A
15
20
30
B
7
15
12
C
25
10
13
D
15
18
3
E
5
12
17
hard constraint
Sum of the assignment
cost <=0
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
# 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 =
2
penalty = 0/52 (hard/soft), time = 0.01(s), iteration =
8
# penalty = 0/52 (hard/soft)
# cpu time = 0.01/0.03(s)
# iteration = 8/100
[best solution]
A: 0
B: 2
Obj : 52 =15+12+10+3+12
0
1
2
A
15
20
30
B
7
15
12
C
25
10
13
D
15
18
3
E
5
12
17
C: 1
D: 2
E: 1
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
(seconds)
Gurobi
(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
1
The number of times
who meets each other
in one week
5km
2km
1km
-
-
Distances between
two houses
Quadratic Assignment Problem
-
-
1
5km
2
2km
1km
3
-
-
2×2+5×1+1×3=12km
Test result (QAP)
nodes
Gurobi (seconds)
SCOP
(seconds)
Gaps %
(Gurobi/SCOP)
5
0.03
0.01
0
8
12.84
0.23
0
10
1589
1.76
0
20
140
4.9
25
300
540
138.2
298.2
534.4
1.5
30
3.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
Act 1
作業1
Act
3
作業3
13分
15分
Act 4
作業4
Completion time
(make-span) is minimized
27分
Dummy activity
(take-off)
Temporal relation
Act 2
作業2
25分
Act sink
ダミー作業
Act 5
作業5
22分
Activity1:Get off passengers (13 min.)
Activity2:Unload baggage (25 min.)
Activity3:Clean up the cabin (15 min.)
Activity4:Get on passengers (27 min.)
Activity5 :Load baggage (22 min.)
Modeling with OptSeq (1)
Activity
Duedate is optional
Description of
Activity
activity Activity-Name duedate Integer+
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 Activity-Name duedate Integer+
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 Resource-Name
interval Time1 Time2 capacity Integer+
...
“Interval 1 3” means period 1, 2
Period
Time
Modeling Resources with OptSeq
Resource “worker”
can be used from
0 to infinity (inf)
with capacity 1
Activity requires
resource
Activity “act1”
requires resource
“worker” by 1 unit
resource worker interval 0 inf capacity 1
activity Activity-Name
Resource-Name interval Time1 Time2
requirement Integer+
...
activity act1
mode duration 13
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
15分
13分
27分
作業5
作業2
25分
22分
0
時間
55
Resource constrained schedule (unit resource upper bound)
15分
0
作業1
作業2
作業3
25分
作業4
13分
作業5
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
33sec.
秒
作
業1
Task
作業9
Task
11
11 sec.
3 staffs
(resource constraint)
秒
R
TE
WA
Task
作業2
22sec.
秒
作
業5
Task
2秒
2 sec.
Task
作業6
作
業3
Task
Task
作業7
Task
作業8
Task
作
業4
22秒
sec.
44 sec.
秒
44 sec.
秒
44秒
sec.
4
4 sec.
秒
22sec.
秒
Task
作
業10
Modeling with OptSeq
-using a resource with capacity 3Define a resource
resource worker interval 0 inf capacity 3
“worker” with
capacity 3
activity prepare
mode duration 3
worker interval 0 3 requirement 1
...
Temporal
constraints
temporal prepare oil
temporal jackup tire1
...
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
to activity
activity Activity-Name
Mode-Name1 Mode-Name2
....
Mode (2)
E.g., an activity has 3 difference modes; m1, m2 and m3:
Mode
mode m1 duration 3
worker interval 0 3 requirement 1
mode m2 duration 2
worker interval 0 2 requirement 2
Resource
single worker mode
double worker mode
mode m3 duration 1
worker interval 0 1 requirement 3
activity prepare
m1 m2 m3
triple worker mode
Add 3 modes to
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
objective value = 13
cpu time = 0.00/3.00(s)
iteration = 7/23318
activity “prepare” was done by mode m3, i.e.,
execute by 3 worker with duration 1
Resource Constrained Project Scheduling
Duration : 2 days
1 worker on the 1st dat
2 workers on the 2nd day
1階
屋根
Basement
First Floor
Ceiling
Completion!
土台
完成!
Workers
1 worker rests on
the 3rd day
資源量(人)
内装
2
Interior
0
3
時間(日)
Modeling with OptSeq (1)
Time Dependent
Resource Capacity
resource worker
interval 0 2 capacity 2
interval 2 3 capacity 1
interval 3 inf capacity 2
Resource Capacity
1
0
2
3
Modeling with OptSeq (2)
Time Dependent
Resource Usage of
Activity
activity first
mode duration 3
worker interval 0 1 requirement 2
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
non-renewable
resource
nonrenewable
Amount1 (Activity-Name1,Mode-Name1)
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
作業1
4万 円
作業3
作業4
10分
10分
Emergency mode
Budget is
40000 yen.
25分
作業5
作業2
20分
2 2分
0
45
作業1
1万 円
作業3
作業4
Budget is
10000 yen.
27分
10分
13分
作業5
作業2
25分
2 2分
0
0万 円
時間
52
作業1
作業3
作業4
15分
13分
27分
作業5
作業2
25分
時間
2 2分
Budget is
0 yen.
0
時間
55
Type of precedence relation
–
–
–
–
=1:Finish ->Start
=2:Finish ->Finish
=3:Start ->Start
=4: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
Download