assume-framework / assume

ASSUME - Agent-based Simulation for Studying and Understanding Market Evolution
https://assume.readthedocs.io
22 stars 5 forks source link

Add block order and linked order strategies #269

Closed adamsjohanna closed 7 months ago

adamsjohanna commented 7 months ago

Add functionalities from my thesis:

Allows to use block orders and linked orders as rule-based and RL-based strategies for EOM markets.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 118 lines in your changes are missing coverage. Please review.

Comparison is base (5fa7460) 81.78% compared to head (605a508) 82.59%.

Files Patch % Lines
assume/strategies/learning_advanced_orders.py 64.41% 58 Missing :warning:
assume/strategies/flexable.py 15.00% 34 Missing :warning:
...me/markets/clearing_algorithms/complex_clearing.py 87.50% 7 Missing :warning:
assume/common/forecasts.py 33.33% 4 Missing :warning:
assume/strategies/advanced_orders.py 96.29% 4 Missing :warning:
assume/common/units_operator.py 88.88% 3 Missing :warning:
assume/common/utils.py 88.23% 2 Missing :warning:
assume/markets/base_market.py 60.00% 2 Missing :warning:
assume/strategies/flexable_storage.py 80.00% 2 Missing :warning:
assume/common/base.py 93.75% 1 Missing :warning:
... and 1 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #269 +/- ## ========================================== + Coverage 81.78% 82.59% +0.80% ========================================== Files 38 40 +2 Lines 4178 4550 +372 ========================================== + Hits 3417 3758 +341 - Misses 761 792 +31 ``` | [Flag](https://app.codecov.io/gh/assume-framework/assume/pull/269/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework) | Coverage Δ | | |---|---|---| | [pytest](https://app.codecov.io/gh/assume-framework/assume/pull/269/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework) | `82.59% <76.40%> (+0.80%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=assume-framework#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kim-mskw commented 7 months ago

I'm working on the review rigth now. Is there an example with which I can test the advanced learning strategies? So far the analysis_02 example does not have learning activated, does it?

adamsjohanna commented 7 months ago

Ok, I added the advanced orders learning to example_02_rl

kim-mskw commented 7 months ago

Ok, I added the advanced orders learning to example_02_rl

example_02_rl is giving me a bunch of warning messages. Did you get the same?

"WARNING:pyomo.core:Element demand_EOM_18 already exists in Set Bids; no action taken WARNING:pyomo.core:Element Unit 1_18 already exists in Set Bids; no action taken WARNING:pyomo.core:Element Unit 2_18 already exists in Set Bids; no action taken WARNING:pyomo.core:Element Unit 3_18 already exists in Set Bids; no action taken WARNING:pyomo.core:Element Unit 4_18 already exists in Set Bids; no action taken WARNING:pyomo.core:Element demand_EOM_19 already exists in Set Bids; no action taken WARNING:pyomo.core:Element Unit 1_19 already exists in Set Bids; no action taken {...}"

adamsjohanna commented 7 months ago

I just pulled your changes and it still runs through. The only warning I get is "WARNING:mango.util.distributed_clock:clock: no new events, time stands still", which depends on the end_date of the simulation. The warning you have implies, that the cleared orders are not deleted from the orderbook before the next market opening. I will check this again...

maurerle commented 7 months ago

Sorry - I took example_02c as it was the next one. We can rename the one on main so that this does not conflict anymore :)

maurerle commented 7 months ago

Oh well, in pandas 2.2 they changed the freq aliases:

Deprecated since version 2.2.0: Aliases H, BH, CBH, T, S, L, U, and N are deprecated in favour of the aliases h, bh, cbh, min, s, ms, us, and ns. https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases

(just as a note why this change seems to be required here)

nick-harder commented 7 months ago

@adamsjohanna also please make sure that the new learning startegies align with the changes Kim did last weeks for the learning part, and everyhting works. Also, since this is a pretty large commit, change the version in pyproject.toml to 0.3 since many new featured were added since November. We will create a new release after this commit

maurerle commented 7 months ago

@nick-harder I don't think that changing the version should be added to this PR additionally. It is worth its own PR

nick-harder commented 7 months ago

@nick-harder I don't think that changing the version should be added to this PR additionally. It is worth its own PR

@maurerle yes true! I will create one after this is merged

adamsjohanna commented 7 months ago

I didn't check the dashboard, since I hope everything was checked and workes properly. Make check again the documentation style, add documentation for the several new strategies, and clean up the input files. Also, for the future please split such large commits into sevral work packages with smaller commit sizes, for example only clearing or only strategies, or fixes

All done, except for the documentation, see #278