# 'VB 有无穷回圈问题帮忙改

Posted by 小楷 on August 30, 1999 at 16:23:38:

cost = 0
min = 200
step = 0
For i = 0 To 2
For j = 0 To JOB
ptr(i, j) = 0
Next j
For k = 0 To MACH
m_step(i, k) = 0
Next k
Next i
Do While step < MACH * JOB
min = 200
For i = 1 To JOB
If ptr(1, i) < MACH Then
t1 = ptr(2, i)
t2 = (i - 1) * MACH + ptr(1, i) + 1
t3 = route(t2, 4)
t4 = m_step(2, t3)
If t1 >= t4 Then
t5 = t1
Else
t5 = t4
End If
l(i) = t5 + route(t2, 5)
Else
l(i) = 1000
End If
If l(i) < min Then
min = l(i)
jj = i
End If
Next i
ptr(1, jj) = ptr(1, jj) + 1
ptr(2, jj) = min
t7 = (jj - 1) * MACH + ptr(1, jj)
t8 = route(t7, 5)
t9 = route(t7, 4)
m_step(1, t9) = m_step(1, t9) + 1
m_step(2, t9) = min
t10 = m_step(1, t9)
schedule((t9 - 1) * 3 + 1, t10) = t7
schedule((t9 - 1) * 3 + 2, t10) = min - t8
schedule((t9 - 1) * 3 + 3, t10) = min
step = step + 1
Loop
k = 1
i = 1
Do While k <= MACH * 3
Chr (10)
If k Mod 3 = 1 Then
Print "-------------------"
Chr (10)
Print "M", i
i = i + 1
End If
If k Mod 3 = 2 Then
Print "start"
End If
If k Mod 3 = 0 Then
Print "end "
End If
For j = 1 To JOB
Print schedule(k, j)
Next j
Loop
Chr (10)
cost = 0
For m = 1 To JOB
If cost < ptr(2, m) Then
cost = ptr(2, m)
End If
Next m
Chr (10)
Chr (10)
Print "makespan:", cost
'VB 有无穷回圈问题帮忙改'

Follow Ups:

- Re: 'VB 有无穷回圈问题帮忙改 Phoenix 02:13:56 9/10/99 (0)
- Re: 'VB 有无穷回圈问题帮忙改 v-man 23:17:52 8/30/99 (0)