def __init__( self, cache_directory, year, travel_model_data_directory='baseline_travel_model_psrc_baseline'): config = AbstractUrbansimConfiguration() config_changes = { 'description': 'baseline with travel model', 'cache_directory': cache_directory, 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', unroll_gridcells=False, tables_to_cache=[], tables_to_copy_to_previous_years={}, ), 'models': [], # run no urbansim models 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='PSRC_2000_baseyear', ), 'base_year': year, 'years': (year, year), } config.merge(config_changes) years_to_run = { 2005: '2000_06', 2010: '2010_06', 2015: '2010_06', 2020: '2020_06', 2025: '2020_06', 2030: '2030_06', } year_to_run = {year: years_to_run[year]} travel_model_config = create_travel_model_configuration( travel_model_data_directory, mode='get_emme2_data_after_run', years_to_run=year_to_run, emme2_batch_file='QUICKRUN.BAT') config['travel_model_configuration'] = travel_model_config self.merge(config)
def setUp(self): self.storage = dict_storage() self.storage.write_table(table_name='development_type_groups', table_data={ "group_id": array([1, 2, 3, 4]), "name": array([ 'residential', 'commercial', 'industrial', 'governmental' ]), }) run_configuration = AbstractUrbansimConfiguration() self.model_configuration = run_configuration['models_configuration'] SessionConfiguration( new_instance=True, package_order=run_configuration['dataset_pool_configuration']. package_order, in_storage=self.storage)
def setUp(self): """specify the development event history for the gridcells. here, we simulate 50 residential units and 5000 commercial, industrial, and governmental sqft added to each of the gridcells in previous years. Also, we specify $1000 in value added to each gridcell for residential, commercial, industrial, governmental. These values are so boring because they really don't matter for this test case, where there will be absolutely no development, and thus, nothing will be sampled from the development_history""" self.storage = StorageFactory().get_storage('dict_storage') self.storage.write_table(table_name='development_event_history', table_data={ "grid_id": arange(1, 100 + 1), "scheduled_year": array(100 * [1999]), "residential_units": array(100 * [50]), "commercial_sqft": array(100 * [5000]), "industrial_sqft": array(100 * [5000]), "governmental_sqft": array(100 * [5000]), "residential_improvement_value": array(100 * [1000]), "commercial_improvement_value": array(100 * [1000]), "industrial_improvement_value": array(100 * [1000]), "governmental_improvement_value": array(100 * [1000]) }) # create 100 gridcells, each with 200 residential units and space for 100 commercial jobs, # 100 industrial jobs, and residential, industrial, and commercial value at $500,000 each self.storage.write_table(table_name='gridcells', table_data={ "grid_id": arange(1, 100 + 1), "residential_units": array(100 * [200]), "commercial_sqft": array(100 * [10000]), "commercial_sqft_per_job": array(100 * [100]), "industrial_sqft": array(100 * [10000]), "industrial_sqft_per_job": array(100 * [100]), "residential_improvement_value": array(100 * [500000]), "commercial_improvement_value": array(100 * [500000]), "industrial_improvement_value": array(100 * [500000]) }) # create 10000 households, 100 in each of the 100 gridcells. # there will initially be 100 vacant residential units in each gridcell then. self.storage.write_table(table_name='households', table_data={ "household_id": arange(1, 10000 + 1), "grid_id": array(100 * range(1, 100 + 1)) }) self.storage.write_table(table_name='job_building_types', table_data={ "id": array([ Constants._governmental_code, Constants._commercial_code, Constants._industrial_code, Constants._residential_code ]), "name": array([ "governmental", "commercial", "industrial", "home_based" ]), "home_based": array([0, 0, 0, 1]) }) # create 2500 commercial jobs and distribute them equally across the 100 gridcells, # 25 commercial jobs/gridcell self.storage.write_table(table_name='jobs', table_data={ "job_id": arange(1, 2500 + 1), "grid_id": array(25 * range(1, 100 + 1)), "sector_id": array(2500 * [1]), "home_based": array(2500 * [0]), "building_type": array(2500 * [Constants._commercial_code]) }) self.storage.write_table(table_name='urbansim_constants', table_data={ "acres": array([105.0]), }) self.dataset_pool = DatasetPool(package_order=['urbansim'], storage=self.storage) self.compute_resources = Resources({ "household": self.dataset_pool.get_dataset('household'), "job": self.dataset_pool.get_dataset('job'), "job_building_type": self.dataset_pool.get_dataset('job_building_type'), 'urbansim_constant': self.dataset_pool.get_dataset('urbansim_constant'), }) # # ? dynamically get these datasets? # Replace uses of 'constants' with 'urbansim_constant'? # from urbansim.configs.base_configuration import AbstractUrbansimConfiguration # fake development project models #dev_models = { #'residential_model':{ #'controller':{ #'init':{ #'arguments':{ #'project_type':'residential', #'residential':True, #'units':'residential_units' #} #}, #'prepare_for_estimate':{ #'arguments':{ #'categories':[1, 2, 3, 5, 10, 20] #} #} #} #}, #'commercial_model':{ #'controller':{ #'init':{ #'arguments':{ #'project_type':'commercial', #'residential':False, #'units': 'commercial_sqft' #} #}, #'prepare_for_estimate':{ #'arguments': { #'categories':[1000, 2000, 5000, 10000] #} #} #} #}, #'industrial_model':{ #'controller':{ #'init':{ #'arguments':{ #'project_type':'industrial', #'residential':False, #'units':'industrial_sqft' #} #}, #'prepare_for_estimate':{ #'arguments':{ #'categories':[1000, 2000, 5000, 10000] #} #} #} #} #} self.models_configuration = AbstractUrbansimConfiguration( )['models_configuration']
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.storage_factory import StorageFactory from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration from urbansim.configs.base_configuration import AbstractUrbansimConfiguration from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration from opus_core.database_management.database_server import DatabaseServer config = AbstractUrbansimConfiguration() db_server = DatabaseServer(ScenarioDatabaseConfiguration()) db = db_server.get_database('PSRC_2000_scenario_E_constrained_king_county') config_changes = { 'description': 'constrained king county capacity baseline with full travel model', 'in_storage': StorageFactory().get_storage('sql_storage', storage_location=db), 'cache_directory': None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root='d:/urbansim_cache', cache_from_database=True, cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database',
def __init__(self): from copy import deepcopy config = deepcopy(AbstractUrbansimConfiguration()) cache_directory = os.path.join(package().get_opus_core_path(), 'data', 'test_cache') config_changes = { 'description': 'Test cache', 'base_year': 1980, 'years': (1981, 1982), 'models': [ 'prescheduled_events', 'events_coordinator', 'residential_land_share_model', 'land_price_model', 'development_project_transition_model', 'residential_development_project_location_choice_model', 'commercial_development_project_location_choice_model', 'industrial_development_project_location_choice_model', 'development_event_transition_model', 'events_coordinator', 'residential_land_share_model', 'household_transition_model', 'employment_transition_model', 'household_relocation_model', 'household_location_choice_model', 'employment_relocation_model', { 'employment_location_choice_model': { 'group_members': '_all_' } }, 'distribute_unplaced_jobs_model', ], 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='eugene_1980_baseyear', ), 'cache_directory': cache_directory, 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root='c:/urbansim_cache', cache_from_database=False, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy=cache_directory, ), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=[ 'annual_employment_control_totals', 'annual_household_control_totals', 'buildings', 'building_types', 'development_event_history', 'gridcells', 'households', 'job_building_types', 'jobs', 'travel_data', 'zones', 'counties', 'commercial_development_location_choice_model_coefficients', 'commercial_development_location_choice_model_specification', 'commercial_employment_location_choice_model_coefficients', 'commercial_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_specification', 'industrial_development_location_choice_model_coefficients', 'industrial_development_location_choice_model_specification', 'residential_development_location_choice_model_coefficients', 'residential_development_location_choice_model_specification', #'fazes', 'urbansim_constants', 'household_location_choice_model_coefficients', 'household_location_choice_model_specification', 'land_price_model_coefficients', 'land_price_model_specification', 'residential_land_share_model_coefficients', 'residential_land_share_model_specification', #'plan_type_group_definitions', #'plan_type_groups', #'large_areas', 'household_characteristics_for_ht', 'development_types', 'development_type_group_definitions', 'development_constraints', 'annual_relocation_rates_for_households', 'annual_relocation_rates_for_jobs', 'base_year', 'cities', #'development_events', 'development_type_groups', 'employment_adhoc_sector_group_definitions', 'employment_adhoc_sector_groups', 'employment_sectors', 'plan_types', 'race_names', 'target_vacancies' #'jobs_for_estimation', #'households_for_estimation', #'development_events_exogenous', ], tables_to_cache_nchunks={'gridcells': 1}, tables_to_copy_to_previous_years={ 'development_type_group_definitions': 1975, 'development_type_groups': 1975, 'development_types': 1975, 'urbansim_constants': 1975, }, ), } config.merge(config_changes) self.merge(config)
def __init__(self): config = AbstractUrbansimConfiguration() config_changes = { 'project_name': 'washtenaw', 'description': 'Region Pilot Baseline', 'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name='washtenaw_class', ), 'models': [ 'prescheduled_events', 'events_coordinator', 'residential_land_share_model', 'land_price_model', 'regional_development_project_transition_model', 'residential_regional_development_project_location_choice_model', 'commercial_regional_development_project_location_choice_model', 'industrial_regional_development_project_location_choice_model', 'development_event_transition_model', 'events_coordinator', 'residential_land_share_model', 'jobs_event_model', #'households_event_model', 'regional_household_transition_model', 'regional_household_relocation_model', 'regional_household_location_choice_model', 'regional_employment_transition_model', 'regional_employment_relocation_model', { 'regional_employment_location_choice_model': { 'group_members': ['_all_'] } }, 'regional_distribute_unplaced_jobs_model' ], 'cache_directory': None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root="/urbansim_cache/washtenaw", cache_from_database=True, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy= "/urbansim_cache/washtenaw/cache_source", ), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=self.tables_to_cache, tables_to_cache_nchunks={'gridcells': 1}, tables_to_copy_to_previous_years=self. tables_to_copy_to_previous_years, ), 'datasets_to_preload': { 'development_constraint': {}, 'development_event_history': {}, 'development_type': {}, 'gridcell': { 'nchunks': 2 }, 'household': {}, 'job': {}, 'job_building_type': {}, 'target_vacancy': {}, 'zone': {}, 'jobs_event': {}, #'households_event': {}, }, 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['washtenaw', 'urbansim', 'opus_core'], ), 'base_year': 2005, 'years': (2006, 2010), } config.merge(config_changes) self.merge(config) self.merge_with_controller() try: exec('from %s_local_config import my_configuration' % getuser()) local_config = True except: logger.log_note( "No user's settings found or error occured when loading.") local_config = False if local_config: self.merge(my_configuration)
def __init__(self): config = AbstractUrbansimConfiguration() end_year = 2030 config_changes = { 'description':'baseline with travel model', 'cache_directory':None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( cache_directory_root = '/urbansim_cache/psrc/gridcell_run_set', #'/projects/urbansim5/urbansim_cache/psrc_gridcell', cache_from_database = True, cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache = [ 'annual_employment_control_totals', 'annual_household_control_totals', 'buildings', 'building_types', 'development_event_history', 'gridcells', 'households', 'job_building_types', 'jobs', 'travel_data', 'zones', 'counties', 'commercial_development_location_choice_model_coefficients', 'commercial_development_location_choice_model_specification', 'commercial_employment_location_choice_model_coefficients', 'commercial_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_specification', 'industrial_development_location_choice_model_coefficients', 'industrial_development_location_choice_model_specification', 'residential_development_location_choice_model_coefficients', 'residential_development_location_choice_model_specification', 'fazes', 'urbansim_constants', 'household_location_choice_model_coefficients', 'household_location_choice_model_specification', 'land_price_model_coefficients', 'land_price_model_specification', 'residential_land_share_model_coefficients', 'residential_land_share_model_specification', 'plan_type_group_definitions', 'plan_type_groups', 'large_areas', 'household_characteristics_for_ht', 'development_types', 'development_type_group_definitions', 'development_constraints', 'annual_relocation_rates_for_households', 'annual_relocation_rates_for_jobs', 'base_year', 'cities', 'development_events', 'development_type_groups', 'employment_adhoc_sector_group_definitions', 'employment_adhoc_sector_groups', 'employment_events', 'employment_sectors', 'land_use_events', 'plan_types', 'race_names', 'target_vacancies', 'jobs_for_estimation', 'households_for_estimation', 'development_events_exogenous', 'job_building_types', 'persons', 'persons_for_estimation', ], tables_to_cache_nchunks = {'gridcells': 4}, tables_to_copy_to_previous_years = { 'development_type_groups': 1995, 'development_types': 1995, 'development_type_group_definitions': 1995, 'development_constraints': 1995, 'urbansim_constants': 1995, }, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name = 'PSRC_2000_baseyear', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['psrc', 'urbansim', 'opus_core'], ), 'base_year':2000, 'years':(2001, end_year), } config.merge(config_changes) self.merge(config) self['post_year_configuration'] = create_post_year_configuration(end_year)
def __init__(self): config = AbstractUrbansimConfiguration() db_server = DatabaseServer(ScenarioDatabaseConfiguration()) db = db_server.get_database('PSRC_2000_baseyear') config_changes = { 'description':'baseline with travel model', 'in_storage':StorageFactory().get_storage('sql_storage', storage_location = db ), 'cache_directory':None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( cache_directory_root = 'd:/urbansim_cache', cache_from_database = True, baseyear_cache = BaseyearCacheConfiguration( r'D:\urbansim_cache\run_1417.2006_12_08_01_50'), cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache = [ 'annual_employment_control_totals', 'annual_household_control_totals', 'buildings', 'building_types', 'development_event_history', 'gridcells', 'households', 'job_building_types', 'jobs', 'travel_data', 'zones', 'counties', 'commercial_development_location_choice_model_coefficients', 'commercial_development_location_choice_model_specification', 'commercial_employment_location_choice_model_coefficients', 'commercial_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_specification', 'industrial_development_location_choice_model_coefficients', 'industrial_development_location_choice_model_specification', 'residential_development_location_choice_model_coefficients', 'residential_development_location_choice_model_specification', 'fazes', 'urbansim_constants', 'household_location_choice_model_coefficients', 'household_location_choice_model_specification', 'land_price_model_coefficients', 'land_price_model_specification', 'residential_land_share_model_coefficients', 'residential_land_share_model_specification', 'plan_type_group_definitions', 'plan_type_groups', 'large_areas', 'household_characteristics_for_ht', 'development_types', 'development_type_group_definitions', 'development_constraints', 'annual_relocation_rates_for_households', 'annual_relocation_rates_for_jobs', 'base_year', 'cities', 'development_events', 'development_type_groups', 'employment_adhoc_sector_group_definitions', 'employment_adhoc_sector_groups', 'employment_events', 'employment_sectors', 'land_use_events', 'plan_types', 'race_names', 'target_vacancies', 'jobs_for_estimation', 'households_for_estimation', 'development_events_exogenous', 'job_building_types' ], tables_to_cache_nchunks = {'gridcells': 4}, tables_to_copy_to_previous_years = { 'development_type_groups': 1995, 'development_types': 1995, 'development_type_group_definitions': 1995, }, ), 'models':[], # run no urbansim models 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name = 'PSRC_2000_baseyear', ), 'base_year':2000, 'years':(2001, 2002), 'unroll_gridcells':False } config.merge(config_changes) travel_model_config = create_travel_model_configuration('baseline_travel_model_psrc_fresh', mode='get_emme2_data_after_run', years_to_run = {2001:'2000_06'}, emme2_batch_file='MODEL05.BAT') config['travel_model_configuration'] = travel_model_config self.merge(config)
# Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration #from urbansim.estimation.config import config from urbansim.configs.base_configuration import AbstractUrbansimConfiguration from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration from randstad.run_config.controller_config import models_configuration run_configuration = AbstractUrbansimConfiguration() my_run_configuration = { 'models_configuration':models_configuration, 'scenario_database_configuration':ScenarioDatabaseConfiguration( database_name = 'randstad_021105_estimation', ), #'cache_directory':'C:/urbansim_cache/randstad_source', 'cache_directory':None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( cache_directory_root = 'C:/urbansim_cache/randstad', cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database', unroll_gridcells = False, cache_from_database = False, # location of existing baseyear cache to use baseyear_cache = BaseyearCacheConfiguration( existing_cache_to_copy = r'C:\urbansim_cache\randstad\run_618.2006_07_16_18_06',
def __init__(self): config = AbstractUrbansimConfiguration() db_server = DatabaseServer(ScenarioDatabaseConfiguration()) db = db_server.get_database('PSRC_2000_baseyear') config_changes = { 'description': 'baseline with no travel model', 'in_storage': StorageFactory().get_storage('sql_storage', storage_location=db), 'cache_directory': None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root='c:/urbansim_cache', cache_from_database=True, cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=[ 'annual_employment_control_totals', 'annual_household_control_totals', 'buildings', 'building_types', 'development_event_history', 'gridcells', 'households', 'job_building_types', 'jobs', 'travel_data', 'zones', 'counties', 'commercial_development_location_choice_model_coefficients', 'commercial_development_location_choice_model_specification', 'commercial_employment_location_choice_model_coefficients', 'commercial_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_specification', 'home_based_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_coefficients', 'industrial_employment_location_choice_model_specification', 'industrial_development_location_choice_model_coefficients', 'industrial_development_location_choice_model_specification', 'residential_development_location_choice_model_coefficients', 'residential_development_location_choice_model_specification', 'fazes', 'urbansim_constants', 'household_location_choice_model_coefficients', 'household_location_choice_model_specification', 'land_price_model_coefficients', 'land_price_model_specification', 'residential_land_share_model_coefficients', 'residential_land_share_model_specification', 'plan_type_group_definitions', 'plan_type_groups', 'large_areas', 'household_characteristics_for_ht', 'development_types', 'development_type_group_definitions', 'development_constraints', 'annual_relocation_rates_for_households', 'annual_relocation_rates_for_jobs', 'base_year', 'cities', 'development_events', 'development_type_groups', 'employment_adhoc_sector_group_definitions', 'employment_adhoc_sector_groups', 'employment_events', 'employment_sectors', 'land_use_events', 'plan_types', 'race_names', 'target_vacancies', 'jobs_for_estimation', 'households_for_estimation', 'development_events_exogenous', 'job_building_types' ], tables_to_cache_nchunks={'gridcells': 1}, tables_to_copy_to_previous_years={ 'development_type_groups': 1995, 'development_types': 1995, 'development_type_group_definitions': 1995, 'urbansim_constants': 1995, }, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='PSRC_2000_baseyear', ), 'base_year': 2000, 'years': (2001, 2030), } config.merge(config_changes) self.merge(config)