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


Python Agent.simmulate方法代码示例

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


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

示例1: run

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import simmulate [as 别名]

#.........这里部分代码省略.........
        if initial_design:
            print_with_notice("Program (search initial design) finished at %s" % (detailed_datetime_to_human(datetime.datetime.now())))
    else:
        # load components list
        hull_list      = load_hull_list()
        engine_list    = load_engine_list()
        propeller_list = load_propeller_list()
        # get components
        initial_hull      = Hull(hull_list, initial_hull_id)
        initial_engine    = Engine(engine_list, initial_engine_id)
        initial_propeller = Propeller(propeller_list, initial_propeller_id)        

    if not initial_design:
        # to compare retrofitting mode #
        # fix seed #
        common_seed_num                 = 19901129
        sinario_mode                    = DERIVE_SINARIO_MODE['binomial']
        vessel_life_time_for_simulation = VESSEL_LIFE_TIME
        retrofit_senario_mode           = RETROFIT_SCENARIO_MODE['significant']
        ## no retrofit ##
        if no_retrofit_ignore:
            print "%30s" % ("ignoring the no retrofit simulation")
        else:
            np.random.seed(common_seed_num)
            generate_market_scenarios(base_sinario, world_scale, flat_rate, sinario_mode, vessel_life_time_for_simulation)
            each_output_path           = "%s/no_retrofit" % (output_dir_path)
            initializeDirHierarchy(each_output_path)
            retrofit_mode              = RETROFIT_MODE['none']
            for weather_mode, weather_mode_val in BF_MODE.items():
                output_path = "%s/%s" % (each_output_path, weather_mode)
                initializeDirHierarchy(output_path)
                agent         = Agent(base_sinario,
                                      world_scale,
                                      flat_rate,
                                      retrofit_mode,
                                      DERIVE_SINARIO_MODE['binomial'],
                                      weather_mode_val,
                                      initial_hull, initial_engine, initial_propeller)
                agent.operation_date_array  = generate_operation_date(base_sinario.predicted_data['date'][0], str_to_date(base_sinario.predicted_data['date'][-1]))
                agent.output_dir_path       = each_output_path
                agent.retrofit_senario_mode = retrofit_senario_mode
                # simmulate with multi flag and log
                agent.simmulate(None, None, None, True, True)

        ## whole retrofit ##
        np.random.seed(common_seed_num)
        generate_market_scenarios(base_sinario, world_scale, flat_rate, sinario_mode, vessel_life_time_for_simulation)        
        each_output_path           = "%s/whole_retrofits" % (output_dir_path)
        initializeDirHierarchy(each_output_path)
        retrofit_mode              = RETROFIT_MODE['whole']
        for weather_mode, weather_mode_val in BF_MODE.items():
            output_path = "%s/%s" % (each_output_path, weather_mode)
            initializeDirHierarchy(output_path)
            agent         = Agent(base_sinario,
                                  world_scale,
                                  flat_rate,
                                  retrofit_mode,
                                  DERIVE_SINARIO_MODE['binomial'],
                                  weather_mode_val,
                                  initial_hull, initial_engine, initial_propeller)
            agent.operation_date_array  = generate_operation_date(base_sinario.predicted_data['date'][0], str_to_date(base_sinario.predicted_data['date'][-1]))
            agent.output_dir_path       = each_output_path
            agent.retrofit_senario_mode = retrofit_senario_mode
            # simmulate with multi flag and log
            agent.simmulate(None, None, None, True, True)
        
        '''
        ## propeller retrofit ##
        if propeller_retrofit_ignore:
            print "%30s" % ("ignoring the propeller retrofit simulation")
        else:
            np.random.seed(common_seed_num)
            generate_market_scenarios(base_sinario, world_scale, flat_rate, sinario_mode, vessel_life_time_for_simulation)
            each_output_path           = "%s/propeller" % (output_dir_path)
            initializeDirHierarchy(each_output_path)
            retrofit_mode              = RETROFIT_MODE['propeller']
            agent                      = Agent(base_sinario, world_scale, flat_rate, retrofit_mode, sinario_mode, initial_hull, initial_engine, initial_propeller)
            agent.operation_date_array = generate_operation_date(base_sinario.predicted_data['date'][0], str_to_date(base_sinario.predicted_data['date'][-1]))                
            agent.output_dir_path      = each_output_path
            # simmulate with multi flag and log
            agent.simmulate(None, None, None, True, True)

        ## propeller and engine retrofit ##
        if propeller_and_engine_retrofit_ignore:
            print "%30s" % ("ignoring the propeller retrofit simulation")
        else:
            np.random.seed(common_seed_num)
            generate_market_scenarios(base_sinario, world_scale, flat_rate, sinario_mode, vessel_life_time_for_simulation)        
            each_output_path           = "%s/propeller_and_engine" % (output_dir_path)
            initializeDirHierarchy(each_output_path)
            retrofit_mode              = RETROFIT_MODE['propeller_and_engine']
            agent                      = Agent(base_sinario, world_scale, flat_rate, retrofit_mode, sinario_mode, initial_hull, initial_engine, initial_propeller)
            agent.operation_date_array = generate_operation_date(base_sinario.predicted_data['date'][0], str_to_date(base_sinario.predicted_data['date'][-1]))
            agent.output_dir_path      = each_output_path
            # simmulate with multi flag and log
            agent.simmulate(None, None, None, True, True)
        '''
        print_with_notice("Program finished at %s" % (detailed_datetime_to_human(datetime.datetime.now())))        
        
    return 
开发者ID:tstomoki,项目名称:navigation_simulator,代码行数:104,代码来源:main.py


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