Step 0: Initial Setup
Line 1:
E1
2
f1=9
S1
7
S2
9
S3
3
S4
4
X1
3
T1: 2
T1: 3
T1: 1
Line 2:
E2
4
f2=12
S1
8
S2
5
S3
6
S4
4
X2
2
T2: 2
T2: 1
T2: 3
Current minimum times: f1 = 9, f2 = 12

Variable Definitions:

f1, f2: Minimum cumulative times to reach current station on Line 1 and Line 2
e1=2, e2=4: Entry times (initial setup costs) for Line 1 and Line 2
x1=3, x2=2: Exit times (final completion costs) from Line 1 and Line 2
a1[], a2[]: Processing times at each station on Line 1 and Line 2
t1[], t2[]: Transfer times from Line 1 to Line 2, and Line 2 to Line 1
Goal: Find minimum of (f1 + x1) and (f2 + x2) for optimal total time