Not entirely sure if this is what you want (some sample inputs and expected outputs would help), but you can provide clarification/correction as needed.
Let's say we have a series of shift changes (presumably at some cadence of time intervals):
ShiftChanges = {0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0};
Your performance function just depends on the sum of 1
s in this list. The exact sequence doesn't matter. So, at any moment in time, if we had the sum of shift changes up to that point, we could easily calculate the performance:
Performance[changeCount_] := 1 /; changeCount < 2;
Performance[changeCount_] := 1 - .1 (changeCount - 1)
If we had a cumulative sum of shift changes over time, we could just map our Performance
function of that list. The Accumulate
function will give us such a cumulative sum:
Accumulate[ShiftChanges]
(* {0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4} *)
Let's apply our performance function:
Performance /@ Accumulate[ShiftChanges]
(* {1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9, 0.9, 0.9, 0.9, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7} *)