コード例 #1
0
    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)
コード例 #2
0
    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_mysql_data = 'urbansim.model_coordinators.cache_mysql_data',
                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',
                                                                years_to_run = year_to_run,
                                                                emme2_batch_file='QUICKRUN.BAT')
        config['travel_model_configuration'] = travel_model_config
        self.merge(config)
コード例 #3
0
 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)
コード例 #4
0
# 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',
コード例 #5
0
 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)
コード例 #6
0
    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)
コード例 #7
0
    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)
コード例 #8
0
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE

#from urbansim.estimation.config import config
from urbansim.configs.base_configuration import AbstractUrbansimConfiguration
from numpy import array
import os
from urbansim.datasets.development_event_dataset import DevelopmentEventTypeOfChange

run_configuration = AbstractUrbansimConfiguration()
models_configuration = run_configuration['models_configuration']

config_changes = {
    'landuse_development_types': {
        'residential': {
            'units': 'residential_units',
            'residential': True,
        },
        'commercial': {
            'units': 'commercial_sqft',
            'residential': False,
        },
        'industrial': {
            'units': 'industrial_sqft',
            'residential': False,
        },
        'governmental': {
            'units': 'governmental_sqft',
            'residential': False,
        },
コード例 #9
0
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE

from opus_core.configuration import Configuration
from urbansim.configs.base_configuration import AbstractUrbansimConfiguration

class EstimationBaseConfig(Configuration):
    def __init__(self, base_configuration=AbstractUrbansimConfiguration):
        config = base_configuration()
        config.merge(get_changes_for_estimation(config))
        self.merge(config)
                
def get_changes_for_estimation(config):
    estimation_configuration = {}
    if "base_year" in config:
        estimation_configuration["years"] = range(config["base_year"], config["base_year"])
    estimation_configuration["sample_size_locations"] = 30
    estimation_configuration["seed"] = 1,#(1,1)
    return estimation_configuration

run_configuration = AbstractUrbansimConfiguration()

estimation_configuration = get_changes_for_estimation(run_configuration)
run_configuration.merge(estimation_configuration)
コード例 #10
0
    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']
コード例 #11
0
ファイル: baseline.py プロジェクト: psrc/urbansim
 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)
コード例 #12
0
 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)
コード例 #13
0
# 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',
コード例 #14
0
# 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',
コード例 #15
0
    def __init__(self):
        AbstractUrbansimConfiguration.__init__(self)

        config_changes = {
            'project_name':'vibe_gridcell',
            'description':'Eugene baseline',
            'base_year':1980,
            'years':(1981,1982,1983),
            'models': [   
                'prescheduled_events',
                'events_coordinator',
                #'residential_land_share_model',
                #'fertility_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 = 'eugen_base_year_data_1980'),
            #'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name = 'vibe_base_year_data_1980'),
	    'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name = 'urbansim_export_test'),
            'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration(
                #cache_directory_root = os.path.join(os.environ['OPUS_HOME'], 'data/eugene_gridcell/runs'),
                cache_directory_root = os.path.join(os.environ['OPUS_HOME'], 'data/vibe_gridcell/runs'),
                #cache_scenario_database = storage,
                cache_from_database = True,
                baseyear_cache = BaseyearCacheConfiguration(
                    existing_cache_to_copy =  os.path.join(os.environ['OPUS_HOME'], 'data/vibe_gridcell/base_year_data'),
                    ),
    		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',
                    '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',
                    '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_type_groups',
                    #'employment_adhoc_sector_group_definitions',
                    #'employment_adhoc_sector_groups',
                    #'employment_sectors',
                    'plan_types',
                    'plan_type_groups',
                    'plan_type_group_definitions',                    
                    'race_names',
                    'target_vacancies',
                    #'jobs_for_estimation',
                    'households_for_estimation',
                    ],
                tables_to_cache_nchunks = {'gridcells': 1},
                tables_to_copy_to_previous_years = {
                    'development_type_group_definitions': 1975,
                    'development_type_groups': 1975,
                    'development_types': 1975,
                    'development_constraints':1975,
                    'urbansim_constants': 1975,
                    },
                ),
            'dataset_pool_configuration': DatasetPoolConfiguration(
                package_order=['vibe_min', 'urbansim', 'opus_core'],

                ),
            }
        self.merge(config_changes)
    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, 2001),
            "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="QUICKRUN.BAT",
        )
        config["travel_model_configuration"] = travel_model_config
        self.merge(config)
コード例 #17
0
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE

from opus_core.configuration import Configuration
from urbansim.configs.base_configuration import AbstractUrbansimConfiguration


class EstimationBaseConfig(Configuration):
    def __init__(self, base_configuration=AbstractUrbansimConfiguration):
        config = base_configuration()
        config.merge(get_changes_for_estimation(config))
        self.merge(config)


def get_changes_for_estimation(config):
    estimation_configuration = {}
    if "base_year" in config:
        estimation_configuration["years"] = range(config["base_year"],
                                                  config["base_year"])
    estimation_configuration["sample_size_locations"] = 30
    estimation_configuration["seed"] = 1,  #(1,1)
    return estimation_configuration


run_configuration = AbstractUrbansimConfiguration()

estimation_configuration = get_changes_for_estimation(run_configuration)
run_configuration.merge(estimation_configuration)
コード例 #18
0
ファイル: baseline.py プロジェクト: urban-ai/VIBe2UrbanSim
    def __init__(self):
        AbstractUrbansimConfiguration.__init__(self)

        config_changes = {
            'project_name':
            'vibe_gridcell',
            'description':
            'Eugene baseline',
            'base_year':
            1980,
            'years': (1981, 1982, 1983),
            'models': [
                'prescheduled_events',
                'events_coordinator',
                #'residential_land_share_model',
                #'fertility_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 = 'eugen_base_year_data_1980'),
            #'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name = 'vibe_base_year_data_1980'),
            'scenario_database_configuration':
            ScenarioDatabaseConfiguration(
                database_name='urbansim_export_test'),
            'creating_baseyear_cache_configuration':
            CreatingBaseyearCacheConfiguration(
                #cache_directory_root = os.path.join(os.environ['OPUS_HOME'], 'data/eugene_gridcell/runs'),
                cache_directory_root=os.path.join(os.environ['OPUS_HOME'],
                                                  'data/vibe_gridcell/runs'),
                #cache_scenario_database = storage,
                cache_from_database=True,
                baseyear_cache=BaseyearCacheConfiguration(
                    existing_cache_to_copy=os.path.join(
                        os.environ['OPUS_HOME'],
                        'data/vibe_gridcell/base_year_data'), ),
                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',
                    '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',
                    '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_type_groups',
                    #'employment_adhoc_sector_group_definitions',
                    #'employment_adhoc_sector_groups',
                    #'employment_sectors',
                    'plan_types',
                    'plan_type_groups',
                    'plan_type_group_definitions',
                    'race_names',
                    'target_vacancies',
                    #'jobs_for_estimation',
                    'households_for_estimation',
                ],
                tables_to_cache_nchunks={'gridcells': 1},
                tables_to_copy_to_previous_years={
                    'development_type_group_definitions': 1975,
                    'development_type_groups': 1975,
                    'development_types': 1975,
                    'development_constraints': 1975,
                    'urbansim_constants': 1975,
                },
            ),
            'dataset_pool_configuration':
            DatasetPoolConfiguration(
                package_order=['vibe_min', 'urbansim', 'opus_core'], ),
        }
        self.merge(config_changes)
コード例 #19
0
    def __init__(self):
        AbstractUrbansimConfiguration.__init__(self)
        models_configuration = self['models_configuration']
        
        self['project_name'] = 'urbansim_parcel'
        ## employment_location_choice_model is defined for gridcells at urbansim package 
        if "home_based_employment_location_choice_model" in models_configuration:
            del models_configuration["home_based_employment_location_choice_model"]
        if "non_home_based_employment_location_choice_model" in models_configuration:
            del models_configuration["non_home_based_employment_location_choice_model"]
        models_configuration['workplace_choice_model_for_resident'] = {
                       "estimation":"opus_core.bhhh_mnl_estimation",
                       "sampler":"opus_core.samplers.weighted_sampler",
                       "sample_size_locations":30,
                       "weights_for_estimation_string":"is_placed_job=(urbansim_parcel.job.zone_id > 0).astype(int32)",
                       "compute_capacity_flag":True,
                       "capacity_string":"urbansim_parcel.job.is_untaken_non_home_based_job",
                       #"capacity_string":"(job.building_type==2).astype(int32)",  
                         ### each non home-based job can only be chosen once by one person
                       "number_of_units_string":"(job.building_type==2).astype(int32)",
                        'lottery_max_iterations': 10,
                        'number_of_agents_string': 'job.number_of_agents(person)',
#                       "sampler":"opus_core.samplers.stratified_sampler",
#                       "stratum":"district_id = job.disaggregate(psrc_parcel.building.district_id)",
#                       "sample_size_from_each_stratum": 5,
#                       "sample_size_from_chosen_stratum":4,
#                       "include_chosen_choice":True,
#                       "sample_size_locations":95,
#                       "weights_for_estimation_string":"is_placed_job=(urbansim_parcel.job.zone_id > 0).astype(int32)",
#                       "compute_capacity_flag":True,
#                       "capacity_string":"(job.building_type==2).astype(int32)",  
#                        ### each non home-based job can only be chosen once by one person
#                       "number_of_units_string":"(job.building_type==2).astype(int32)",

        }
        
        my_controller_configuration = {
         'real_estate_price_model': {
            "import": {"urbansim.models.real_estate_price_model":
                                                "RealEstatePriceModel"},
            "init": {
                "name": "RealEstatePriceModel",
                "arguments": {"submodel_string": "'land_use_type_id'",
                              "outcome_attribute": "'ln_unit_price=ln(urbansim_parcel.parcel.unit_price)'",
                              "filter_attribute": "'numpy.logical_or(urbansim_parcel.parcel.building_sqft, urbansim_parcel.parcel.is_land_use_type_vacant)'",
                              "dataset_pool": "dataset_pool",
                              "estimate_config": "{'save_predicted_values_and_errors':True}"
                              },
                },
            "prepare_for_run": {
                "name": "prepare_for_run",
                "arguments": {"specification_storage": "base_cache_storage",
                              "specification_table": "'real_estate_price_model_specification'",
                               "coefficients_storage": "base_cache_storage",
                               "coefficients_table": "'real_estate_price_model_coefficients'"},
                "output": "(specification, coefficients)"
                },
            "run": {
                "arguments": {
                              "specification": "specification",
                              "coefficients":"coefficients",
                              "dataset": "parcel",
                              "data_objects": "datasets",
                              "run_config": "Resources({'exclude_outliers_from_initial_error': True, 'outlier_is_less_than': %s, 'outlier_is_greater_than': %s})" % (log(UNIT_PRICE_RANGE[0]), log(UNIT_PRICE_RANGE[1]))
                              }
                    },
            "prepare_for_estimate": {
                "name": "prepare_for_estimate",
                "arguments": {"specification_storage": "base_cache_storage",
                              "specification_table": "'real_estate_price_model_specification'",
                              "filter_variable":"'numpy.logical_and(urbansim_parcel.parcel.unit_price>%s,urbansim_parcel.parcel.unit_price<%s, urbansim_parcel.parcel.existing_units>100)'" % (UNIT_PRICE_RANGE[0], UNIT_PRICE_RANGE[1]),
                              "dataset": "parcel",
                              "threshold": 0},
                "output": "(specification, index)"
                },
            "estimate": {
                "arguments": {
                              "specification": "specification",
                              "outcome_attribute": "'ln_unit_price=ln(urbansim_parcel.parcel.unit_price)'",
                              "dataset": "parcel",
                              "index": "index",
                              "data_objects": "datasets",
                              "debuglevel": 'debuglevel',
                              #'procedure': "'opus_core.bma_for_linear_regression_r'",
                              },
                "output": "(coefficients, dummy)"
                }
        
          },

         'employment_transition_model': 
                  EmploymentTransitionModelConfigurationCreator(
            location_id_name="building_id"
            ).execute(),
 
        'employment_relocation_model': 
                  EmploymentRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               output_index = 'erm_index').execute(),
                                       
         'employment_location_choice_model': 
                   EmploymentLocationChoiceModelConfigurationCreator(
                                sample_size_locations = 60,
                                location_set = "building",
                                input_index = 'erm_index',
                                estimation_weight_string = None,
                                #agents_for_estimation_table = None, # will take standard jobs table 
                                agents_for_estimation_table = "jobs_for_estimation",
                                join_datasets = True,
                                #estimation_size_agents = 0.3,
                                number_of_units_string = "total_SSS_job_space",
                                filter = "building.non_residential_sqft>0",
                                filter_for_estimation = "numpy.logical_and(job.building_id>0, job.disaggregate(building.non_residential_sqft) > 0)",
                                #filter_for_estimation = "numpy.logical_and(job.building_id>0,job.join_flag<3)",
                                portion_to_unplace = 0,
                                capacity_string = "vacant_SSS_job_space",
                                variable_package = "urbansim_parcel",
                                lottery_max_iterations = 10
                                ).execute(),
                                       
            'home_based_employment_location_choice_model': 
                   EmploymentLocationChoiceModelConfigurationCreator(
                                location_set = "building",
                                input_index = 'erm_index',
                                estimation_weight_string = "vacant_home_based_job_space", #"pre_2001=building.year_built<=2000",
                                agents_for_estimation_table = None, # will take standard jobs table 
                                estimation_size_agents = 0.4,
                                number_of_units_string = None,
                                filter = "numpy.logical_and(building.residential_units, building.sqft_per_unit)", 
                                filter_for_estimation = "numpy.logical_and(job.building_id>0, job.disaggregate(building.sqft_per_unit>0))",
                                portion_to_unplace = 0,
                                capacity_string = "vacant_home_based_job_space",
                                variable_package = "urbansim_parcel",
                                lottery_max_iterations = 7
                                ).execute(),
            'distribute_unplaced_jobs_model':  DistributeUnplacedJobsModelConfigurationCreator(
                                    location_set = 'building',
                                    filter = 'urbansim_parcel.building.is_governmental',
                                    agents_filter = 'urbansim.job.is_in_employment_sector_group_scalable_sectors'
                                                                                  ).execute(),
            'distribute_unplaced_mining_utilities_jobs_model':  DistributeUnplacedJobsModelConfigurationCreator(
                                    location_set = 'building',
                                    filter = None,
                                    agents_filter = 'numpy.logical_or(job.sector_id==1, job.sector_id==9)'
                                                                                  ).execute(),
            'governmental_employment_location_choice_model': 
                   GovernmentalEmploymentLocationChoiceModelConfigurationCreator(
                        input_index = 'erm_index',
                        location_set = 'building',
                        filter = 'urbansim_parcel.building.is_governmental'
                        ).execute(),                       
                "household_relocation_model" : {
                    "import": {"urbansim.models.household_relocation_model_creator":
                                    "HouseholdRelocationModelCreator"
                              },
                    "init": {
                        "name": "HouseholdRelocationModelCreator().get_model",
                        "arguments": {
                                      "debuglevel": 'debuglevel',
                                      "location_id_name": "'building_id'",
                                      },
                        },
                     "prepare_for_run": {
                         "name": "prepare_for_run",
                         "arguments": {"what": "'households'",  "rate_storage": "base_cache_storage",
                                           "rate_table": "'annual_relocation_rates_for_households'"},
                         "output": "hrm_resources"
                        },
                    "run": {
                        "arguments": {"agent_set": "household", "resources": "hrm_resources"},
                        "output": "hrm_index"
                        }
                    },
                    
        "process_pipeline_events":{
                     "import": {"urbansim_parcel.models.process_pipeline_events":
                                                         "ProcessPipelineEvents"},
                     "init": {
                        "name": "ProcessPipelineEvents"},
                     "run": {
                        "arguments": {'building_dataset': 'building',
                                      'year':'year',
                                      "storage": "base_cache_storage"},
                        "output": "scheduled_development_events"
                        }
                 },

        "tour_schedule_model":{
                     "import": {"urbansim_parcel.models.tour_schedule_model":
                                                         "TourScheduleModel"},
                     "init": {
                         "name": "TourScheduleModel"},
                     "run": {
                        "arguments": {'person_set': 'person',
                                      'tour_set': 'tour',
                                      'tour_filter': "'tour.w2h_act == 1'"
                                      },
                        "output": "sampled_tour"
                        }
                 },
                
        'household_transition_model': {
            'import': {
                'urbansim_parcel.models.household_transition_model': 'HouseholdTransitionModel'
                },
            'init': {
                'arguments': {'debuglevel': 'debuglevel'},
                'name': 'HouseholdTransitionModel'
                },
            'prepare_for_run': {
                'arguments': {'storage': 'base_cache_storage'},
                'name': 'prepare_for_run',
                'output': '(control_totals, characteristics)'
                },
            'run': {
                'arguments': {
                    'characteristics': 'characteristics',
                    'control_totals': 'control_totals',
                    'person_set': 'person',
                    'household_set': 'household',
                    'year': 'year'
                    }
                }
            },
            
        # configuration for parcel-based developer model
         'expected_sale_price_model': {
            "import": {"urbansim_parcel.models.development_project_proposal_regression_model":
                       "DevelopmentProjectProposalRegressionModel"},
            "init": {
                "name": "DevelopmentProjectProposalRegressionModel",
                "arguments": {"submodel_string": "'land_use_type_id=development_project_proposal.disaggregate(development_template.land_use_type_id)'", 
                              #"submodel_string": "'building_type_id=development_project_proposal.disaggregate(development_template.building_type_id)'", 
                              #"filter_attribute": "'urbansim_parcel.development_project_proposal.is_viable'",
                              "filter_attribute": "'urbansim_parcel.development_project_proposal.is_size_fit'",
                              "outcome_attribute_name":"'ln_unit_price_expected'",
                              "dataset_pool": "dataset_pool"
                              },
                },
            "prepare_for_run": {
                "name": "prepare_for_run",
                "arguments": {"parcel_filter_for_new_development":"'has_vacant_land=urbansim_parcel.parcel.vacant_land_area > 0'",
                              "parcel_filter_for_redevelopment":"'low_improvement_ratio_of_parcels_with_bldg=(parcel.number_of_agents(building)>0)*(urbansim_parcel.parcel.improvement_value / ( urbansim_parcel.parcel.unit_price * urbansim_parcel.parcel.existing_units ) < 0.1)*(parcel.aggregate(urbansim_parcel.building.age_masked, function=mean)>30)'",
                              "template_filter":"'development_template.is_active > 0'",
                              "specification_storage": "base_cache_storage",
                              "specification_table": "'real_estate_price_model_specification'",
                               "coefficients_storage": "base_cache_storage",
                               "coefficients_table": "'real_estate_price_model_coefficients'",
                               "spec_replace_module_variable_pair": "('psrc_parcel.estimation.repm_specification', 'variables_for_development_project_proposal')",
                               "dataset_pool": "dataset_pool",},
                "output": "(development_project_proposal, specification, coefficients)"
                },
            "run": {
                "arguments": {
                              "specification": "specification",
                              "coefficients":"coefficients",
                              "dataset": 'development_project_proposal',  
                              "data_objects": "datasets" },
                "output":"development_project_proposal"  #get the development project proposal back
                    },
          },

         'development_proposal_choice_model': {
            "import": {"urbansim_parcel.models.development_project_proposal_sampling_model":
                       "DevelopmentProjectProposalSamplingModel"},
            "init": {
                "name": "DevelopmentProjectProposalSamplingModel",
                "arguments": {"proposal_set": "development_project_proposal",
                              #weight_string omitted to use defalut value "exp_ROI = exp(urbansim_parcel.development_project_proposal.expected_rate_of_return_on_investment)",                      
                              "filter_attribute": None, # the filter has been handled in the process of creating proposal set 
                                                        # (prepare_for_run in expected_sale_price_model)
                              },
                },
            "run": {
                "arguments": {'n':500,  # sample 500 proposal at a time, evaluate them one by one
                              },
                "output":"(development_project_proposal, demolished_buildings)"
                    },
          },
         
         'development_project_proposal_choice_model': {
            "import": {"urbansim_parcel.models.development_project_proposal_choice_model":
                       "DevelopmentProjectProposalChoiceModel"},
            "init": {
                "name": "DevelopmentProjectProposalChoiceModel",
                "arguments": {"proposal_set": "development_project_proposal",
                              #weight_string omitted to use defalut value "exp_ROI = exp(urbansim_parcel.development_project_proposal.expected_rate_of_return_on_investment)",
                              "filter": "'development_project_proposal.status_id==4'"  # id_tentative
                              },
                },            
            "prepare_for_run":{                
                "name": "prepare_for_run",
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'development_project_proposal_choice_model_coefficients'",
                    'specification_storage': 'base_cache_storage',
                    'specification_table':"'development_project_proposal_choice_model_specification'",
                    },
                'output': '(specification, coefficients)'
                },
            "run": {
                "arguments": {
                    'n':500,  # sample 500 proposal at a time, evaluate them one by one
                    "specification": "specification",
                    "coefficients":"coefficients",
                    #"agent_set": 'development_project_proposal',

                              },
                "output":"(development_project_proposal, demolished_buildings)"
                    },
            "prepare_for_estimate": {
                 "name": "prepare_for_estimate",                                      
                 "arguments": {
                     "agent_set":"development_project_proposal",
                     "agents_for_estimation_storage": "base_cache_storage",
                     "agents_for_estimation_table": "'development_project_proposals_for_estimation'",
                     "filter_for_estimation_set":None,
                     "data_objects": "datasets"
                     },
                 "output": "(specification, index)"
                 },
            'estimate': {
                'arguments': {
                    'agent_set': 'development_project_proposal',
                    'agents_index':'index',
                    'data_objects': 'datasets',
                    'debuglevel': 0,
                    'procedure': "'opus_core.bhhh_mnl_estimation'",
                    'specification': 'specification'
                    },
                'output': '(coefficients, _)'
                 },
            },
                                       
         'building_construction_model': {
             "import": {"urbansim_parcel.models.building_construction_model":
                       "BuildingConstructionModel"},
             "init": {
                "name": "BuildingConstructionModel"
                },
             "run": {
                "arguments": {
                   "development_proposal_set": "development_project_proposal",
                   "building_dataset": "building",
                   "dataset_pool": "dataset_pool",
                   "buildings_to_be_demolished": "demolished_buildings"
                   }
                 }
          },
         
       # models related to workplace_choice_model
#        'household_person_consistency_keeper':{
#            "import": {"urbansim_parcel.models.persons_consistency_keeper_model":"PersonDatasetConsistencyKeeperModel"},
#            "init": { 
#                "name": "PersonDatasetConsistencyKeeperModel",
#                "arguments": {},
#                },
#            "run": {
#                "arguments": {"household_set": "household",
#                              "person_set":"person",
#                              "expand_person_set":True,
#                          }
#                },
#            },
         'job_person_consistency_keeper':{
             "import": {"urbansim_parcel.models.persons_consistency_keeper_model":"PersonDatasetConsistencyKeeperModel"},
             "init": { 
                 "name": "PersonDatasetConsistencyKeeperModel",
                 "arguments": {},
                 },                                  
             "run": {
                 "arguments": {"job_set": "job",
                               "person_set":"person",
                               "expand_person_set":False,
                           }
                 },
             },
             
         'workplace_choice_model_for_resident': {
             "import": {"urbansim_parcel.models.workplace_choice_model":"WorkplaceChoiceModel"},
             "init": { 
                 "name": "WorkplaceChoiceModel",
                 "arguments": {
                     "location_set":"job",
                     "model_name":"'Non-home-based Workplace Choice Model for residents'",
                     "short_name":"'NHBWCM'",
                     "choices":"'urbansim.lottery_choices'",
                     "submodel_string":None, #"'psrc.person.household_income'",
                     "filter": "'urbansim_parcel.job.is_untaken_non_home_based_job'",
                     "location_id_string":"'job_id'",
                     "run_config":models_configuration['workplace_choice_model_for_resident'],
                     "estimate_config":models_configuration['workplace_choice_model_for_resident']
                     }},
             "prepare_for_run": {
                 "name": "prepare_for_run",
                 "arguments": {"specification_storage": "base_cache_storage", #"models_configuration['specification_storage']",
                               "specification_table": "'workplace_choice_model_for_resident_specification'",
                               "coefficients_storage": "base_cache_storage", #"models_configuration['coefficients_storage']",
                               "coefficients_table": "'workplace_choice_model_for_resident_coefficients'",
                               },
                 "output": "(specification, coefficients)"
                 },
             "run": {
                 "arguments": {"specification": "specification",
                               "coefficients":"coefficients",
                               "agent_set": "person",
                               "agents_index": None,
                               "agents_filter":"'urbansim_parcel.person.is_non_home_based_worker_without_job'",
                               "data_objects": "datasets",
                               "chunk_specification":"{'records_per_chunk':50000}",
                               "debuglevel": 'debuglevel',
                               },
                 },
             
             # the estimate method is not available before the estimation data is ready
             "prepare_for_estimate": {
                 "name": "prepare_for_estimate",                                      
                 "arguments": {
                     "agent_set":"person",
                     "household_set": "household",
                     "join_datasets": "True",
                     "agents_for_estimation_storage": "base_cache_storage",
                     "agents_for_estimation_table": "'persons_for_estimation'",
                     "households_for_estimation_table":"'households_for_estimation'",
                     "filter":"'urbansim_parcel.person.is_non_home_based_worker_with_job'",
                     "data_objects": "datasets"
                     },
                 "output": "(specification, workers_index)"
                 },
             "estimate": {
                 "arguments": {
                     "specification": "specification",
                     "agent_set": "person",
                     "agents_index": "workers_index",
                     "data_objects": "datasets",
                     "debuglevel": 'debuglevel',
                     },  
                 "output": "(coefficients, dummy)"                     
                 },
             },
         'work_at_home_choice_model': {
            'import': {
                'urbansim_parcel.models.work_at_home_choice_model': 'WorkAtHomeChoiceModel'
                },
            'init': {
                'arguments': {
                    'choice_set': 'job',
                    'filter': "'urbansim_parcel.job.is_untaken_home_based_job'",
                    },
                'name': 'WorkAtHomeChoiceModel'
                },
            'prepare_for_run': {
                "name": "prepare_for_run",
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'work_at_home_choice_model_coefficients'",
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'work_at_home_choice_model_specification'",
                    'agent_set': 'person',
                    'agents_filter': "'urbansim_parcel.person.is_worker_without_job'",
                    'data_objects': 'datasets'
                    },
                'output': '(specification, coefficients, _index)'
                },
            'run': {
                'arguments': {
                    'agent_set': 'person',
                    'agents_index' : '_index',
                    'choose_job_only_in_residence_zone': False,
                    'chunk_specification': "{'nchunks':1}",
                    'coefficients': 'coefficients',
                    'data_objects': 'datasets',
                    'specification': 'specification'
                    }
                },                
             "prepare_for_estimate": {
                 "name": "prepare_for_estimate",                                      
                 "arguments": {
                     "agent_set":"person",
                     "household_set": "household",
                     "join_datasets": "True",
                     "agents_for_estimation_storage": "base_cache_storage",
                     "agents_for_estimation_table": "'persons_for_estimation'",
                     "households_for_estimation_table":"'households_for_estimation'",
                     "filter":"'urbansim_parcel.person.is_worker'",
                     "data_objects": "datasets"
                     },
                 "output": "(specification, agents_index)"
                 },
            'estimate': {
                'arguments': {
                    'agent_set': 'person',
                    'agents_index': 'agents_index',
                    'data_objects': 'datasets',
                    'debuglevel': 0,
                    'procedure': "'opus_core.bhhh_mnl_estimation'",
                    'specification': 'specification'
                    },
                'output': '(coefficients, _)'
                 },
            },
             
#         "job_change_model":{
#             "import": {"urbansim.models.agent_relocation_model":
#                        "AgentRelocationModel"
#                        },         
#             "init": {
#                 "name": "AgentRelocationModel",
#                 "arguments": {"choices":"opus_core.random_choices",
#                               "probabilities":"psrc.job_change_probabilities",
#                               "location_id_name":"job_id",
#                               "model_name":"job change model",
#                               "debuglevel": 'debuglevel',
#                               },
#                 },
#             "prepare_for_run": {
#                 "name": "prepare_for_run",
#                 "arguments": {"what": "'person'",  "rate_storage": "base_cache_storage",
#                               "rate_table": "'annual_job_change_rates_for_workers'"},
#                 "output": "jcm_resources"
#                 },
#             "run": {
#                 "arguments": {"agent_set": "person", "resources": "jcm_resources"},
#                 "output": "jcm_index"
#                 }
#             },

        'modify_workers_jobs_after_moving_households': {
            "import": {"opus_core.join_attribute_modification_model": "JoinAttributeModificationModel"},
            "init": {"name": "JoinAttributeModificationModel"},
            "run": {"arguments": {
                          "dataset": "person",
                          "secondary_dataset": "household",
                          #"index": "hrm_index", # this must be the same that goes into the HLCM argument 'agents_index'
                          "attribute_to_be_modified": "'job_id'",
                          "value": -1,
                          "filter": "'household.building_id <> urbansim.household.building_id_lag1'"
                                  }
                                                 },
                            },
                            
        'modify_workers_jobs_after_moving_jobs': {
            "import": {"opus_core.join_attribute_modification_model": "JoinAttributeModificationModel"},
            "init": {"name": "JoinAttributeModificationModel"},
            "run": {"arguments": {
                          "dataset": "person",
                          "secondary_dataset": "job",
                          #"index": "erm_index", # this must be the same that goes into the ELCM argument 'agents_index'
                          "attribute_to_be_modified": "'job_id'",
                          "value": -1,
                          "filter": "'job.building_id <> urbansim.job.building_id_lag1'"
                                  }
                                                 },
                            },
                            

         'water_demand_model': {
            "import": {"psrc_parcel.models.water_demand_model":"WaterDemandModel"},
            "init": {
                "name": "WaterDemandModel",
                "arguments": {"submodel_string": "'land_use_type_id'",
                              "outcome_attribute": "'ln_month_combination_2'",
                              "filter_attribute": None,
                              "dataset_pool": "dataset_pool",
                              },
                },
            "prepare_for_run": {
                "name": "prepare_for_run",
                "arguments": {"specification_storage": "base_cache_storage",
                              "specification_table": "'water_demand_model_specification_for_month_combination_2'",
                               "coefficients_storage": "base_cache_storage",
                               "coefficients_table": "'water_demand_model_coefficients_for_month_combination_2'"},
                "output": "(specification, coefficients, _)"
                },
            "run": {
                "arguments": {
                              "specification": "specification",
                              "coefficients":"coefficients",
                              "dataset": "parcel",
                              "data_objects": "datasets",
                }
                },
            },
         }
        
        for month in range(2, 13, 2):
            month_string = "month_combination_" + str(month)
            my_controller_configuration['water_demand_model_for_' + month_string] = copy.deepcopy(my_controller_configuration['water_demand_model'])
            my_controller_configuration['water_demand_model_for_' + month_string]['init']['arguments']['outcome_attribute'] = "'%s'" % month_string
            my_controller_configuration['water_demand_model_for_' + month_string]['prepare_for_run']['arguments']['specification_table'] = "'water_demand_model_specification_for_%s'" % month_string
            my_controller_configuration['water_demand_model_for_' + month_string]['prepare_for_run']['arguments']['coefficients_table'] = "'water_demand_model_coefficients_for_%s'" % month_string
        
        my_controller_configuration["workplace_choice_model_for_immigrant"] = copy.deepcopy(my_controller_configuration["workplace_choice_model_for_resident"])
        my_controller_configuration["workplace_choice_model_for_immigrant"]["init"]["arguments"]["model_name"] = "'Non-home-based Workplace Choice Model for immigrants'"
        my_controller_configuration["workplace_choice_model_for_immigrant"]["prepare_for_run"]["arguments"]["specification_table"] = "'workplace_choice_model_for_immigrant_specification'"
        my_controller_configuration["workplace_choice_model_for_immigrant"]["prepare_for_run"]["arguments"]["coefficients_table"] = "'workplace_choice_model_for_immigrant_coefficients'"
        my_controller_configuration["workplace_choice_model_for_immigrant"]["run"]["arguments"]["agents_filter"] = "'psrc.person.is_immigrant_worker_without_job'"        
        
        for model in my_controller_configuration.keys():
            if model not in self["models_configuration"].keys():
                self["models_configuration"][model] = {}
            self['models_configuration'][model]['controller'] = my_controller_configuration[model]
        
        #settings for the HLCM
        hlcm_controller = self["models_configuration"]["household_location_choice_model"]["controller"]
        hlcm_controller["init"]["arguments"]["location_set"] = "building"
        hlcm_controller["init"]["arguments"]["location_id_string"] = "'building_id'"
        hlcm_controller["init"]["arguments"]["estimation_weight_string"] = "'urbansim_parcel.building.vacant_residential_units'"
        hlcm_controller["init"]["arguments"]["simulation_weight_string"] = "'has_vacant_units=urbansim_parcel.building.vacant_residential_units>0'"
        hlcm_controller["init"]["arguments"]["capacity_string"] = "'urbansim_parcel.building.vacant_residential_units'"
        #hlcm_controller["init"]["arguments"]["estimation_weight_string"] = "'has_eg_1_units=building.residential_units>=1'"
        #hlcm_controller["init"]["arguments"]["capacity_string"] = "'has_eg_1_units=building.residential_units>=1'"
        hlcm_controller["init"]["arguments"]['sample_size_locations']=30
        hlcm_controller["init"]["arguments"]['sampler']="'opus_core.samplers.weighted_sampler'"
        #hlcm_controller["init"]["arguments"]["submodel_string"] = "'urbansim.household.income_category'"
        hlcm_controller["init"]["arguments"]["estimation_size_agents"] = None
        #hlcm_controller["init"]["arguments"]["number_of_units_string"] = None
        hlcm_controller["init"]["arguments"]["variable_package"] = "'urbansim_parcel'"
        hlcm_controller["init"]["arguments"]["run_config"] = "{'lottery_max_iterations': 7}"
        hlcm_controller["init"]["arguments"]["filter"] = "'numpy.logical_and(urbansim_parcel.building.is_residential, numpy.logical_and(numpy.logical_and(building.residential_units, building.sqft_per_unit), urbansim_parcel.building.unit_price > 0))'" 
        #hlcm_controller["init"]["arguments"]["filter"] = "'urbansim_parcel.building.is_residential'" 
#        hlcm_controller["init"]["arguments"]["filter"] = "'numpy.logical_and(numpy.logical_and(building.residential_units, building.sqft_per_unit), numpy.logical_and(urbansim_parcel.building.unit_price > %s, urbansim_parcel.building.unit_price< %s))'" % (UNIT_PRICE_RANGE[0], UNIT_PRICE_RANGE[1])
        #hlcm_controller["init"]["arguments"]["filter"] = "'numpy.logical_and(building.residential_units, building.sqft_per_unit)'"
        hlcm_controller["init"]["arguments"]["estimate_config"] = "{'wesml_sampling_correction_variable':'psrc_parcel.building.wesml_sampling_correction_variable'}"
        hlcm_controller["prepare_for_estimate"]["arguments"]["agents_for_estimation_table"] = "'households_for_estimation'"
        hlcm_controller["prepare_for_estimate"]["arguments"]["filter"] = "'numpy.logical_and(household.building_id>1, household.disaggregate(building.sqft_per_unit>0)) * household.move'" # filtering out agents for estimation with valid location
        #hlcm_controller["prepare_for_estimate"]["arguments"]["filter"] = "'household.move==1'" # filtering out agents for estimation with valid location
        hlcm_controller["run"]["arguments"]["chunk_specification"] ="{'records_per_chunk':50000}"
        hlcm_controller["prepare_for_estimate"]["arguments"]["join_datasets"] = True
        hlcm_controller["prepare_for_estimate"]["arguments"]["index_to_unplace"] = 'hrm_index'  #None
        # settng estimation procedure
        #hlcm_controller["estimate"]["arguments"]["procedure"] = "'bhhh_wesml_mnl_estimation'"
        hlcm_controller["estimate"]["arguments"]["procedure"] = "'bhhh_mnl_estimation'"
        
        models_configuration['household_location_choice_model']["controller"].replace(hlcm_controller)
                
        self["datasets_to_preload"] = {
                'zone':{},
                'household':{},
                'building':{},
                'parcel':{'package_name':'urbansim_parcel'},
                "building_type":{'package_name':'urbansim_parcel'},
                'travel_data':{}
                }
        models_configuration['governmental_employment_location_choice_model']['controller']['import'] =  {
           'urbansim_parcel.models.scaling_jobs_model': 'ScalingJobsModel'}
        models_configuration['distribute_unplaced_jobs_model']['controller']['import'] =  {
           'urbansim_parcel.models.distribute_unplaced_jobs_model': 'DistributeUnplacedJobsModel'}
        models_configuration['distribute_unplaced_mining_utilities_jobs_model']['controller']['import'] =  {
           'urbansim_parcel.models.distribute_unplaced_jobs_model': 'DistributeUnplacedJobsModel'}
        models_configuration['real_estate_price_model_for_all_parcels'] = Configuration(models_configuration['real_estate_price_model'])
        models_configuration['real_estate_price_model_for_all_parcels']['controller']['init']['arguments']['filter_attribute'] = None
コード例 #20
0
 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)
コード例 #21
0
 def __init__(self):
     config = AbstractUrbansimConfiguration()
     
     config_changes = {
         'project_name':'psrc',
         'description':'baseline with travel model',
         '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',
             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',
                 'constant_taz_columns'
                 ],
             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, 2030),
         }
     config.merge(config_changes)
     
     travel_model_config = create_travel_model_configuration('baseline_travel_model_psrc')
     config['travel_model_configuration'] = travel_model_config
     self.merge(config)
コード例 #22
0
ファイル: baseline.py プロジェクト: urban-ai/VIBe2UrbanSim
    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)
コード例 #23
0
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 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_baseyear_old_elcm_coeff')
config_changes = {
    'description':'baseline with skims using old coefficients',
    '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',
        tables_to_cache = [
            'annual_employment_control_totals',
            'annual_household_control_totals',
コード例 #24
0
 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)