rapid.examples package

Submodules

rapid.examples.em_workbench_lake_model module

Implements example from EM Workbench package.

Example contained in:

Kwakkel, J.H., 2017. The Exploratory Modeling Workbench: An open source toolkit for exploratory modeling, scenario discovery, and (multi-objective) robust decision making. Environ. Model. Softw. 96, 239–250. https://doi.org/10.1016/j.envsoft.2017.06.054

Altered to use custom robustness metrics from the RAPID package.

rapid.examples.em_workbench_lake_model.get_custom_R_metrics()

Returns the custom robustness metrics from paper.

rapid.examples.em_workbench_lake_model.get_custom_R_metrics_for_workbench()

Returns robustness metrics that can interact with ema_workbench

It is simple to create robustness metrics (see get_custom_R_metrics()) and ema_workbench requires them be specified in a particular way. Therefore, this function specifies them for the ema_workbench.

Returns a list of robustness metrics to be used for the Lake Model.

rapid.examples.em_workbench_lake_model.get_lake_model()

Returns a fully formulated model of the lake problem.

rapid.examples.em_workbench_lake_model.get_original_R_metrics()

Returns the Robustness metrics from original example.

rapid.examples.em_workbench_lake_model.optimize_lake_problem(use_original_R_metrics=False, demo=True)

Analysis of the Lake Problem.

  1. Runs a multi-objective robust optimisation of the Lake Problem using both standard and custom robustness metrics;
  2. analyses the effects of different sets of scenarios on the robustness values and robustness rankings;
  3. plots these effects;
  4. analyses the effects of different robustness metrics on the robustness values and robustness rankings; and
  5. plots these effects.
rapid.examples.em_workbench_lake_model.signal_to_noise(data)

A robustness metric defined for the original example.

rapid.examples.investment_simple module

Runs a simple investment example

From Wikipedia page: Regret (decision theory) https://en.wikipedia.org/wiki/Regret_(decision_theory) Accessed 18/10/2019

“Suppose an investor has to choose between investing in stocks, bonds or the money market, and the total return depends on what happens to interest rates. The following table shows some possible returns:

|| Stocks || -4 | 4 | 12 || -4 || || Bonds || -2 | 3 | 8 || -2 || || Money market || 3 | 2 | 1 || 1 || ||————–||———————|--------------|———————||—————- || Best return || 3 | 4 | 12 || ——————————————————————————

The crude maximin choice based on returns would be to invest in the money market, ensuring a return of at least 1. …

The regret table for this example, constructed by subtracting actual returns from best returns, is as follows:

|| Stocks || 7 | 0 | 0 || 7 || || Bonds || 5 | 1 | 4 || 5 || || Money market || 0 | 2 | 11 || 11 || ———————————————————————————————-

Therefore, using a minimax choice based on regret, the best course would be to invest in bonds. …

rapid.examples.investment_simple.investment_simple_example()

Runs investment example explained above

Module contents

Contains example uses of the RAPID package.