DanieleGioia / ScenarioReducer

This library implements several approximate scenario reduction algorithms. Given a probability distribution with finite support, they aim to determine a probability measure with support of reduced and fixed cardinality by selecting the closest to the original one in terms of a selected statistical distance.
MIT License
6 stars 3 forks source link

Add basic test #3

Closed pdb5627 closed 1 year ago

pdb5627 commented 1 year ago

I created a pytest test for the fast_forward method. It creates an starting set of one-dimensional scenarios from a normal distribution of known mean and variance. The test then uses fast_forward to reduce the number of scenarios. Then the mean, standard deviation, and 0.05, 0.5, and 0.95 quantiles are compared between the original scenario set and the reduced scenario set to confirm that these statistical measures are close. This test demonstrates what I think are the incorrect results from missing a step of the algorithm as reported in #1, and the correct results from merging #2 to add the missing step of the algorithm.

The test introduces some dependencies beyond numpy, which are listed in requirements.txt (for pip) or environment-test.yml for conda.