def __init__(self,
              maximum_runs=3,
              input_index='erm_index',
              *args,
              **kwargs):
     HomeBasedEmploymentLocationChoiceModelConfigurationCreator.__init__(
         self,
         maximum_runs=maximum_runs,
         input_index=input_index,
         *args,
         **kwargs)
 def execute(self):
     conf = HomeBasedEmploymentLocationChoiceModelConfigurationCreator.execute(self)
     conf["import"] = {
         "washtenaw.models.regional_employment_location_choice_model": "RegionalEmploymentLocationChoiceModel"
     }
     conf["init"]["name"] = "RegionalEmploymentLocationChoiceModel"
     return conf
 def execute(self):
     conf = HomeBasedEmploymentLocationChoiceModelConfigurationCreator.execute(
         self)
     conf['import'] = {
         'washtenaw.models.regional_employment_location_choice_model':
         'RegionalEmploymentLocationChoiceModel'
     }
     conf['init']['name'] = 'RegionalEmploymentLocationChoiceModel'
     return conf
 def __init__(self, maximum_runs=3, input_index="erm_index", *args, **kwargs):
     HomeBasedEmploymentLocationChoiceModelConfigurationCreator.__init__(
         self, maximum_runs=maximum_runs, input_index=input_index, *args, **kwargs
     )
    def _get_initial_config(self):
        """Encapsulate dirty inner workings"""
        debuglevel = 4

        config = {
            'models_configuration': {
                'development_project_types': DevelopmentProjectTypesConfigurationCreator(
                    commercial = DevelopmentProjectTypeConfigurationCreator(
                        categories = [1000, 2000, 5000, 10000],
                        #categories = [],
                        developable_maximum_unit_variable_full_name = 'urbansim.gridcell.developable_maximum_commercial_sqft',
                        developable_minimum_unit_variable_full_name = 'urbansim.gridcell.developable_minimum_commercial_sqft',
                        residential = False,
                        units = 'commercial_sqft',
                        ),
                    industrial = DevelopmentProjectTypeConfigurationCreator(
                        categories = [1000,2000,5000,10000],
                        #categories = [],
                        developable_maximum_unit_variable_full_name = 'urbansim.gridcell.developable_maximum_industrial_sqft',
                        developable_minimum_unit_variable_full_name = 'urbansim.gridcell.developable_minimum_industrial_sqft',
                        residential = False,
                        units = 'industrial_sqft',
                        ),
                    residential = DevelopmentProjectTypeConfigurationCreator(
                        categories = [1,2,3,5,10,20],
                        #categories = [],
                        developable_maximum_unit_variable_full_name = 'urbansim.gridcell.developable_maximum_residential_units',
                        developable_minimum_unit_variable_full_name = 'urbansim.gridcell.developable_minimum_residential_units',
                        residential = True,
                        units = 'residential_units',
                        )
                    ).execute(),
                'residential_development_project_location_choice_model':{
                    'controller': DevelopmentProjectLocationChoiceModelConfigurationCreator(
                        project_type = 'residential',
                        coefficients_table = 'residential_development_location_choice_model_coefficients',
                        specification_table = 'residential_development_location_choice_model_specification',
                        #submodel_string = None
                        ).execute(),
                    },
                'commercial_development_project_location_choice_model':{
                    'controller': DevelopmentProjectLocationChoiceModelConfigurationCreator(
                        project_type = 'commercial',
                        coefficients_table = 'commercial_development_location_choice_model_coefficients',
                        specification_table = 'commercial_development_location_choice_model_specification',
                        #submodel_string = None
                        ).execute(),
                    },
                'industrial_development_project_location_choice_model':{
                    'controller': DevelopmentProjectLocationChoiceModelConfigurationCreator(
                        project_type = 'industrial',
                        coefficients_table = 'industrial_development_location_choice_model_coefficients',
                        specification_table = 'industrial_development_location_choice_model_specification',
                        #submodel_string = None
                        ).execute(),
                    },
                'prescheduled_events': {
                    'controller': PrescheduledEventsConfigurationCreator(
                        output_events = 'development_events',
                        ).execute(),
                    },
                'events_coordinator': {
                    'controller': EventsCoordinatorConfigurationCreator(
                        input_events = 'development_events',
                        output_changed_indices = 'changed_indices',
                        ).execute(),
                    'default_type_of_change':DevelopmentEventTypeOfChange.ADD,
                    },
                'home_based_choice_model': {
                    'controller': HomeBasedChoiceModelConfigurationCreator().execute(),
                    },
                'auto_ownership_choice_model': {
                    'controller': AutoOwnershipChoiceModelConfigurationCreator().execute(),
                    },
                'residential_land_share_model': {
                    'controller': ResidentialLandShareModelConfigurationCreator(
                        debuglevel = debuglevel,
                        input_changed_indices = 'changed_indices',
                        ).execute(),
                    },
                'land_price_model': {
                    'controller': LandPriceModelConfigurationCreator(
                        debuglevel = debuglevel,
                        ).execute(),
                    },
                'development_project_transition_model': {
                    'controller': DevelopmentProjectTransitionModelConfigurationCreator(
                        debuglevel = debuglevel,
                        output_results = 'dptm_results',
                        ).execute(),
                    },
                'development_event_transition_model': {
                    'controller': DevelopmentEventTransitionModelConfigurationCreator(
                        input_projects = 'dptm_results',
                        output_events = 'development_events',
                        ).execute(),
                    },
                'household_transition_model': {
                    'controller': HouseholdTransitionModelConfigurationCreator().execute(),
                    },
                'employment_transition_model': {
                    'controller': EmploymentTransitionModelConfigurationCreator().execute(),
                    },
                'household_relocation_model': {
                    'controller': HouseholdRelocationModelConfigurationCreator(
                        output_index = 'hrm_index',
                        ).execute(),
                    },
                'household_location_choice_model': {
                    'controller': HouseholdLocationChoiceModelConfigurationCreator(
                        input_index = 'hrm_index',
                        ).execute(),
                    },
                'employment_relocation_model': {
                    'controller': EmploymentRelocationModelConfigurationCreator(
                        output_index = 'erm_index',
                        ).execute(),
                    },
                'employment_location_choice_model': {
                    'controller': EmploymentLocationChoiceModelConfigurationCreator(
                        input_index = 'erm_index',
                        ).execute(),
                    },
                # These are deviations from the general ELCM for the two home_based ELCMs (sfh, mfh)
                'home_based_employment_location_choice_model': {
                    'controller': HomeBasedEmploymentLocationChoiceModelConfigurationCreator(
                        input_index = 'erm_index',
                        ).execute(),
                    },
                'governmental_employment_location_choice_model': {
                    'controller': GovernmentalEmploymentLocationChoiceModelConfigurationCreator(
                        input_index = 'erm_index',
                        ).execute(),
                    },
                'distribute_unplaced_jobs_model': {
                    'controller': DistributeUnplacedJobsModelConfigurationCreator().execute(),
                    },
                'real_estate_price_model': {
                    'controller': RealEstatePriceModelConfigurationCreator().execute(),
                    },
                'building_transition_model': {
                    'controller': BuildingTransitionModelConfigurationCreator().execute(),
                    },
                'building_relocation_model': {
                    'controller': BuildingRelocationModelConfigurationCreator(
                        output_index = 'brm_index',
                        ).execute(),
                    },
                'building_location_choice_model': {
                    'controller': BuildingLocationChoiceModelConfigurationCreator(
                        input_index = 'brm_index',
                        ).execute(),
                    },
                },
            'model_system':'urbansim.model_coordinators.model_system',
            'models':[ # models are executed in the same order as in this list
                "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"
                ],
            'years':(2001, 2030),
            'debuglevel':debuglevel,
            'flush_variables':False,
            'seed':None,#(0,0),
            'chunk_specification':{ # Default value
                'nchunks':1,
                },
            'datasets_to_cache_after_each_model':[ # datasets to be cached after each model,
                'gridcell',
                'household',
                'job'],
            'datasets_to_preload': { # Datasets that should be loaded before each year, e.g. in order to pass them as model arguments.
                'gridcell':{         # All remaining datasets are used via SessionConfiguration
                    'nchunks':2
                    },               # linked to the cache.
                'household':{
                    },
                'job':{
                    },
                'zone':{
                    },
                'development_type':{},
                'target_vacancy':{},
                'development_event_history':{},
                'development_constraint':{},
                'job_building_type':{},
                #                'building_type':{},
                #                'building':{},
                'vacant_land_and_building_type':{},
                'urbansim_constant':{},
                },
            'dataset_pool_configuration': DatasetPoolConfiguration(
                package_order=['urbansim', 'opus_core'],
                ),
            'services_database_configuration':ServicesDatabaseConfiguration(),
            }

        return config