Exemplo n.º 1
0
    def __init__(self):
        Baseline.__init__(self)
        self['config_changes_for_estimation'] = ConfigChangesForEstimation()
        ## set base_year and years to 2006 for HLCM for the psrc_parcel project
        #self['config_changes_for_estimation']['household_location_choice_model'].merge({'base_year': 2006, 'years':(2006, 2006)})

        self['cache_directory'] = '/Users/hana/urbansim_cache/psrc/cache_source_parcel'
        self['estimation_database_configuration'] = EstimationDatabaseConfiguration(
                                                             database_name = 'psrc_2005_parcel_baseyear_change_estimation',
                                                             )
        self['dataset_pool_configuration'] = DatasetPoolConfiguration(
                                                                      package_order=['psrc_parcel', 'psrc', 'urbansim_parcel', 'urbansim', 'opus_core'],
                                                                      )
        self['datasets_to_cache_after_each_model'] = []
        self["datasets_to_preload"] = {
            'zone':{},
            'household':{},
            'building':{},
            'parcel':{'package_name':'urbansim_parcel'},
        #'development_template': {'package_name':'urbansim_parcel'},
        #'development_template_component': {'package_name':'urbansim_parcel'},
        #"job_building_type":{}
            'job':{},
            'person':{'package_name':'urbansim_parcel'},        
            "building_type":{'package_name':'urbansim_parcel'},
            'travel_data':{},
            }
        self['base_year'] = 2000
        self['years'] = (2000,2000)
        #self['low_memory_mode'] = True
        if 'models_in_year' in self.keys():
            del self['models_in_year']          
    def __my_configuration(self):
        tables_to_cache = [
#        'business',
        'households',
        'buildings',
        'parcels',
        'zones',
#        "households_for_estimation"
        ]
        
        return {
        'cache_directory' : r'/home/lmwang/work/sf/cache_source_0125', # change or leave out
        'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration(
    #        cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation',
            unroll_gridcells = False,
            cache_from_database = True,
            baseyear_cache = BaseyearCacheConfiguration(
                existing_cache_to_copy = r'/urbansim_cache/sanfrancisco/cache_source',
                ),
            cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
            tables_to_cache = tables_to_cache,
            tables_to_copy_to_previous_years = {},                                          
            ),
        'scenario_database_configuration': ScenarioDatabaseConfiguration(
            database_name = 'sanfrancisco_baseyear_start',
            ),
        'estimation_database_configuration': EstimationDatabaseConfiguration(
            database_name = 'sanfrancisco_baseyear_change_20080121',
            ),            
        'dataset_pool_configuration': DatasetPoolConfiguration(
            package_order=['sanfrancisco', 'urbansim', 'opus_core'],
            ),
        'base_year': 2001,
        }
Exemplo n.º 3
0
 def __init__(self):
     Baseline.__init__(self)
     self['config_changes_for_estimation'] = ConfigChangesForEstimation()
     self['cache_directory'] = os.path.join(os.environ['OPUS_HOME'], 'data/eugene_zone/base_year_data')
     self['scenario_database_configuration'] = ScenarioDatabaseConfiguration(database_name = 'eugene_1980_baseyear_zone')
     self['estimation_database_configuration'] = EstimationDatabaseConfiguration(database_name = 'eugene_1980_baseyear_zone')
 
     self['datasets_to_cache_after_each_model' ] = []
     self['low_memory_mode'] = False
     self['base_year'] = 1980
     self['years'] = (1980,1980)
     self['seed'] = 1
Exemplo n.º 4
0
 def _get_estimation_changes(self):
     return {
         'cache_directory':
         'C:/urbansim_cache/psrc/estimation',  # change or leave out
         'estimation_database_configuration':
         EstimationDatabaseConfiguration(
             database_name='GSPSRC_2000_baseyear_change_20070102', ),
         'dataset_pool_configuration':
         DatasetPoolConfiguration(
             package_order=['psrc', 'urbansim', 'opus_core'], ),
         'datasets_to_cache_after_each_model': [],
         'low_memory_mode':
         False,
         'base_year':
         2000,
         'years': (2000, 2000),
     }
 def __init__(self):
     BaselineHana.__init__(self)
     self['config_changes_for_estimation'] = ConfigChangesForEstimation()
     self[
         'cache_directory'] = '/Users/hana/urbansim_cache/psrc/parcel/relocation_models_estimation/cache_source_parcel'
     self[
         'estimation_database_configuration'] = EstimationDatabaseConfiguration(
             database_name='psrc_activity2006_ver2_hana_est', )
     self['dataset_pool_configuration'] = DatasetPoolConfiguration(
         package_order=[
             'psrc_parcel', 'psrc', 'urbansim_parcel', 'urbansim',
             'opus_core'
         ], )
     self['datasets_to_cache_after_each_model'] = []
     self['years'] = (2000, 2000)
     if 'models_in_year' in self.keys():
         del self['models_in_year']
Exemplo n.º 6
0
 def __init__(self):
     Baseline.__init__(self)
     self['config_changes_for_estimation'] = ConfigChangesForEstimation()
     
     self['cache_directory'] = '/Users/hana/urbansim_cache/eugene/eugene_1980_baseyear_cache'
     self['estimation_database_configuration'] = EstimationDatabaseConfiguration(
                                                          database_name = 'eugene_1980_baseyear_estimation_xxx',
                                                          )
 
     self['datasets_to_cache_after_each_model' ] = []
     self['low_memory_mode'] = False
     self['base_year'] = 1980
     self['years'] = (1980,1980)
     self['seed'] = 10
     self['models_configuration']['land_price_model']['controller'] = LandPriceModelConfigurationCreator(
                                    #estimation_procedure='opus_core.bma_for_linear_regression_r',
                                    #estimate_config={'bma_imageplot_filename': 'bma_image.pdf'}
                                                                                ).execute()
     self['models_configuration']['household_location_choice_model']['controller'] = HouseholdLocationChoiceModelConfigurationCreator(
                                 #estimation_procedure='opus_core.bhhh_mnl_estimation_with_diagnose',
                                                                                ).execute()
        persons = PersonDataset(in_storage=in_storage,
                                in_table_name=persons_table_name)
        persons.write_dataset(out_storage=out_storage,
                              out_table_name=persons_table_name)


if __name__ == '__main__':
    config = Baseline()
    config.replace(
        {
            'scenario_database_configuration':
            ScenarioDatabaseConfiguration(
                database_name='psrc_2005_parcel_baseyear', ),
            'estimation_database_configuration':
            EstimationDatabaseConfiguration(
                database_name='psrc_2005_parcel_baseyear_change_20080219', ),
            'dataset_pool_configuration':
            DatasetPoolConfiguration(
                package_order=['urbansim_parcel', 'urbansim', 'opus_core'], ),
            'low_memory_mode':
            False,
            'cache_directory':
            '/urbansim_cache/psrc_parcel/persons',
            'debuglevel':
            7,
            'base_year':
            2000,
            'years': (2000, 2000),
        }, )

    #    del config['estimation_database_configuration']['db_output_database']
            '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={},
    ),
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(
        database_name='PSRC_2000_scenario_E_constrained_king_county', ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name='PSRC_2000_scenario_E_constrained_king_county_output', ),
    'base_year':
    2000,
    'years': (2001, 2030),
}
run_configuration = config.copy()
run_configuration.merge(config_changes)

from psrc.configs.create_travel_model_configuration import create_travel_model_configuration
travel_model_configuration = create_travel_model_configuration(
    'baseline_travel_model_psrc')
run_configuration['travel_model_configuration'] = travel_model_configuration
    db_name = options.db_name
    attribute_cache_directory = options.attribute_cache_directory
    table_name = options.table_name
    cache_year = options.cache_year

    if (db_name is None or attribute_cache_directory is None
            or cache_year is None):

        parser.print_help()
        sys.exit(1)

    if table_name is None:
        table_name = 'ALL'

    dbserverconfig = EstimationDatabaseConfiguration(
        database_configuration=options.database_configuration)
    opusdb = OpusDatabase(dbserverconfig, db_name)

    input_storage = sql_storage(storage_location=opusdb)

    attribute_cache = AttributeCache(cache_directory=attribute_cache_directory)
    output_storage = attribute_cache.get_flt_storage_for_year(cache_year)
    SimulationState().set_current_time(cache_year)
    SessionConfiguration(new_instance=True,
                         package_order=[],
                         in_storage=AttributeCache())

    if table_name == 'ALL':
        logger.log_status('Caching all tables in database...')
        lst = input_storage.get_table_names()
        for i in lst:
Exemplo n.º 10
0
    def __my_configuration(self):
#        tables_to_cache = Baseline()['creating_baseyear_cache_configuration'].tables_to_cache
        tables_to_cache =[            
            #'development_event_history',
            'edges',
            'parcels',
            'gridcells',
            'households',
            'households_for_estimation',
            'jobs',
            'travel_data',
            'persons', #need to cache
            'persons_for_estimation',
            'zones',
            'cities',
            'buildings',
            'building_types',
            'urbansim_constants',
            'job_building_types',
            'tours',
            #'land_price_model_coefficients',
            #'land_price_model_specification',]
         ]
        return {
        'cache_directory' : 'C:/tmp/urbansim_cache/psrc_parcel', # change or leave out
        'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration(
    #        cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation',
            unroll_gridcells = False,
            cache_from_database = True,
            baseyear_cache = BaseyearCacheConfiguration(
                existing_cache_to_copy = r'D:/urbansim_cache/full_psrc',
                ),
            cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
            tables_to_cache = tables_to_cache,
            tables_to_cache_nchunks = {
                'parcels':8,
                'gridcells':5,
                'buildings':10,
                },
#            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_activity2006_ver2" # 2006 PSRC Activity Survey for households_for_estimation,
            ),
        'estimation_database_configuration':EstimationDatabaseConfiguration(
            database_name = 'PSRC_2000_parcels_estimation_output',
            ),
        'dataset_pool_configuration': DatasetPoolConfiguration(
            package_order=['psrc', 'urbansim', 'opus_core'],
            ),
        'base_year': 2000,
        'years': (2000,2000),
        'datasets_to_preload' :{
            'gridcell':{
                'package_name':'urbansim',
                'nchunks':2,
                },
            'parcel':{
                'package_name':'psrc',
                'nchunks':3,
                },                                 
            'household':{
                'package_name':'urbansim',
                },
            'person':{
                'package_name':'psrc',
                },
            'zone':{
                'package_name':'urbansim',
                },
            'travel_data':{
                'package_name':'urbansim',
                },
            'building':{
                'package_name':'urbansim',
                },                
    #        'edge':{
    #            'package_name':'transit_accessibility',    
    #            } 
            },
        'seed':1,#(1,1)        
        }
Exemplo n.º 11
0
# Opus/UrbanSim urban simulation software.
# 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.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration

my_configuration = {
    'cache_directory':
    '/urbansim_cache/vibe_min',  # change or leave out
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(database_name='urbansim_export_test', ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name='eugene_1980_baseyear_estimation', ),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    'base_year':
    1980,
    'years': (1980, 1980),
    'seed':
    10,  #(10,10)
}
    )

    (options, args) = parser.parse_args()

    cache_path = options.cache_path
    database_name = options.database_name
    if database_name is None or cache_path is None:
        parser.print_help()
        sys.exit(1)

    table_name = options.table_name

    logger.log_status('Initializing database...')
    db_server = DatabaseServer(
        EstimationDatabaseConfiguration(
            database_name=database_name,
            database_configuration=options.database_configuration))
    if not db_server.has_database(
            database_name):  # if only one table should be exported,
        db_server.create_database(database_name)  # the database can exist

    db = db_server.get_database(database_name)

    input_storage = flt_storage(storage_location=cache_path)

    output_storage = sql_storage(storage_location=db)

    logger.start_block('Exporting cache to sql...')
    try:
        if table_name is None:
            ExportStorage().export(in_storage=input_storage,
Exemplo n.º 13
0
import os
from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration
from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration

my_configuration = {
    'cache_directory':
    r'e:/urbansim_cache/sanfrancisco/cache_source',  ### TODO: Set this cache_directory to something useful.
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(database_name="sanfrancisco_baseyear", ),
    'dataset_pool_configuration':
    DatasetPoolConfiguration(
        package_order=['sanfrancisco', 'urbansim', 'opus_core'], ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name="sanfrancisco_baseyear_change_20080125", ),
    'dataset_pool_configuration':
    DatasetPoolConfiguration(
        package_order=['sanfrancisco', 'urbansim', 'opus_core'], ),
    'datasets_to_cache_after_each_model': [],
    'base_year':
    2001,
    'years': (2001, 2001),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    "datasets_to_preload": {
        'zone': {},
        'household': {},
        'building': {},
        'parcel': {
Exemplo n.º 14
0
# Opus/UrbanSim urban simulation software.
# 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.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration

my_configuration = {
    'cache_directory':
    None,  ### TODO: Set this cache_directory to something useful.
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(
        database_name='randstad_021105_estimation', ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name='randstad_estimation_output', ),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    'cache_directory':
    '/tmp/urbansim_cache/randstad',  # change or leave out
    'base_year':
    1995,
    'years': (1995, 1995),
}
Exemplo n.º 15
0
import os

from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration
from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration

from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration

from urbansim.configs.hlcm_estimation_config import run_configuration as config
from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration

my_configuration_general = {
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(database_name='washtenaw_class', ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name='washtenaw_estimation_output', ),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    'cache_directory':
    '/urbansim_cache/workshop/washtenaw_estimation',  # change or leave out
    'creating_baseyear_cache_configuration':
    CreatingBaseyearCacheConfiguration(
        cache_scenario_database=
        'urbansim.model_coordinators.cache_scenario_database',
        unroll_gridcells=True,
        cache_from_database=False,
        baseyear_cache=BaseyearCacheConfiguration(
            existing_cache_to_copy='/urbansim_cache/workshop/cache_source',
            #years_to_cache = range(1996,2001),
        ),
Exemplo n.º 16
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.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration
from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration

my_configuration = {
    'scenario_database_configuration':ScenarioDatabaseConfiguration(
        database_name = 'PSRC_2000_parcels', # change
        ),
    'estimation_database_configuration':EstimationDatabaseConfiguration(
        database_name = 'PSRC_2000_parcels_estimation_output',
        ),  
    'datasets_to_cache_after_each_model':[],
    'low_memory_mode':False,
    'cache_directory':r'C:\tmp\urbansim_cache\psrc_parcel', # change or leave out
    'base_year': 2006,
    'years': (2006,2006),
    'datasets_to_preload' :{
        'gridcell':{
            'package_name':'urbansim',
            'nchunks':2,
            },
        'parcel':{
            'package_name':'psrc',
            'nchunks':3,
            },                                 
Exemplo n.º 17
0
from urbansim.configs.estimation_base_config import run_configuration as config
from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration

from opus_core.database_management.database_server import DatabaseServer

db_config = ScenarioDatabaseConfiguration()
db_server = DatabaseServer(db_config)
db = db_server.get_database('PSRC_2000_baseyear')

psrc_config = {
    'in_storage':
    StorageFactory().get_storage(type='sql_storage', storage_location=db),
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(database_name='PSRC_2000_baseyear'),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name='PSRC_2000_estimation_output'),
    'cache_directory':
    '/tmp/urbansim_cache/psrc_gridcell',
    'creating_baseyear_cache_configuration':
    CreatingBaseyearCacheConfiguration(
        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',
Exemplo n.º 18
0
import os

from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration
from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration

from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration

my_configuration = {
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(
        database_name="semcog_baseyear",  #change
    ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name="semcog_baseyear_estimation", ),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    'cache_directory':
    '/urbansim_cache/semcog/cache_source',  # change or leave out
    'creating_baseyear_cache_configuration':
    CreatingBaseyearCacheConfiguration(
        unroll_gridcells=True,
        cache_from_database=False,
        baseyear_cache=BaseyearCacheConfiguration(
            existing_cache_to_copy='/urbansim_cache/semcog/cache_source',
            #years_to_cache  = range(1996,2001)
        ),
        tables_to_cache=[],
        tables_to_cache_nchunks={'gridcells': 1},
Exemplo n.º 19
0
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE

import os

from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration

my_configuration = {
    'cache_directory':
    'C:/urbansim_cache/psrc/estimation',  # change or leave out
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(
        database_name='GSPSRC_2000_baseyear_change_20070102', ),
    'dataset_pool_configuration':
    DatasetPoolConfiguration(package_order=['psrc', 'urbansim',
                                            'opus_core'], ),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    'base_year':
    2000,
    'years': (2000, 2000),
}
Exemplo n.º 20
0
from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration
from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration
from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration
from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration
from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration

my_configuration = {
    'cache_directory':
    r'/aalborg1/lmwang/urbansim_cache/paris/',  ### TODO: Set this cache_directory to something useful.
    'scenario_database_configuration':
    ScenarioDatabaseConfiguration(database_name="paris_estimation", ),
    'dataset_pool_configuration':
    DatasetPoolConfiguration(package_order=['paris', 'urbansim',
                                            'opus_core'], ),
    'estimation_database_configuration':
    EstimationDatabaseConfiguration(database_name="", ),
    'datasets_to_cache_after_each_model': [],
    'base_year':
    2000,
    'years': (2000, 2000),
    'datasets_to_cache_after_each_model': [],
    'low_memory_mode':
    False,
    "datasets_to_preload": {
        #        'zone':{},
        'household': {},
        'neighborhood': {},
        'job': {},
    }
}