Say that an item is an indivisible piece of work that needs to be achieved by one resource (worker).

Each item must be:

  • Step 1: prepared by one of the resources from group A,
  • Step 2: And then transformed by one of the resources from group B.

Step 1 takes 1 day (one resource achieves one item in one day), while step 2 takes 4 days.

Is there a known math formula or algorithm to determine when all the items will be achieved?

Considering that the number of items is known in advance, as well as the number of resources per group (and one resource cannot move from one group to another). For instance, I can compute when group A will be finished:

= CEILING(Number of items / count of resources in group A) * Work duration

But then I need to compute the (dependent) work for group B that will have a discretely increasing workload (one resource of group B can only start when one item has passed step 1).

  • 1
    Your formula is wrong, it should be CEILING(Number of items / count of resources in group A) * Work duration because of course the (idealized) time required increases with work duration and decreases with number of resources. The complete derivation of the full formula is too complex for my lunch break though :-) Oct 5, 2021 at 10:53
  • This could get very complex if you try to derive an algorithm, due to the need to be able to flex the parameters to accommodate different sizes of groups and different numbers of items (and also to accommodate future variations such as allowing >1 people to work on each item). I think the practical way is to draw the timeline based on allocating people to tasks.
    – Iain9688
    Oct 5, 2021 at 11:06
  • @Iain9688 Items are constant. One resource can work on it and only one. Plus we take the risk that the number or resources stay constant too. Plus all the items are known in advance.
    – FloFu
    Oct 5, 2021 at 12:44
  • 3
    @FloFlu, yes there is a formula, but this is pure Taylorism and in most cases empirical measurements of flow, velocity and cycle time are going to be better metrics work with.
    – nvogel
    Oct 5, 2021 at 14:13
  • 2
    Regarding Taylorism: modeling workflow in this way is suitable to gain a basic understanding of dependencies in highly regular processing pipelines (read: automation). As soon as workers are involved (please avoid the word "resource" when talking about people) there is too much variability in the process to use such a formula as a basis for planning, and empirical measurements are much more reliable. Oct 5, 2021 at 14:22

1 Answer 1


For an algorithm, you can simply simulate the process with each day being represented by one step, and count the simulation steps. That's not a closed formula but given relatively small numbers can be evaluated quickly enough.

Just for fun I've written a small python program (beware, this is python2):

#!/usr/bin/env python
num_a = 5
dur_a = 1
num_b = 20
dur_b = 4
num_items = 100

num_buffered = 0
num_finished = 0
active_a = []
active_b = []

t = 0
while num_items + num_buffered + len(active_a) + len(active_b) > 0:
        # print progress
        print("{:>3}: {} idle A, {} idle B, {} items, {} buffered, {} finished".format(

        # count down time worked
        active_a = map(lambda x: x-1, active_a)
        active_b = map(lambda x: x-1, active_b)

        # finished workers put items into buffer or result and return to their work group
        done_a = len(filter(lambda x: x==0, active_a))
        num_a += done_a
        active_a = filter(lambda x: x>0, active_a)
        num_buffered += done_a
        done_b = len(filter(lambda x: x==0, active_b))
        num_b += done_b
        active_b = filter(lambda x: x>0, active_b)
        num_finished += done_b

        # workers pick up work and start
        for _ in range(0,min(num_a,num_items)):
                num_a -= 1
                num_items -= 1
        for _ in range(0,min(num_b,num_buffered)):
                num_b -= 1
                num_buffered -= 1

        # time increments by 1
        t += 1

print("{:>3}: done".format(t))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.