Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Sub SolveAssemblyLineBalancing ( ) ' Define the task times and precedence constraints Dim taskTimes ( ) As Integer taskTimes = Array ( 3 , 2
Sub SolveAssemblyLineBalancing
Define the task times and precedence constraints
Dim taskTimes As Integer
taskTimes Array Example task times
Dim predecessors As Collection
Set predecessors New Collection Task
predecessorsAdd No predecessors
Set predecessors New Collection Task
predecessorsAdd Task is a predecessor
Set predecessors New Collection Task
predecessorsAdd
Set predecessors New Collection Task
predecessorsAdd Task is a predecessor
Set predecessors New Collection Task
predecessorsAdd Task is a predecessor
Set predecessors New Collection Task
predecessorsAdd Task is a predecessor
Set predecessors New Collection Task
predecessorsAdd
Set predecessors New Collection Task
predecessorsAdd
Set predecessors New Collection Task
predecessorsAdd
Set predecessors New Collection Task
predecessorsAdd
Set predecessors New Collection Task
predecessorsAdd
Define the cycle time and maximum number of workstations
Dim cycleTime As Integer
cycleTime
Dim maxStations As Integer
maxStations
Dim maxWorkersPerStation As Integer
maxWorkersPerStation
Step : Compute the positional weights
Dim positionalWeights As Integer
ReDim positionalWeightsUBoundtaskTimes
Dim i As Integer, j As Integer
For i UBoundtaskTimes To LBoundtaskTimes Step
positionalWeightsi taskTimesi
For Each pred In predecessorsi
positionalWeightsi positionalWeightsi positionalWeightspred
Next pred
Next i
Step : Sort tasks by positional weights in descending order
Dim sortedTasks As Integer
sortedTasks SortTasksByPositionalWeightpositionalWeights
Step : Assign tasks to workstations
Dim stationLoadmaxStations As Integer
Dim stationTasksmaxStations As Collection
For i To maxStations
Set stationTasksi New Collection
Next i
Dim taskAssigned As Boolean
ReDim taskAssignedUBoundtaskTimes
For Each task In sortedTasks
For i To maxStations
If stationLoadi taskTimestask cycleTime And stationTasksiCount maxWorkersPerStation Then
stationTasksiAdd task
stationLoadi stationLoadi taskTimestask
taskAssignedtask True
Exit For
End If
Next i
Next task
Output the assignment of tasks to workstations
For i To maxStations
Debug.Print "Station & i & :
For Each task In stationTasksi
Debug.Print Task & task
Next task
Next i
End Sub
Function SortTasksByPositionalWeightweights As Integer As Integer
Dim indices As Integer
Dim i As Integer, j As Integer, temp As Integer
ReDim indicesUBoundweights
For i LBoundweights To UBoundweights
indicesi i
Next i
For i LBoundweights To UBoundweights
For j i To UBoundweights
If weightsindicesj weightsindicesi Then
temp indicesi
indicesi indicesj
indicesj temp
End If
Next j
Next i
SortTasksByPositionalWeight indices
End Function
Im getting an error in the VBA code I wrote to solve this problem. Can you help me
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started