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

Move settlements merging into SingleOrderSolver #434

Merged
merged 2 commits into from
Aug 10, 2022

Conversation

MartinquaXD
Copy link
Contributor

Merging multiple single order settlements in the driver is a bit awkward. Instead it should be the responsibility of the SingleOrderSolver because those solvers are the only ones that need merged settlements anyway.

To make it a bit nicer to create SingleOrderSolvers generically (and more inline with what we do for price estimators) I also made it use dynamic dispatch instead of static dispatch.

Initially discussed here

Test Plan

Only moved logic around => CI
updated test asserting the number of generated settlements

@MartinquaXD MartinquaXD requested a review from a team as a code owner August 10, 2022 10:10
@@ -1,4 +1,5 @@
use crate::{
driver::solver_settlements::merge_settlements,
Copy link
Contributor

@nlordell nlordell Aug 10, 2022

Choose a reason for hiding this comment

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

Should we move this function to something like mod single_order_solver::merge?

Fine where it is as well.

Copy link
Contributor Author

@MartinquaXD MartinquaXD Aug 10, 2022

Choose a reason for hiding this comment

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

The single order solver currently doesn't live in its own directory. If I'm not mistaken we would have to either create that directory structure (making git blame less effective) or let the merge file float around in the /solver directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine either way, just thought I should ask (because where the code was used moved drastically, I thought it might make sense to move the code). No strong opinions though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It definitely is a valid point.
I believe when we are eventually happy with the new driver we probably should move around a bunch of code from the old driver and solver crates so maybe that would be a good time to do it.
I will merge for now and keep that in mind.

Copy link
Contributor

@nlordell nlordell left a comment

Choose a reason for hiding this comment

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

Nice change!

I see your point that we shouldn't change trait Solver to return a single Settlement instead of a Vec<Settlement> because the simulation happens in the driver run loop.

@MartinquaXD MartinquaXD enabled auto-merge (squash) August 10, 2022 11:48
@codecov-commenter
Copy link

Codecov Report

Merging #434 (67ff31d) into main (6c9e70a) will increase coverage by 0.38%.
The diff coverage is 35.00%.

❗ Current head 67ff31d differs from pull request most recent head b7a7008. Consider uploading reports for the commit b7a7008 to get more accurate results

@@            Coverage Diff             @@
##             main     #434      +/-   ##
==========================================
+ Coverage   63.58%   63.97%   +0.38%     
==========================================
  Files         228      228              
  Lines       44572    44266     -306     
==========================================
- Hits        28343    28317      -26     
+ Misses      16229    15949     -280     

@MartinquaXD MartinquaXD merged commit ab979c6 into main Aug 10, 2022
@MartinquaXD MartinquaXD deleted the merge-settlements-in-single-order-solver branch August 10, 2022 11:51
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants