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

Fix utilisation bug #145

Merged
merged 3 commits into from
Jan 11, 2018
Merged

Fix utilisation bug #145

merged 3 commits into from
Jan 11, 2018

Conversation

geraintpalmer
Copy link
Member

Bug allowed utilisation to be greater than 100% in some cases.
This fixes that bug, and adds tests and property based tests to check for it.

@coveralls
Copy link

coveralls commented Dec 21, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 0e7ca2b on fix-utilisation-bug into c3793b3 on master.

Q.simulate_until_max_time(200)
for srvr in Q.transitive_nodes[0].servers:
self.assertGreaterEqual(srvr.total_time, srvr.busy_time)
self.assertLessEqual(Q.transitive_nodes[0].server_utilisation, 1.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw in a assertGreaterEqual than 0 too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -1,5 +1,7 @@
import unittest
import ciw
from hypothesis import given
from hypothesis.strategies import (floats, integers, random_module)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for the brackets? Haven't seen that conventionally anywhere else.

Q = ciw.Simulation(N)
Q.simulate_until_max_time(168)
for srvr in Q.transitive_nodes[0].servers:
self.assertGreaterEqual(srvr.total_time, srvr.busy_time)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this doesn't have the check of the actual bug does it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. The problem was srvr.busy_time was larger then srvr.total_time because I was also adding the final customers' waiting time to the busy time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! I see that now 👍

@coveralls
Copy link

coveralls commented Dec 21, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling c688036 on fix-utilisation-bug into c3793b3 on master.

@drvinceknight
Copy link
Contributor

Looks good @geraintpalmer: merge! 👍

@geraintpalmer
Copy link
Member Author

Fixes bug in which utilisation is not calculated correctly, resulting in utilisation > 100%.

@geraintpalmer geraintpalmer merged commit e8ebfe9 into master Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants