Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilization calculation issues #24

Closed
Enchufa2 opened this issue Oct 31, 2021 · 1 comment
Closed

Utilization calculation issues #24

Enchufa2 opened this issue Oct 31, 2021 · 1 comment

Comments

@Enchufa2
Copy link
Member

As reported by @DanielaRichter based on a specific use case:

dt should not be based on the time between the server status change (aka “now”) and the time of the last change, but between now and the time of the next change. When a server changes to “1”, the “busy time” is from now on until it is changed again.

This is true if, and only if, keeping the alignment between time (now) and dt is required. However, it must be noted that 1) time is not used after setting dt, and 2) dplyr::lag is used when in_use is calculated. Therefore, it doesn't change the final result, but it may make sense to use dplyr::lead just to get rid of subsequent calls to dplyr::lag.

Arrivals in a batch lead to problems when calculating dt. Therefore, when multiple arrivals arrive at the same time, i.e. time - lag(time) == 0, the duration for the second sample was always based on the “sibling” arrival before and not on the last timepoint -> resulting in a duration = 0. Thus, whenever I encountered this problem, I copied the duration of the “sibling” before.

Batches shouldn't lead to problems, because the first n-1 arrivals from a batch get a dt=0, so their contribution to in_use (and thus to utilization) is null. In fact, introducing dplyr::filter(!duplicated(time, fromLast=TRUE)) to remove duplicates has no effect in the result.

I realized that I got durations counted when the capacity of the resource was 0: thus I multiplied the duration with a 0/1 capacity helper variable. (actually that was one of the first things I did. It might be obsolete due to some other changes).

This makes sense: if the resource is closed (aka capacity=0), utilization is not defined. This time shouldn't count for its calculation. This is an easy fix.

@Enchufa2
Copy link
Member Author

@DanielaRichter Please, feel free to keep discussing this, here or over email. I'll give this a few days, and if no further issues are found, I plan to send a new release to CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant