Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Viewing all articles
Browse latest Browse all 9596

Rhodium Open Source Python Library for (MO)RDM

$
0
0

Last year Dave Hadkaintroduced OpenMORDM( Hadka et al., 2015 ), an open source R package for Multi-Objective Robust Decision Making ( Kasprzyk et al., 2013 ). If you liked the capabilities of OpenMORM but prefer coding in python, you’ll be happy to hear Dave has also written an open source Python library for robust decision making (RDM) ( Lempert et al., 2003 ), including multi-objective robust decision making (MORDM): Rhodium .

Rhodium is part of Project Platypus , which also contains Python libraries for multi-objective optimization ( Platypus ), a standalone version of the Patient Rule Induction method ( PRIM ) algorithm ( Friedman and Fisher, 1999 ) implemented in Jan Kwakkel’s EMA Workbench , and a cross-language automation tool for running models ( Executioner ). Rhodium uses functions from both Platypus and PRIM, as I will briefly show here, but Jazmin will describe Platypus in more detail in a future blog post.

Dave provides an ipython notebook file with clear instructions on how to use Rhodium, with the lake problem given as an example. To give another example, I will walk through the fish game. The fish game is a chaotic predator-prey system in which the population of fish, x , and their predators, y , are co-dependent:


Rhodium   Open Source Python Library for (MO)RDM
Rhodium   Open Source Python Library for (MO)RDM

Here a is a parameter controlling the growth rate of fish and b is a parameter controlling the growth rate of the predators. The growth rate of the predators is dependent on the temperature, which is increasing due to climate change. The temperature can be modeled by the following equation:


Rhodium   Open Source Python Library for (MO)RDM

where C is the heat capacity, assumed to be 50 W/m 2 /K/yr, F 0 is the initial value of radiative forcing, assumed to be 1.0 W/m 2 , F is the rate of change of radiative forcing, S is the climate sensitivity in units of K/(W/m 2 ), and T is the temperature increase from equilibrium, initialized at 0. The dependence of b on the temperature increase is given by:


Rhodium   Open Source Python Library for (MO)RDM

The parameters a , b , F , and S could all be considered deeply uncertain, but for this example I will use (unrealistically optimistic) values of F = 0 and S = 0.5 and assume possible ranges for a and b 0 of 1.5 < a < 4 and 0.25 < b 0 < 0.67. Within these bounds, different combinations of a and b parameters can lead to point attractors , strange attractors , or collapse of the predator population.

The goal of the game is to design a strategy for harvesting some number of fish, z, at each time step assuming that only the fish population can be observed, not the prey. The population of the fish then becomes:


Rhodium   Open Source Python Library for (MO)RDM

For this example, I assume the user employs a strategy of harvesting some weighted average of the fish population in the previous two time steps:


Rhodium   Open Source Python Library for (MO)RDM

where 0 ≤ α ≤ 1 and 0 ≤ β ≤ 1. The user is assumed to have two objectives: 1) to maximize the net present value of their total harvest over T time steps, and 2) to minimize the standard deviation of their harvests over T time steps:

Maximize:
Rhodium   Open Source Python Library for (MO)RDM
Minimize:
Rhodium   Open Source Python Library for (MO)RDM

As illustrated in the figure below, depending on the values of a and b 0 , the optimal Pareto sets for each “future” (each with initial populations of x 0 = 0.48 and y 0 = 0.26) can have very different shapes and attainable values.

Future 1 2 3 4 5 a 1.75 1.75 3.75 3.75 2.75 b 0 0.6 0.3 0.6 0.3 0.45
Rhodium   Open Source Python Library for (MO)RDM

For this MORDM experiment, I first optimize to an assumed state of the world (SOW) in which a = 1.75 and b = 0.6. To do this, Ifirst have to write a function that takes in the decision variables for the optimization problem as well as any potentially uncertain model parameters, and returns the objectives. Here the decision variables are represented by the vector ‘vars’, the uncertain parameters are passed at default values of a =1.75, b0 = 0.6, F = 0 and S = 0.5, and the returned objectives are NPVharvest and std_z .

import os
import math
import json
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.optimize import brentq as root
from rhodium import *
from rhodium.config import RhodiumConfig
from platypus import MapEvaluator
RhodiumConfig.default_evaluator = MapEvaluator()
def fishGame(vars,
a = 1.75, # rate of prey growth
b0 = 0.6, # initial rate of predator growth
F = 0, # rate of change of radiative forcing per unit time
S = 0.5): # climate sensitivity)
# Objectives are:
# 1) maximize (average NPV of harvest) and
# 2) minimize (average standard deviation of harvest)
# x = population of prey at time 0 to t
# y = population of predator at time 0 to t
#

Viewing all articles
Browse latest Browse all 9596

Trending Articles