{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 5.5 - -5 Create a 2nd facility by copying the code for...

This preview shows page 1. Sign up to view the full content.

3. Add a variable lets call it numships, to keep a count of the number of ships in the dock. Initialize numships = 0. After arrive(1) has been calculated, set numships(1) = 1; After the for i = 2,3, ..., n loop ships = n; for j = 1:i-1 If finish(j) <= arrive(i) decrease ships by 1; end end numships(i) = ships. ------------------------------------------------------------------------------------------------------------ 4.) After the for i=2,3,...,n If numships(i-1) > Nmax Generate random number between(i) arrive(i) = arrive(i-1) + between(i); Then use code from problem 3 to recalculate numships, and then go to the next iteration of i. else Execute the code as before.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -------------------------------------------------------------------------------------------------------------5.) Create a 2nd facility by copying the code for facility 1 and just changing variables. For example for facility 2, use start2, idle2, wait2, finish2, etc. .. instead of start, idle, wait, and finish, which are used for facility 1. The first step is inside the For i = 2,3, . .., n If facility 2 has zero ships and facility 1 has at least 1 ship add a ship to facility 2 else If both facilities have ships and if finish2(i-1) < finish(i-1) add a ship to facility 2 else add a ship to facility 1 end...
View Full Document

{[ snackBarMessage ]}