def get_lake_model(): """Returns a fully formulated model of the lake problem.""" # instantiate the model lake_model = Model('lakeproblem', function=lake_problem) lake_model.time_horizon = 100 # specify uncertainties lake_model.uncertainties = [ RealParameter('b', 0.1, 0.45), RealParameter('q', 2.0, 4.5), RealParameter('mean', 0.01, 0.05), RealParameter('stdev', 0.001, 0.005), RealParameter('delta', 0.93, 0.99) ] # set levers, one for each time step lake_model.levers = [ RealParameter(str(i), 0, 0.1) for i in range(lake_model.time_horizon) ] # specify outcomes lake_model.outcomes = [ ScalarOutcome('max_P', ), ScalarOutcome('utility'), ScalarOutcome('inertia'), ScalarOutcome('reliability') ] # override some of the defaults of the model lake_model.constants = [Constant('alpha', 0.41), Constant('nsamples', 150)] return lake_model
def lake_model(): lake_model_actual() if __name__ == '__main__': freeze_support() lake_model_actual() ##################################################################################################### # now connect the model with the workbench from ema_workbench import Model, RealParameter, ScalarOutcome, Constant model = Model('lakeproblem', function=lake_model_actual) model.time_horizon = 100 # specify uncertainties model.uncertainties = [ RealParameter('b', 0.1, 0.45), RealParameter('q', 2.0, 4.5), RealParameter('mean', 0.01, 0.05), RealParameter('stdev', 0.001, 0.005), RealParameter('delta', 0.93, 0.99) ] # specify outcomes model.outcomes = [ ScalarOutcome('max_P'), ScalarOutcome('utility'), ScalarOutcome('inertia'),
reliability += np.sum(X < Pcrit) / float(nsamples * nvars) max_P = np.max(average_daily_P) utility = np.sum(alpha * decisions * np.power(delta, np.arange(nvars))) inertia = np.sum(np.diff(decisions) > -0.02) / float(nvars - 1) return max_P, utility, inertia, reliability if __name__ == "__main__": ema_logging.log_to_stderr(ema_logging.INFO) # instantiate the model lake_model = Model("lakeproblem", function=lake_problem) lake_model.time_horizon = 100 # specify uncertainties lake_model.uncertainties = [ RealParameter("b", 0.1, 0.45), RealParameter("q", 2.0, 4.5), RealParameter("mean", 0.01, 0.05), RealParameter("stdev", 0.001, 0.005), RealParameter("delta", 0.93, 0.99), ] # set levers, one for each time step lake_model.levers = [RealParameter(str(i), 0, 0.1) for i in range(lake_model.time_horizon)] # specify outcomes lake_model.outcomes = [