dcost = "dike cost ($)" rcost = 'resistance cost ($)' wcost = 'withdrawal cost ($)' damage = "damage cost ($)" access = "accessible to waterfront (m)" investLim = 6e10 netCostLim = 8e10 damageLim = 8e10 #from pyborg import BorgMOEA from rhodium import * from rhodium.ffi import NativeModel #from pyborg import BorgMOEA import matplotlib.pyplot as plt import matplotlib.pylab model_DH = NativeModel("iCOW.dylib", "evaluateDamageOverTime") model_DH.parameters = [ Parameter(RH, default_value=100.0, type="double"), Parameter(RP, default_value=RPD, type="double"), Parameter(WH, default_value=100.0, type="double"), Parameter(DB, default_value=100.0, type="double"), Parameter(DH, default_value=100.0, type="double"), Parameter("years", default_value=50, type="int"), Parameter("sampled futures", default_value=sampledFutures, type="int") ] model_DH.responses = [ Response(totalDamage, Response.MINIMIZE, type="double", asarg=True), Response(investmentCost, Response.MINIMIZE, type="double", asarg=True), Response(r, Response.INFO, type="double", asarg=True),
DBAxlable = DBlabel + ' (m)' investLim = 100000e6 / dollarUnit netCostLim = 80000e6 / dollarUnit damageLim = 8000e7 / dollarUnit investLim2 = 3200e6 / dollarUnit investLim3 = 3200e7 / dollarUnit #from pyborg import BorgMOEA from rhodium import * from rhodium.ffi import NativeModel #from pyborg import BorgMOEA import matplotlib.pyplot as plt import matplotlib.pylab model_DH = NativeModel("iCOW.dylib", "evaluateDamageOverTime") model_DH.parameters = [ Parameter(RH, default_value=100.0, type="double"), Parameter(RP, default_value=RPD, type="double"), Parameter(WH, default_value=100.0, type="double"), Parameter(DB, default_value=100.0, type="double"), Parameter(DH, default_value=100.0, type="double"), Parameter("years", default_value=50, type="int"), Parameter("sampled futures", default_value=sampledFutures, type="int") ] model_DH.responses = [ Response(totalDamage, Response.MINIMIZE, type="double", asarg=True), #Response(floodEvents, Response.INFO, type="double", asarg=True), #Response(breechEvents, Response.INFO, type="double", asarg=True),
from rhodium import * from rhodium.ffi import NativeModel # Provide the DLL/SO file and the function name. The appropriate extension, # such as .dll or .so, will be automatically added. model = NativeModel("lake", "lake_problem") # List the inputs. The order matters! model.parameters = [Parameter("pollution_limit", type="double*"), Parameter("b", default_value=0.42, type="double"), Parameter("q", default_value=2, type="double"), Parameter("mean", default_value=0.02, type="double"), Parameter("stdev", default_value=0.001, type="double"), Parameter("delta", default_value=0.98, type="double")] # List all outputs. We use asarg=True to handle the outputs as arguments to the C # function. model.responses = [Response("max_P", Response.MINIMIZE, type="double", asarg=True), Response("utility", Response.MAXIMIZE, type="double", asarg=True), Response("inertia", Response.MAXIMIZE, type="double", asarg=True), Response("reliability", Response.MAXIMIZE, type="double", asarg=True)] # Specify the levers model.levers = [RealLever("pollution_limit", 0.0, 0.1, length=100)] # Optimize the model using Rhodium output = optimize(model, "NSGAII", 10000) print(output)