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 vdf not calculated last iteration of assignment #254

Conversation

barisdemirdelen
Copy link
Contributor

In linear_approximation.py, vdf calculation happens after convergence is checked. If an assignment is converged the function breaks out of the loop, that means no vdf calculation can be made for the last iteration of the assignment.

This pull request moves applying the vdf before convergence checking and breaking, so that the last iterations vdf can also be calculated before assignment finishes.

@barisdemirdelen barisdemirdelen changed the title Fix vdf not calculated last iteration Fix vdf not calculated last iteration of assignment May 25, 2021
Copy link
Contributor

@pedrocamargo pedrocamargo left a comment

Choose a reason for hiding this comment

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

Excellent catch. @janzill , can you take a second look before we merge it?

@pedrocamargo pedrocamargo self-requested a review May 25, 2021 11:51
@pedrocamargo
Copy link
Contributor

Tests that fail are due to the lack of GitHub secrets in the contributing repo, so all good

@pedrocamargo pedrocamargo requested a review from janzill May 25, 2021 11:53
Copy link
Contributor

@janzill janzill left a comment

Choose a reason for hiding this comment

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

Thanks @barisdemirdelen , good catch. I think we still need to change this slightly and move the calculation of the vdf after the convergence metric calculation to not use the updated costs. We will also want the convergence report to be updated, so my suggestion is to move the convergence check (l428 in your code) to the end of the the iteration loop, and also invert the application of the vdf and the calculation of convergence statistics. Does that make sense?

@barisdemirdelen
Copy link
Contributor Author

Thanks @barisdemirdelen , good catch. I think we still need to change this slightly and move the calculation of the vdf after the convergence metric calculation to not use the updated costs. We will also want the convergence report to be updated, so my suggestion is to move the convergence check (l428 in your code) to the end of the the iteration loop, and also invert the application of the vdf and the calculation of convergence statistics. Does that make sense?

For the first suggestion, I think it makes sense to put the l428 if to the end of the loop.
For the second suggestion, do you mean in check_convergence() we actually want the old self.congested_time and not the updated one by the vdf?

@janzill
Copy link
Contributor

janzill commented May 25, 2021

For the second suggestion, do you mean in check_convergence() we actually want the old self.congested_time and not the updated one by the vdf?

Yes, this is on purpose, I think we want the costs that were used to calculate the current all-or-nothing

@janzill janzill self-requested a review May 25, 2021 12:57
@janzill janzill merged commit 71c2ec1 into AequilibraE:master May 25, 2021
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.

None yet

3 participants