Closed GbotemiB closed 8 months ago
Thanks @davide-f for the amazing review. I will work on the implementation based on the reviews and get back to you.
Hello @davide-f, I have implemented all the requested changes. I think the PR is ready for another round of review.
@GbotemiB Emmanuel, please use precommit. in github a ton of pre-commit issues are appearing, please check. It would be good to clean a bit the history by resetting to some past commit like this one and placing the changes.
To make sure you use the pre-commit, please check this that suggests you how to set it up
Hi @davide-f, I have successfully cleaned up the history. Thanks for the tip.
Also, I have made changes to the part of the code you reviewed. Please feel free to review the changes. Thanks.
Great revision @GbotemiB :D Few minor comments :)
As a comments, in debug, may you show a plot of input and outputs provided by the rescaling function for different values? Have you done that to make sure the expected distributions are verified?
I have tested that the rescaling works. Here is what the rescaled distribution looks like using 1369 samples
Hello @davide-f, I added into the monte-carlo.py
script a few lines to plot the selected distribution. I also added a rule to the snakemake file to separate the cleaning process for solve_all_networks_monte
rule.
Happy to hear your reviews 🙃
Great @GbotemiB :D Added few comments :) Can you also post here the images that you created with the monte carlo? very curious and useful to review!
This is another simulation with 49 samples.
Here is the plot for the objective values for the 49 networks.
Here are the distribution plots for the parameters.
Hi @davide-f, I can confirm that the post-processed coefficients follow the pre-processed coefficients.
These are some of the plots generated. I will include the plots in the notebook I am working on for the case study analysis and share the notebook with you.
Hello @GbotemiB , Thanks for the images, but few comments:
Could you crosscheck?
Hello @GbotemiB , Thanks for the images, but few comments:
- I expected a uniform distribution for the load, why does it have a different shape instead?
- Similarly, for the onwind I expected a lognormal shape but this seems to be normal instead, while for sigma=1.5 I expected a different shape.
Could you crosscheck?
Regarding the distribution of the parameters, it follows this config. But I could reconfigure the parameters.
uncertainties:
loads_t.p_set:
type: beta
args: [2, 0.5]
generators_t.p_max_pu.loc[:, n.generators.carrier == "solar"]:
type: beta
args: [4, 1]
generators_t.p_max_pu.loc[:, n.generators.carrier == "onwind"]:
type: beta
args: [4, 1]
generators.capital_cost.loc[n.generators.carrier == "solar"]:
type: normal
args: [0, 1]
generators.capital_cost.loc[n.generators.carrier == "onwind"]:
type: normal
args: [0, 1]
generators.weight.loc[n.generators.carrier == "onwind"]:
type: beta
args: [2, 0.5]
generators.weight.loc[n.generators.carrier == "solar"]:
type: beta
args: [2, 0.5]
Final rounds! Great you added the reference to the api :) close to done! [I know it's the third time, but we are there :)] Happy to jump in if necessary.
Regarding the distribution plots, have you tested all distributions?
@davide-f, No problem about continuing the review if necessary. Regarding the distribution, I will reconfirm all distribution again. I made a few changes to the triangle distribution.
Feel free to jump in.
@davide-f, Regarding the distribution, I have tested them. Here is a config for Monte-Carlo and the results.
monte_carlo:
options:
add_to_snakefile: true
samples: 961 # number of optimizations. Note that number of samples when using scipy has to be the square of a prime number
sampling_strategy: "pydoe2" # "pydoe2", "chaospy", "scipy", packages that are supported
seed: 42 # set seedling for reproducibilty
uncertainties:
loads_t.p_set:
type: normal
args: [1, 100]
generators_t.p_max_pu.loc[:, n.generators.carrier == "solar"]:
type: uniform
args: [0.1, 1]
generators_t.p_max_pu.loc[:, n.generators.carrier == "onwind"]:
type: lognormal
args: [1.5]
generators.capital_cost.loc[n.generators.carrier == "solar"]:
type: triangle
args: [0.7]
generators.capital_cost.loc[n.generators.carrier == "onwind"]:
type: beta
args: [0.5, 1]
generators.weight.loc[n.generators.carrier == "onwind"]:
type: beta
args: [2, 0.5]
generators.weight.loc[n.generators.carrier == "solar"]:
type: gamma
args: [2, 0.5]
Here are the plots.
Thank you for the support @davide-f. Special shoutout to @ekatef 🎉 🥳
Fantastic news, @GbotemiB and @davide-f! A really cool feature to have 😄 Congratulations with an amazing result! 🎉 🎉 🎉
Closes # (if applicable).
Changes proposed in this Pull Request
This PR includes improvement on the Monte-Carlo simulation. The improvement includes the option to choose from different distributions for the simulation. The distribution includes normal, triangle, lognormal, beta, and gamma. While choosing the distribution, it also allows users to pass parameters for the distribution.
Checklist
envs/environment.yaml
anddoc/requirements.txt
.config.default.yaml
andconfig.tutorial.yaml
.test/
(note tests are changing the config.tutorial.yaml)doc/configtables/*.csv
and line references are adjusted indoc/configuration.rst
anddoc/tutorial.rst
.doc/release_notes.rst
is amended in the format of previous release notes, including reference to the requested PR.