当前位置: 首页>>代码示例>>Python>>正文


Python ModelEnsemble.processes方法代码示例

本文整理汇总了Python中expWorkbench.ModelEnsemble.processes方法的典型用法代码示例。如果您正苦于以下问题:Python ModelEnsemble.processes方法的具体用法?Python ModelEnsemble.processes怎么用?Python ModelEnsemble.processes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在expWorkbench.ModelEnsemble的用法示例。


在下文中一共展示了ModelEnsemble.processes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: maxmin_optimize

# 需要导入模块: from expWorkbench import ModelEnsemble [as 别名]
# 或者: from expWorkbench.ModelEnsemble import processes [as 别名]
def maxmin_optimize():
    ema_logging.log_to_stderr(ema_logging.INFO)
 
    model = TestModel("", 'simpleModel') #instantiate the model
    ensemble = ModelEnsemble() #instantiate an ensemble
    ensemble.set_model_structure(model) #set the model on the ensemble
    ensemble.parallel = True
    ensemble.processes = 12
    
    def obj_function1(outcomes):
        return outcomes['y']
    
    policy_levers = { "L1": (0,1),
                      "L2": (0,1)}
    
    
    
    results = ensemble.perform_maximin_optimization(obj_function1 = obj_function1, 
                                                policy_levers = policy_levers,
                                                minimax1='minimize',
                                                nrOfGenerations1=50,
                                                nrOfPopMembers1=200,
                                                minimax2 = "maximize",                                   
                                                nrOfGenerations2 = 50,
                                                nrOfPopMembers2 = 100,
                                                )

    graph_errorbars_raw(results['stats'])
    plt.show()
开发者ID:,项目名称:,代码行数:31,代码来源:

示例2: ParameterUncertainty

# 需要导入模块: from expWorkbench import ModelEnsemble [as 别名]
# 或者: from expWorkbench.ModelEnsemble import processes [as 别名]
                     ParameterUncertainty((0.45,0.55),
                                          "tH"),
                     ParameterUncertainty((0.1,0.3),
                                          "kk")]
    
    #specification of the outcomes
    outcomes = [Outcome("B4:B1076", time=True),  #we can refer to a range in the normal way
                Outcome("P_t", time=True)] # we can also use named range
    
    #name of the sheet
    sheet = "Sheet1"
    
    #relative path to the Excel file
    workbook = r'\excel example.xlsx'
    

if __name__ == "__main__":    
    ema_logging.log_to_stderr(level=ema_logging.INFO)
    
    model = ExcelModel(r"./models/excelModel", "predatorPrey")
    
    ensemble = ModelEnsemble()
    ensemble.set_model_structure(model) 

    ensemble.parallel = True #turn on parallel computing
    ensemble.processes = 2 #using only 2 cores 
    
    #run 100 experiments
    nr_experiments = 100
    results = ensemble.perform_experiments(nr_experiments) 
开发者ID:epruyt,项目名称:EMAworkbench,代码行数:32,代码来源:excel_example.py

示例3: EVO

# 需要导入模块: from expWorkbench import ModelEnsemble [as 别名]
# 或者: from expWorkbench.ModelEnsemble import processes [as 别名]
#                 'TimeHorizonGov2':50,
#                 'TimeHorizonGov3':50,
#                 'TimeHorizonGov4':50,
#                 'TimeHorizonGov5':50,
#                 'TimeHorizonInd1':50,
#                 'TimeHorizonInd2':50,
#                 'TimeHorizonInd3':50,
#                 'TimeHorizonInd4':50,
#                 'TimeHorizonInd5':50}
#     msi2 = EVO(r"./models", 'longTimeHorizon', defaults=defaults)

    msi1 = EVO('./models', 'full')
     
    #instantiate an ensemble
    ensemble = ModelEnsemble()
      
    #set the model on the ensemble
    ensemble.add_model_structure(msi1)
#     ensemble.add_model_structure(msi2)
        
    ensemble.parallel = True
    ensemble.processes = 36
    
    #perform experiments
    nr_experiments = 1000
    results = ensemble.perform_experiments(nr_experiments, 
                                           reporting_interval=100)
    
    fn = r'.\data\full {} exp {} rep.tar.gz'.format(nr_experiments, 
                                                    msi1.nr_replications)
    save_results(results, fn)
开发者ID:quaquel,项目名称:greeven_etal_2016,代码行数:33,代码来源:generating_experiments.py


注:本文中的expWorkbench.ModelEnsemble.processes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。