Document

advertisement
An Introduction to Max-plus Algebra
Hiroyuki Goto
Department of Industrial & Systems Engineering
Hosei University, Japan
Outline of Today's Tutorial
Part I. Introduction
Why max-plus algebra?
What is max-plus algebra?
How to use?
Part II. Relevant Topics
Where is max-plus algebra?
Relevance with close fields
• Control theory, graph theory, discrete mathematics
Part III. Miscellaneous Topics & Recent Advances
Extensions to wider classes
Extension stochastic systems
1
Part I. Introduction
2
Why Max-Plus Algebra?
Simple Scheduling Problem based on PERT
• PERT: Performance Evaluation and Review Technique
Project with four activities
Activity Days
Predecessors
A
dA
--
B
dB
A
C
dC
A
D
dD
B, C
AON (Activity on Node)
B
A
dA
dB
C
D
dD
dC
AOA (Activity on Arrow)
u
Start
A
B
dA
dB
C dC
Earliest node times
D
x1  u , x2  x1  d A , x3  x2  d C ,
dD
x4  max( x2  d B , x3 ), x5  x4  d D ,
y
y  x5
Finish
event/state
3
Earliest Node Times
Derive an explicit form
Eliminate xi on
x1  u,
the right handx2  x1  d A ,
side
x3  x2  dC ,
x4  max(x2  d B , x3 ),
x5  x4  d D ,
y  x5
Completion
0
 x1   u  

    

dA
 x2   u  

 x   u   

d

d
A
C
 3   

 x4   u   d A  max(d B , d C ) 
 x     d  max(d , d )  d 
B
C
D
 5  u   A
(output) time
u
A
B
D
dA
dB
dD
C dC
y  x5  u  d A  max(d B , d C )  d D
Lapse of time: '+' operation
Synchronization: 'max' operation
y
4
Latest Node Times
Calculate the times from downstream to upstream
 x1   y   d D  max(d B , d C )  d A 
    


 x2   y   d D  max(d B , d C ) 
 x    y   

x3  x4  0,
dD
3
    

x2  min( x3  d C , x4  d B ),
dD
 x4   y  

 x    

x1  x2  d A , Eliminate x using
y
0

 5   
i
min(a,  b)   max(a, b)
x5  y
x4  x5  d D ,
Slack time (margin)







fW  xj  xi  dW
f A   x2  x1  d A  
0

 
 

f B   x4  x2  d B   max(d C  d B , 0) 




x3  x2  d C
fC
max(d B  d C , 0) 
 
 






f D   x5  x4  d D  
0

Critical path A, D, and (B or C)
u
A
B
D
dA
dB
dD
C dC
y
5
Features of PERT
Traditional PERT can describe
Precedence relationships between activities
Duration time of each activity
Limitation: cannot describe other practical constraints
such as
A single worker (resource) is assigned to multiple activities
The facilities (resources) process the same job repeatedly
Resource conflict may occur, etc.
Modeling and analysis method using max-plus
algebra is an useful alternative approach
6
What is max-plus algebra?
Basic operations
Addition:
x  y  max( x, y )
Multiplication: x  y  x  y
R max  R  {}
x, y  R max
‘O-plus’
‘O-times’
Priorities of operators: '*' > '+' (same as conventional algebra)
Subtraction ‘-’ and division '/' : not defined directly
Zero element: (  )
Unit element: (e  0)
x     x  x
xe  e x  x
Correspond to
0 (  log 0)
1
(e  log 1)
• Examples
5  3  max(5, 3)  5
5    max(5,  )  5
4    4  (  )    
e3  03  3
53  53  8
5  9  7  1  8
7
Behavior of a Production System
Production system with 3 machines
Non-concurrency = each machine cannot
process multiple materials at the same time
x1
u1
M1
x3
y
d1
x2
u2
k : Job number
x i : Completion time in machine i
u i : Material feeding time in input i
y : Finish time
M3
d3
M2
d2
Lapse of time: '+' operation
Sync., non-concurrency: 'max'
Earliest processing start times / output time
x 1 (k )  d1  max{u1 (k ), x 1 (k  1)}
x 2 (k )  d 2  max{u2 (k ), x 2 (k  1)}
x 3 (k )  d 3  max{x1 (k ), x2 (k ), x 3 (k  1)}
y (k )  x3 (k )
8
Matrix Operations
Same rules as conventional algebra
Addition:
[ X  Y ]ij  [ X ]ij  [Y ]ij
n
n p
X , Y  R m
Z

R
max
max
n
Multiplication: [ X  Z ]ij   [ X ]il  [ Z ]lj  max{[ X ]il  [ Z ]lj }
l
l 1
[ X  Y ]ij  [ X ]ij  [Y ]ij
n
[ X  Z ]ij   [ X ]il  [ Z ]lj
l 1
Zero matrix: ε All elements are 
Unit matrix: e Diagonal elements: e, off-diagonal elements: 
• Examples
 e     1 11  e  1   11  e 11

  
  
  

 3 2   1    3 1 2     3 2 
 e     1 11  e  1    1 e  11        1 11 

  
  
  

 3 2   1    3  1  2  1 3  11  2     3 14 
9
Matrix Representation (1)
Earliest node times of
the four-activity project
x1  u,
x2  x1  d A ,
x3  x2  d C ,
x4  max(x2  d B , x3 ),
x5  x4  d D ,
y  x5
u
A
B
D
dA
dB
dD
C dC
Dummy task (synchronization) Initial state
 

dA
x  

 
 



dC
dB

 
 
 
e 
 dD

e

 


  x      u

 



 
 
Precedence relations & elapsed times
y      e   x
Linear form in max-plus algebra:
y
x  A x b
⇒ MPL (Max-Plus Linear) form
10
Matrix Representation (2)
Earliest schedule of the threemachine production system
x 1 (k )  max{x 1 (k  1)  d1 , u1 (k )  d1}
x 2 (k )  max{x 2 (k  1)  d 2 , u2 (k )  d 2 }
x 3 (k )  max{x1 (k )  d 3 , x2 (k )  d 3 , x 3 (k  1)  d 3 }
y (k )  x3 (k )
Predecessors
 

x (k )   
d
 3
Non-concurrency
 
 d1


    x (k )   
 
d 3  


d2

u1
x1
1
d1
u2
x3
x2
y
3
2
d3
d2
External inputs
 
 d1


   x (k  1)   
 
d 3 

 

d 2   u( k )
 
y (k )    e   x (k )
MPL form: x ( k )  F  x ( k )  P  x ( k  1)  B  u( k )
11
How to Solve the Equation?
Cf. In conventional algebra,
Substitute iteratively
x

A

x

b

A

(
A

x

b
)

b
x  A x b
1
x

(
I

A
)
b
2
 A  x  (e  A)  b
3
2
 A  x  (e  A  A )  b

 A s  x  (e  A  A2    A s 1 )  b
If the precedence relationships are represented by a DAG
(Directed Acyclic Graph),
 (e  A  A2    A s 1 )  b  A*  b
Kleene Star (Closure)
s
A
 s 1
 ε, A
 ε (1  s  n)
(nilpotent)
12
Interpretation of the Representation Matrix
Solution of the recursive linear equation

 
x  A  x  b A: precedence relations

b: start time
x  A*  b
j: source node
e



dA
e

A*  
d A  dC
dC

d B  dC
 d A  (d B  d C )
 d  (d  d )  d
(d B  d C )  d D
B
C
D
 A




e

e
dD
e
dD
dA
A 

 
 

yCx
C      e  : final node




dC


dB

e 
 dD

e

 


 , b      u

 



 
 






e  i: destination node
: earliest arrival times between two nodes
= longest paths
Output time

u
A
B
D
dA
dB
dD
C dC
y
13
Earliest Times of the Production System
Earliest times of the system with 3 machines
x (k )  F  x (k )  P  x (k  1)  B  u(k )
x  A x b
 

F  
d
 3
x  A*  b
 
 d1


  , P   
 
d 3  


d2

 
 d1


 , B   
 
d 3 

 

d2 
 
u1
x1
1
d1
x (k )  F *  [ P  x (k  1)  B  u(k )]
y (k )  C  x (k )
 d1

*
F P  
d  d
3
 1

d2
d 2  d3
u2
y
3
x2
2
d3
d2
 
 d1
 *

 , F  B   
d  d
d 3 
3
 1
: earliest processing times between
two nodes
x3



d2 
d 2  d 3 
: earliest processing times from
the external inputs
14
Focusing on the Latest Time
Latest node times of the four-activity project
x1  x2  d A ,
x2  min(x3  dC , x4  d B ),
x3  x4  0,
x4  x5  d D ,
x5  y
Min.: [ X ]ij  [Y ]ij  min([ X ]ij , [Y ]ij )
Pseudo division:
'min' and '-'
operators appear
 d A

 
x    

 
 


dC




dB
e

dD
[ XY ]ij  min ([ X ]il  [Y ]lj )
l
 

dA
A 

 
  
  






dC
dB

 
e 
 dD



 , C      e 


 
 

 

T
T





 x   y  A x  C  y

 
dD 

e
 
 
15
Solution of the Recursive Equation
Solve (a kind of) recursive linear equation
Latest times
Cf. Earliest times
x  AT x  d
x  A x b
x  A d
x  A b
*
*T
 d A  (d B  d C )  d D 


x  A x  C  y
 (d B  d C )  d D 

 A*T (C T  y )  (C  A* )T  y  y  
dD


dD

 : the same


B
A
D
e

 as p.5
u
T
T
dA
dB
C dC
dD
y
X T (Y T Z )  (Y  X )T Z
16
Part II. Relevant Topics
17
Relevant Fields
Modern control theory
State monitoring and control of systems
•
•
•
•
Control input: start time of a job
Control output: end time of a job
State variable: event occurrence time
System parameter: duration time
Petri net
Representation of the behavior of event-driven systems
•
•
•
•
•
Structure: synchronization, parallel processing, etc.
Place: conditions for event occurrence (non-concurrency, capacity)
Transition: event occurrence, start/completion of an event
Arc: precedence constraint, sequence of events
Marking: system’s state
18
Relevance with Modern Control Theory
Earliest schedule for the 3-machine production system
x(k )  F * [ P  x(k 1)  B  u(k )]
y (k )  C  x (k )
Generalized representation
x (k )  A  x (k  1)  B  u(k )
y (k )  C  x (k )
x (t )  Ax (t )  Bu(t )
Cf.
y (t )  Cx (t )
Same form as the state-space representation
Some methods in modern control theory can be applied
• Internal model control, model predictive control, adaptive control, etc.
19
Relevance with Petri net
Behavior of TEGs: expressed by an MPL form
TEG: Timed Event Graph
All places have one input and one output transitions
x1
u1
M1
d1
u2
M2
x3
x2
y
M3
d3
Capacity=1
x1
u1
Capacity=+Inf
x3
d2
Capacity of places
Internal: 1
External: +Inf
u2
y
d1 x2
d3
d2
20
Ultra-discretization (1)
Ramp function
y
 x ( x  0)
R( x)  
 max( x, 0)  x  0
0 ( x  0)
S ( x) 
ln[exp(ux)  exp(0)]
 R( x)
u
(u  )
max operation is related to
exp and log functions
y  R(x)
x
O
y
u=1
u=5
u=10
R(x)
0.5
x
0
-1
-0.5
0
0.5
21
Ultra-discretization (2)
Variable transformation
x  exp(uX ), y  exp(uY ), z  exp(uY )
and let u   (ultra-discretization)
Addition z  x  y exp(uZ )  exp(uX )  exp(uY )
ln(euX  euY )
Z  lim
 max( X , Y )  X  Y
u 
u
Multiplication z  x  y exp(uZ )  exp(uX )  exp(uY )
ln(e uX  e uY )
Z  lim
 X  Y  X Y
u 
u
Zero & unit elements
• Zero element: x  0, X  
• Unit element: x  1, X  0
22
Semiring & Dioid
Semiring
x, y , z  D
Commutative law: x  y  y  x
Associative laws: ( x  y )  z  x  ( y  z ), ( x  y )  z  x  ( y  z )
Distributive laws: x  ( y  z )  ( x  y )  ( x  z ),
( x  y)  z  ( x  z)  ( y  z)
Three axioms for e and :
x      x  x, x  e  e  x  x, x    e    
(D, , ) is a semiring
Dioid (idempotent semiring)
+Idempotency x  x  x (does not hold in usual algebras)
(D, , ) is a Dioid
23
Some Classes of Dioid
(D, , )
(R  {}, max, ),
( , e)
(, 0)
Max-plus algebra:
Max-times algebra:
(0, 1)
([0, 1], max, ),
Min-max algebra: (R  {}, min, max), (,  )
(R  {}, min),
(, 0)
Min-plus algebra:
({0, 1}, max, min),
(0, 1)
Boolean algebra:
Note:
These are widely referred to as *** algebra,
but are not an algebra in a strict sense
because of x  x  x
24
Communication Graph
State transition graph of a representation matrix
Node: state (of jobs, facilities)
Weight of an edge: transition time
Example
4
5
7
[ A k ]ij
3
: Reachable with
k steps from j -> i
maximum
cumulative weight


4
A
7



A 3
  



  

2
, A 

5  
9


10
 3  







12









  

  
  

8   

 



 
4
, A 


 


 
 










 
25
Eigenvalue problem
A x    x
Num. eigenvalues of square matrices: n or smaller
1   e
e

     1   
 2   
 
 1    
 

     2   
 2   e 
e
 e e  e 
e

     e   
 1  
 
 e e e
e

     1   
 1 1
1
e 1  2
 ,  ,  , 
1  2  3
1
2
0
1
0
These are all eigenvectors
-> indeterminacy for constant offsets
(Set e for the minimum non- element)
26
Eigenvalue of a reduced matrix
Only one eigenvalue
Maximum average cumulative weight among all cycles
| p |w
All elements of eigenvectors are non-
  max
pC ( A )
 3 7   2.5 
 2.5 

     4.5   
 2 4  e 
 e 
3
 3 5  1
1

     4   
 2 4 e
e
3
4
2
C ( A) : Cycle in Graph A
p : Path of the cycle
| p |w : Weight of the
7
4
2
| p |l
path
| p |l : Length of the
path
5
 3 3 1
1

     3   
 2 2 e
e
3
2
2
3
27
Kleene Star In Max-Plus Algebra
Also referred to as the Kleene Closure
Collection of symbols of generated by arbitrary repetitions of
an operation
(p.25)
In Max-plus algebra
A  e  A A
*
2

   A


4
A
7



  

  
5  

 3  
e

4
*
A 
9

12

  

e  
5 e 
l
l 0
longest paths for all node pairs
[ A* ]ij
≠  : maximum cumulative
weights from node j -> i
=  : not reachable from
node j -> i
4
5
7
3

8 3 e 
28
Kleene Star In Some Classes

s
l 0
l 0
A*  e  A  A2     Al   Al
Directed Acyclic Graph (DAG)
(finite number of terms)
Today's main target
• There is no path with s steps or greater
Al  ε (s  n, l  s)
Connected graph with non-positive maximum circuit
weight
• Any non-positive circuit cannot be the longest path
s
Al   Al (s  n, l  s)
l 0
29
Part III. Miscellaneous
Topics & Recent Advances
30
Tetris-Like Schedule
Earliest schedule of 3 blocks
Block = relative times are fixed
Pre- and post- processing tasks
Facility interference
k
k : Block (job) number
x i : Upper-end position of resource i
x2 (k )  max{x2 (k  1)  1, x3 (k  1)  2}
x3 (k )  max{x2 (k  1)  2, x3 (k  1)  3}
k-1
Resource 1
2
3
4
5
x1 (k )  x1 (k  1), x4 (k )  x4 (k  1), x5 (k )  x5 (k  1)
xi (k )  max{x j (k  1)  (ui  l j ), }
j
u i , li : relative upper-/lower- end
positions of resource i
xi (k )  xi (k  1) : Resource i is not used
Lapse of time: '+'
Non-concurrency: 'max'
31
Matrix Representation
Earliest times of the Tetris
type schedule
x1 (k )  x1 (k  1)
x2 (k )  max{x2 (k 1)  1, x3 (k 1)  2}
Diagonal: block depth
e     


x3 (k )  max{x2 (k 1)  2, x3 (k 1)  3}
 1 2  
x4 (k )  x4 (k  1)
x (k )    2 3     x (k  1)
x5 (k )  x5 (k  1)


   e 
     e


k
Non-diagonal:
completion time in i – start time in j
k 1
1 2 3 4 5
MPL form: x ( k )  M  x ( k  1)
32
Duality & Dual System
Earliest times
Pls. refer to Ref. [1] for details
State equation
x (k )  A  [ x (k  1)  B0  u(k )]
• gives the earliest completion times
Output equation
y (k )  C 0  x  (k )
• gives the earliest output times
Latest times
x (k )  AT [ x (k  1)  C 0T u(k )]
• Latest start times
y (k )  B0T x (k )
Transition matrix
A  ( P  F0 )*  P
P  diag[d (k )]
B0 : Input matrix e/
C 0 : Output matrix e/
F0 : Adjacency matrix e/
Connected = e
Not connected = 
• Latest input times
33
Consideration of Capacity Constraints
Assumptions so far
Ref. [2]
• Number of jobs that can be processed simultaneously in a facility = 1
• Number of maximum jobs that can exist between two facilities = +Inf
x (k )  A  [ x (k  1)  B0  u(k )]
A  ( P  F0 )*  P
y (k )  C 0  x (k )
Consideration of maximum capacity
• Specify maximum capacity between two arbitrary nodes
Representation of lag times
Q
 x (k )


x (k )  Fk*   H 0( h )  x (k  h)  B0  u(k ) x (k )   x (k ) 


 h 1

Lag time
5
y (k )  C 0  x (k )
 ( F0 P )* ( F0 P )* F0 
F  F 
*
* 
(
PF
)
P
(
PF
)
l 1
0
0


2s 1
*
k
l
k
1
2
3
34
Application to Model Predictive Control
Substitute iteratively to the state equation
x (k )  Ax (k  1)  Bu(k )
Ref. [3]
x (k  1)  A2 x (k  1)  ABu(k )  Bu(k  1)
y (k )  C  x (k )

x (k  N  1)  A N x (k  1)  BA N 1u(k )    Bu(k  N  1)
Output prediction equation
y (k )
u( k )








Y (k )  Φx (k  1)  ΔU (k )
 y (k  1) 
 u(k  1) 
y (k )  
U
(
k
)










 y (k  N  1) 
 u(k  N  1) 
Case of production systems:




Problems to determine
ε

ε 
 CA 
 CAB
proper material feeding




2
2
CAB
 
times by giving due dates Φ   CA  Δ   CA B
  




ε 
  N 1 
  N 1

 N 2
 CA

 CA
B CA
B  CAB 



35
Efficient Calculation of the Kleene Star
Time complexity with a naïve method: O(n4 )
Efficient Algorithms: O(n  (n  m))
1. Topological sort
Refs. [4], [5]
n: Num. nodes
m: Num. edges
• Based on Depth First Search (DFS)
2
• If the precedence relations are given by an adjacency matrix: O(n )
• If given by a list: O(n  m)
2. Iterative update of the longest paths O(n  m)
• Starting from a unit matrix e , procedures similar to the elementary
transformation are performed
36
Extension to Stochastic Systems
f1 (t )
Tandem structure
Distribution function of summation
f 2 (t )
t
t
t
f12 (t )   f1 (t   ) f 2 ( )d
1
0
2
• Asymptotically -> central limit theorem
Fork structure (synchronization)
Distribution of max.
d
f12 (t )  [ F1 (t )  F2 (t )]
dt
f12 (t )
12
t
t
F (t )   f (t )dt
0
• Only Weibull distr. (incl. exponential distr.) and Gumbell distr. (incl.
double-exponential) are simple, while others are complex
Hard to handle analytically for general cases!
• Numerical computations for only small-sized systems are achieved
37
Another Approach to Stochastic Systems
Utilize the framework of the Critical Chain Project
Management (CCPM) Method
• High uncertainty in the execution time of tasks
• Detailed probability distribution is not considered
Affinity with max-plus algebra because of the same formulation
framework as project scheduling problem
Outline of CCPM
Ref. [6]
f (t )
Curtail (cut) the margin
time of each task
Redistribute (paste) the
curtailed times to critical
ABP
points
(Aggressive But Possible)
• Insert time buffers
50%
t
HP
(Highly Possible)
90%
38
Insertion of Time Buffers
Pre-processing
Curtail the margin times
Identify critical or non-critical
1
2
Feeding buffer
Insert just on the eve of
critical -> non-critical points
• 1/2 of the cumulative weights of
the non-critical chain
3
4
1
2
4
3
P
F
Project buffer
Insert just before the output
• 1/2 of the cumulative weights of the critical chain
Effective for both reducing the lead time and avoid
delay for the due date
39
Thank you for listening!
40
Reference Books
Max-plus algebra
F. Baccelli, G. Cohen, G.J. Olsder, and J.P. Quadrat,
Synchronization and Linearity, John Wiley & Sons, New York,
1992.
• Now out of print: can be downloaded via: http://maxplus.org
B. Heidergott, G.J. Olsder, and L. Woude, Max Plus at Work:
Modeling and Analysis of Synchronized Systems, Princeton
University Press, New Jersey, 2006.
Critical Chain Project Management
P.L. Leach, Critical Chain Project Management, Second Edition,
Artech House, London, 2005.
41
Reference Articles
[1] H. Goto, ''Dual Representation of Event-Varying Max-Plus Linear Systems'',
International Journal of Computational Science, vol. 1, no.3, pp.225-242, 2007.
[2] H. Goto, ''Dual Representation and Its Online Scheduling Method for EventVarying DESs with Capacity Constraints," International Journal of Control,
vol.81, no.4, pp.651-660, 2008.
[3] H. Goto, "A Lightweight Model Predictive Controller for Repetitive Discrete
Event Systems", Asian Journal of Control, vol. 15, no.4, pp.1081-1090, 2013.
[4] H. Goto, "A Fast Computation for the State Vector in a Max-Plus Algebraic
System with an Adjacency Matrix of a Directed Acyclic Graph," Journal of
Control, Measurement, and System Integration, vol.4, no.5, pp.361-364, 2011.
[5] H. Goto and H. Takahashi, "Fast Computation Methods for the Kleene Star in
Max-Plus Linear Systems with a DAG Structure," IEICE Transactions on
Fundamentals, vol.E92-A, no.11, pp.2794-2799, 2009.
[6] H. Goto, N. T. N. TRUC, and H. Takahashi, "Simple Representation of the
Critical Chain Project Management Framework in a Max-Plus Linear Form",
Journal of Control, Measurement, and System Integration, vol.6, no.5, pp.341344, 2013.
42
Download