0% found this document useful (0 votes)
159 views20 pages

MAZ - Assembly Line Scheduling

Dynamic programming is an optimization technique that solves problems by breaking them down into smaller subproblems and storing the results of already solved subproblems to avoid recomputing them. It has four steps: 1) characterize the structure of an optimal solution, 2) recursively define the value of an optimal solution, 3) compute the value of an optimal solution in a bottom-up fashion, and 4) construct an optimal solution from the computed information. The document then provides an example of using dynamic programming to solve an assembly line scheduling problem to minimize the total time to manufacture a vehicle using two assembly lines.

Uploaded by

Sudha Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views20 pages

MAZ - Assembly Line Scheduling

Dynamic programming is an optimization technique that solves problems by breaking them down into smaller subproblems and storing the results of already solved subproblems to avoid recomputing them. It has four steps: 1) characterize the structure of an optimal solution, 2) recursively define the value of an optimal solution, 3) compute the value of an optimal solution in a bottom-up fashion, and 4) construct an optimal solution from the computed information. The document then provides an example of using dynamic programming to solve an assembly line scheduling problem to minimize the total time to manufacture a vehicle using two assembly lines.

Uploaded by

Sudha Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Dynamic Programming

I divide and conquer method divides the problem into


independent subproblem
I solve subproblem recursively and combine solutions to solve
original problem
I dynamic programming solves problem by combining solutions
to subproblems
I the subproblems are not independent, subproblems share
subsubproblems
I solve subsubproblem just once and then saves answer in table
- avoiding recomputing answer when subsubproblem is
encountered

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Dynamic Programming

I DP applied to optimization problems


I many possible solutions - find solution with optimal value
I called a solution an optimal solution as opposed to the
optimal solution
I since there may be several solutions that achieve the optimal
value
I development of DP algorithm into four steps
I characterize the structure of an optimal solution
I recursively define the value of an optimal solution
I compute the value of an optimal solution in a bottom-up
fashion
I construct an optimal solution from computed information

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

I manufacturing problem - two assembly lines


I chassis enters, add parts at assembly stations and finished
auto exists
I assembly line i(= 1, 2) - n stations (j = 1, 2, . . . , n)
I Si,j jth station on line i
I jth station on both lines doing same function
I stations built at different times with different technologies
I time required at each station varies
I ai,j assembly time required at station Si,j
I entry time ei for chassis to enter line i and exit time xi for
completed auto
I time to go from one station to the next in the same line is
negligible

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

I for a special order - automobiles to be manufactured as


quickly as possible
I need to switch partially built auto from one line to other
though it passes through the n stations in order
I time to transfer a chassis away from line i after gone through
station Si,j is ti,j
I The problem is to determine which stations to choose from
line 1 and which to choose from line 2 inorder to minimize the
total time for one auto
I brute force way of minimizing the time is infeasible when there
are many stations
I possible to compute Θ(n) given a list of stations from line 1
and line 2 to finish an auto
I 2n possible ways to choose stations
I enumerating all possible ways and compute time requires
Ω(2n ) time which is infeasible for large n
M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design
Assembly-line scheduling

I characterize the structure of an optimal solution


I let us consider fastest way for a chassis to get from starting
point through S1,j
I if j = 1 only one way that the chassis could have gone - easy
to determine
I for j = 2, . . . , n two choices
I one transfer chassis from S1,j−1 to S1,j
I another choice chassis could have come from S2,j−1 and
transferred to S1,j with transfer time t2,j−1
I say, fastest way through station S1,j is through S1,j−1
I the chassis must have taken a fastest way from the starting
point through S1,j−1
I if there were a faster way to get through S1,j−1 it can be
substituted to yield a faster way through S1,j
M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design
Assembly-line scheduling

I say, fastest way through station S1,j is through S2,j−1


I the chassis must have taken a fastest way from the starting
point through S2,j−1
I if there were a faster way to get through S2,j−1 it can be
substituted to yield a faster way through S1,j
I an optimal solution to a problem (finding the fastest way
through S1,j ) contains within it an optimal solution to
subproblems (finding the fastest way through either S1,j−1 or
S2,j−1 )
I this property is called as optimal substructure
I construct an optimal solution to a problem from optimal
solutions to subproblems

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

I similarly, fastest way through station S2,j is either


I fastest way through station S2,j−1 and then through S2,j or
I fastest way through station S1,j−1 and then through S2,j
I In general, To solve the problem of finding the fastest way
through station j of either line,
I solve the subproblems of finding the fastest ways through
station j − 1 on both lines
I second step is to construct recursive solution
I define the value of an optimal solution recursively in terms of
optimal solutions to subproblems
I let, fi [j] fastest possible time to get a chassis from starting
point through Si,j
I goal is to determine the fastest time f ∗ to get a chassis all the
way through the factory
M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design
Assembly-line scheduling

I chassis has to get all the way through station n on either line
1 or 2 and then exit
I the faster of these ways is the fastest way through the entire
factory

f ∗ = min(f1 [n] + x1 , f2 [n] + x2 )


f1 [1] = e1 + a1,1
f2 [1] = e2 + a2,1

I to compute fi [j] for j = 2, . . . , n


I for f1 [j] fastest way through S1,j

f1 [j] = min(f1 [j − 1] + a1,j , f2 [j − 1] + t2,j−1 + a1,j )


similarly
f2 [j] = min(f2 [j − 1] + a2,j , f1 [j − 1] + t1,j−1 + a2,j )

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling


e1 + a1,1 if j = 1
f1 [j] =
min(f1 [j − 1] + a1,j , f2 [j − 1] + t2,j−1 + a1,j ) if j ≥ 2

e2 + a2,1 if j = 1
f2 [j] =
min(f2 [j − 1] + a2,j , f1 [j − 1] + t1,j−1 + a2,j ) if j ≥ 2

I fi [j] gives the values of optimal solutions to subproblems


I for constructing an optimal solution
I li [j] line number whose station j − 1 is used in a fastest way
through Si,j
I l ∗ line whose station n is used in a fastest way through the
entire factory

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 24 32 35 l1 [j] 1 2 1 1 2
f2 [j] 12 16 22 25 30 37 l2 [j] 1 2 1 2 2
I f ∗ = 38 and l ∗ = 1

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 l1 [j]
f2 [j] 12 l2 [j]

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 l1 [j] 1
f2 [j] 12 16 l2 [j] 1

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 l1 [j] 1 2
f2 [j] 12 16 22 l2 [j] 1 2

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 24 l1 [j] 1 2 1
f2 [j] 12 16 22 25 l2 [j] 1 2 1

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 24 32 l1 [j] 1 2 1 1
f2 [j] 12 16 22 25 30 l2 [j] 1 2 1 2

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 24 32 35 l1 [j] 1 2 1 1 2
f2 [j] 12 16 22 25 30 37 l2 [j] 1 2 1 2 2

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 24 32 35 l1 [j] 1 2 1 1 2
f2 [j] 12 16 22 25 30 37 l2 [j] 1 2 1 2 2
I f ∗ = 38 and l ∗ = 1

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

line 1 S1,1 S1,2 S1,3 S1,4 S1,5 S1,6 exit


e1 = 2 → 7→ 9→ 3→ 4→ 8→ 4→ x1 = 3
&2 &3 &1 &3 &4

2% 1% 2% 2% 1%
e2 = 4 → 8→ 5→ 6→ 4→ 5→ 7→ x2 = 2
line 2 S2,1 S2,2 S2,3 S2,4 S2,5 S2,6 exit

j 1 2 3 4 5 6 j 2 3 4 5 6
f1 [j] 9 18 20 24 32 35 l1 [j] 1 2 1 1 2
f2 [j] 12 16 22 25 30 37 l2 [j] 1 2 1 2 2
I f ∗ = 38 and l ∗ = 1

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


fastestway(a, t, e, x, n)

1. f1 [1] ← e1 + a1,1 and f2 [1] ← e2 + a2,1


2. for j ← 2 to n
3. do if f1 [j − 1] + a1,j ≤ f2 [j − 1] + t2,j−1 + a1,j
4. then f1 [j] ← f1 [j − 1] + a1,j l1 [j] ← 1
5. else f1 [j] ← f2 [j − 1] + t2,j−1 + a1,j l1 [j] ← 2
6. if f2 [j − 1] + a2,j ≤ f1 [j − 1] + t1,j−1 + a2,j
7. then f2 [j] ← f2 [j − 1] + a2,j l2 [j] ← 2
8. else f2 [j] ← f1 [j − 1] + t1,j−1 + a2,j l2 [j] ← 1
9. if f1 [n] + x1 ≤ f2 [n] + x2
10. then f ∗ = f1 [n] + x1 l ∗ = 1
11. else f ∗ = f2 [n] + x2 l ∗ = 2

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design


Assembly-line scheduling

I entire procedure take Θ(n) time


I compute fi [j] and li [j] - fill in table entries
I to compute fi [j] we need f1 [j − 1] and f2 [j − 1]
I Construct fastest way
1. i ← l ∗
2. print ”line” i, ”station” n
3. for j ← n downto 2
4. do i ← li [j]
5. print ”line” i, ”station” j − 1

M. A. Zaveri, SVNIT, Surat Algorithm Analysis and Design

You might also like