Example #1
0
 def execute(self):
     # Names of intermediate objects used to get data between steps
     # in this model process.
     _resources = 'hrm_resources'
     
     return Configuration({
         'import': {
             'urbansim.models.%s_creator' % self._model_name: 'HouseholdRelocationModelCreator'
             },
         'init': {
             'arguments': {'debuglevel': self.debuglevel,
                           'location_id_name': "'%s'" % self.location_id_name,
                           'probabilities': get_string_or_None(self.probabilities),
                             },
             'name': 'HouseholdRelocationModelCreator().get_model'
             },
         'prepare_for_run': {
             'arguments': {
                 'rate_storage': 'base_cache_storage',
                 'rate_table': get_string_or_None(self.rate_table),
                 'rate_dataset_name': get_string_or_None(self.rate_dataset_name),
                 },
             'name': 'prepare_for_run',
             'output': _resources,
             },
         'run': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'resources': _resources,
                 },
             'output': self.output_index,
             }
         })
Example #2
0
    def execute(self):
        # Names of intermediate objects used to get data between steps
        # in this model process.
        _resources = 'hrm_resources'

        return Configuration({
            'import': {
                'urbansim.models.%s_creator' % self._model_name:
                'HouseholdRelocationModelCreator'
            },
            'init': {
                'arguments': {
                    'debuglevel': self.debuglevel,
                    'location_id_name': "'%s'" % self.location_id_name,
                    'probabilities': get_string_or_None(self.probabilities),
                },
                'name': 'HouseholdRelocationModelCreator().get_model'
            },
            'prepare_for_run': {
                'arguments': {
                    'rate_storage': 'base_cache_storage',
                    'rate_table': get_string_or_None(self.rate_table),
                    'what': "'%s'" % self.what,
                },
                'name': 'prepare_for_run',
                'output': _resources,
            },
            'run': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'resources': _resources,
                },
                'output': self.output_index,
            }
        })
Example #3
0
 def execute(self):        
     return Configuration({
         'import': {
             self.module_name: self.class_name
             },
         'init': {
             'arguments': {'debuglevel': self.debuglevel,
                           'filter': get_string_or_None(self.filter),
                           'dataset_pool': 'dataset_pool'},
             'name': 'DistributeUnplacedJobsModel'
             },
         'run': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'data_objects': 'datasets',
                 'location_set': self.location_set,
                 'agents_filter': get_string_or_None(self.agents_filter),
                 }
             }
         })
 def execute(self):
     return Configuration({
         'import': {
             self.module_name: self.class_name
         },
         'init': {
             'arguments': {
                 'debuglevel': self.debuglevel,
                 'filter': get_string_or_None(self.filter),
                 'dataset_pool': 'dataset_pool'
             },
             'name': 'DistributeUnplacedJobsModel'
         },
         'run': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'data_objects': 'datasets',
                 'location_set': self.location_set,
                 'agents_filter': get_string_or_None(self.agents_filter),
             }
         }
     })
    def execute(self):
        # Names of intermediate objects used to get data between steps
        # in this model process.
        _coefficients = "coefficients"
        _specification = "specification"
        _projects = "projects"

        return Configuration(
            {
                "estimate": {
                    "arguments": {
                        "agent_set": _projects,
                        "data_objects": "datasets",
                        "debuglevel": self.debuglevel,
                        "specification": _specification,
                    },
                    "output": "(%s, _)" % _coefficients,
                },
                "import": {
                    "urbansim.models.development_project_location_choice_model_creator": "DevelopmentProjectLocationChoiceModelCreator"
                },
                "init": {
                    "arguments": {
                        "location_set": self.location_set,
                        "model_configuration": "model_configuration['development_project_types']['%s']"
                        % self.project_type,
                        "project_type": "'%s'" % self.project_type,
                        "submodel_string": get_string_or_None(self.submodel_string),
                    },
                    "name": "DevelopmentProjectLocationChoiceModelCreator().get_model",
                },
                "prepare_for_estimate": {
                    "arguments": {
                        "base_year": "resources['base_year']",
                        "categories": "model_configuration['development_project_types']['%s']['categories']"
                        % self.project_type,
                        "events_for_estimation_storage": "base_cache_storage",
                        "events_for_estimation_table": "'%s'" % self.events_for_estimation_table,
                        "specification_storage": "base_cache_storage",
                        "specification_table": "'%s'" % self.specification_table,
                        "urbansim_constant": "urbansim_constant",
                    },
                    "name": "prepare_for_estimate",
                    "output": "(%s, %s)" % (_specification, _projects),
                },
                "prepare_for_run": {
                    "arguments": {
                        "coefficients_storage": "base_cache_storage",
                        "coefficients_table": "'%s'" % self.coefficients_table,
                        "specification_storage": "base_cache_storage",
                        "specification_table": "'%s'" % self.specification_table,
                    },
                    "name": "prepare_for_run",
                    "output": "(%s, %s)" % (_specification, _coefficients),
                },
                "run": {
                    "arguments": {
                        "agent_set": self.input_agent_set,
                        "chunk_specification": "{'records_per_chunk':%s}" % self.records_per_chunk,
                        "coefficients": _coefficients,
                        "data_objects": "datasets",
                        "debuglevel": self.debuglevel,
                        "specification": _specification,
                    }
                },
            }
        )
Example #6
0
 def execute(self):
     # Names of intermediate objects used to get data between steps
     # in this model process.
     _coefficients = 'coefficients'
     _specification = 'specification'
     _index = 'repm_index'
     
     return Configuration({
         'estimate': {
             'arguments': {
                 'data_objects': 'datasets',
                 'dataset': self.dataset,
                 'outcome_attribute': "'%s'" % self.outcome_attribute,
                 'debuglevel': self.debuglevel,
                 'index': _index,
                 'specification': _specification,
                 },
             'output': '(%s, _)' % _coefficients
             },
         'import': {
             'urbansim.models.%s' % self._model_name: 'RealEstatePriceModel'
             },
         'init': {
             'arguments': {
                 'dataset_pool': 'dataset_pool',
                 'debuglevel': self.debuglevel,
                 'filter_attribute': None,
                 'outcome_attribute': "'%s'" % self.outcome_attribute,
                 'submodel_string': get_string_or_None(self.submodel_string)
                 },
             'name': 'RealEstatePriceModel'
             },
         'prepare_for_estimate': {
             'arguments': {
                 'dataset': self.dataset,
                 'filter_variable': get_string_or_None(self.filter_variable),
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 },
             'name': 'prepare_for_estimate',
             'output': '(%s, %s)' % (_specification, _index)
             },
         'prepare_for_run': {
             'arguments': {
                 'coefficients_storage': 'base_cache_storage',
                 'coefficients_table': "'%s'" % self.coefficients_table, 
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 },
             'name': 'prepare_for_run',
             'output': '(%s, %s)' % (_specification, _coefficients)
             },
         'run': {
             'arguments': {
                 'chunk_specification': "{'nchunks':%s}" % self.nchunks,
                 'coefficients': _coefficients,
                 'data_objects': 'datasets',
                 'dataset': self.dataset,
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 }
             }
         })
Example #7
0
    def execute(self):
        # Names of intermediate objects used to get data between steps
        # in this model process.
        _coefficients = 'coefficients'
        _specification = 'specification'
        _projects = 'projects'

        return Configuration({
            'estimate': {
                'arguments': {
                    'agent_set': _projects,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification
                },
                'output': '(%s, _)' % _coefficients
            },
            'import': {
                'urbansim.models.development_project_location_choice_model_creator':
                'DevelopmentProjectLocationChoiceModelCreator'
            },
            'init': {
                'arguments': {
                    'location_set':
                    self.location_set,
                    'model_configuration':
                    "model_configuration['development_project_types']['%s']" %
                    self.project_type,
                    'project_type':
                    "'%s'" % self.project_type,
                    'submodel_string':
                    get_string_or_None(self.submodel_string),
                },
                'name':
                'DevelopmentProjectLocationChoiceModelCreator().get_model'
            },
            'prepare_for_estimate': {
                'arguments': {
                    'base_year':
                    "resources['base_year']",
                    'categories':
                    "model_configuration['development_project_types']['%s']['categories']"
                    % self.project_type,
                    'events_for_estimation_storage':
                    'base_cache_storage',
                    'events_for_estimation_table':
                    "'%s'" % self.events_for_estimation_table,
                    'specification_storage':
                    'base_cache_storage',
                    'specification_table':
                    "'%s'" % self.specification_table,
                    'urbansim_constant':
                    'urbansim_constant'
                },
                'name': 'prepare_for_estimate',
                'output': '(%s, %s)' % (_specification, _projects)
            },
            'prepare_for_run': {
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'%s'" % self.coefficients_table,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_run',
                'output': '(%s, %s)' % (_specification, _coefficients)
            },
            'run': {
                'arguments': {
                    'agent_set': self.input_agent_set,
                    'chunk_specification':
                    "{'records_per_chunk':%s}" % self.records_per_chunk,
                    'coefficients': _coefficients,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification
                }
            }
        })
Example #8
0
    def execute(self):
        _coefficients = 'coefficients'
        _specification = 'specification'
        _index = 'index'

        return Configuration({
            'estimate': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_index': _index,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                },
                'output': '(%s, _)' % _coefficients
            },
            'import': {
                'urbansim.models.%s' % self._model_name:
                'HouseholdLocationChoiceModel'
            },
            'init': {
                'arguments': {
                    'sampler':
                    get_string_or_None(self.sampler),
                    'choices':
                    "'%s'" % self.choices,
                    'estimation':
                    "'%s'" % self.estimation_procedure,
                    'dataset_pool':
                    'dataset_pool',
                    'location_set':
                    self.location_set,
                    'sample_size_locations':
                    self.sample_size_locations,
                    'capacity_string':
                    get_string_or_None(self.capacity_string),
                    'estimation_weight_string':
                    get_string_or_None(self.estimation_weight_string),
                    'simulation_weight_string':
                    get_string_or_None(self.simulation_weight_string),
                    'number_of_units_string':
                    get_string_or_None(self.number_of_units_string),
                    'number_of_agents_string':
                    get_string_or_None(self.number_of_agents_string),
                    'location_id_string':
                    get_string_or_None(self.location_id_name),
                    'submodel_string':
                    get_string_or_None(self.submodel_string),
                    'estimation_size_agents':
                    self.estimation_size_agents,
                    'filter':
                    get_string_or_None(self.location_filter),
                    'run_config':
                    self.run_config,
                    'estimate_config':
                    self.estimate_config,
                    "variable_package":
                    "'%s'" % self.variable_package
                },
                'name': 'HouseholdLocationChoiceModel'
            },
            'prepare_for_estimate': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_for_estimation_storage': 'base_cache_storage',
                    'agents_for_estimation_table':
                    "'%s'" % self.agents_for_estimation_table_name,
                    'data_objects': 'datasets',
                    'index_to_unplace': self.index_to_unplace,
                    'join_datasets':
                    '%s' % self.join_agents_for_estimation_with_all_agents,
                    'portion_to_unplace': self.portion_to_unplace,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                    'filter':
                    get_string_or_None(self.agent_filter_for_estimation)
                },
                'name': 'prepare_for_estimate',
                'output': '(%s, %s)' % (_specification, _index)
            },
            'prepare_for_run': {
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'%s'" % self.coefficients_table,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_run',
                'output': '(%s, %s)' % (_specification, _coefficients)
            },
            'run': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_index': self.input_index,
                    'chunk_specification': self.chunk_specification,
                    'coefficients': _coefficients,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                    'maximum_runs': self.maximum_runs
                }
            }
        })
 def execute(self):
     # Names of intermediate objects used to get data between steps
     # in this model process.
     _coefficients = 'coefficients'
     _specification = 'specification'
     _projects = 'projects'
     
     return Configuration({
         'estimate': {
             'arguments': {
                 'agent_set': _projects,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification
                 },
             'output': '(%s, _)' % _coefficients
             },
         'import': {
             'urbansim_zone.models.development_project_location_choice_model': 'DevelopmentProjectLocationChoiceModel'
             },
         'init': {
             'arguments': {
                 'location_set': self.location_set,
                 'project_type': "'%s'" % self.project_type,
                 'sampler': get_string_or_None(self.sampler),
                 'submodel_string': get_string_or_None(self.submodel_string),
                 'capacity_string': get_string_or_None(self.capacity_string),
                 },
             'name': 'DevelopmentProjectLocationChoiceModel'
             },
         'prepare_for_estimate': {
             'arguments': {
                 'base_year': 'base_year',
                 'events_for_estimation_storage': 'base_cache_storage',
                 'events_for_estimation_table': "'%s'" % self.events_for_estimation_table,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 'urbansim_constant': 'urbansim_constant',
                 'units': "'%s'" % self.units
                 },
             'name': 'prepare_for_estimate',
             'output': '(%s, %s)' % (_specification, _projects)
             },
         'prepare_for_run': {
             'arguments': {
                 'coefficients_storage': 'base_cache_storage',
                 'coefficients_table': "'%s'" % self.coefficients_table,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table, 
                 },
             'name': 'prepare_for_run',
             'output': '(%s, %s)' % (_specification, _coefficients)
             },
         'run': {
             'arguments': {
                 'agent_set': self.input_agent_set,
                 'chunk_specification': "{'records_per_chunk':%s}" % self.records_per_chunk,
                 'coefficients': _coefficients,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification
                 }
             }
         })
Example #10
0
 def execute(self):
     _coefficients = 'coefficients'
     _specification = 'specification'
     _index = 'index'
     
     return Configuration({
         'estimate': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_index': _index,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 },
             'output': '(%s, _)' % _coefficients
             },
         'import': {
             #'urbansim.models.%s' % self._model_name: 'HouseholdLocationChoiceModelWithPriceAdj'
             self._model_name: 'HouseholdLocationChoiceModelWithPriceAdj'  #model module in current directory
             },
         'init': {
             'arguments': {
                 'sampler': get_string_or_None(self.sampler),
                 'choices': "'%s'" % self.choices,
                 'estimation': "'%s'" % self.estimation_procedure,                    
                 'dataset_pool': 'dataset_pool',
                 'location_set': self.location_set,
                 'sample_size_locations': self.sample_size_locations,
                 'capacity_string': get_string_or_None(self.capacity_string),
                 'demand_string': get_string_or_None(self.demand_string),
                 'number_of_units_string': get_string_or_None(self.number_of_units_string),
                 'number_of_agents_string': get_string_or_None(self.number_of_agents_string),
                 'run_config': {'lottery_max_iterations': self.lottery_max_iterations}
                 },
             'name': 'HouseholdLocationChoiceModelWithPriceAdj'
             },
         'prepare_for_estimate': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_for_estimation_storage': 'base_cache_storage',
                 'agents_for_estimation_table': "'%s'" % self.agents_for_estimation_table_name,
                 'data_objects': 'datasets',
                 'index_to_unplace': self.input_index,
                 'join_datasets': 'True',
                 'portion_to_unplace': self.portion_to_unplace,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 },
             'name': 'prepare_for_estimate',
             'output': '(%s, %s)' % (_specification, _index)
             },
         'prepare_for_run': {
             'arguments': {
                 'coefficients_storage': 'base_cache_storage',
                 'coefficients_table': "'%s'" % self.coefficients_table,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 },
             'name': 'prepare_for_run',
             'output': '(%s, %s)' % (_specification, _coefficients)
             },
         'run': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_index': self.input_index,
                 'chunk_specification': "{'nchunks':%s}" % self.nchunks,
                 'coefficients': _coefficients,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 'maximum_runs': self.maximum_runs
                 }
             }
         })
Example #11
0
 def execute(self):
     # Names of intermediate objects used to get data between steps
     # in this model process.
     _coefficients = 'coefficients'
     _specification = 'specification'
     _index = 'index'
             
     try:
         attribute_to_group_by_dataset_name, attribute_to_group_by_attribute_name = self.attribute_to_group_by.split('.')
     except:
         raise Exception("Attribute to group by must be of the form "
             "'dataset_name.attribute_name', where dataset_name is the name "
             "of the dataset containing the attribute to group by "
             "(attribute_name). Received '%s'." % self.attribute_to_group_by)
     
     return Configuration({
         'estimate': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_index': _index,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 },
             'output': '(%s, _)' % _coefficients
             },
         'group_by_attribute': (attribute_to_group_by_dataset_name, attribute_to_group_by_attribute_name),
         'import': {
             'urbansim.models.%s' % self._model_name: 'EmploymentLocationChoiceModel'
             },
         'init': {
             'arguments': {
                 'sampler': get_string_or_None(self.sampler),
                 'choices': "'%s'" % self.choices,
                 'estimation': "'%s'" % self.estimation_procedure,
                 'dataset_pool': 'dataset_pool',
                 'location_set': self.location_set,
                 'sample_size_locations': self.sample_size_locations,
                 'capacity_string': get_string_or_None(self.capacity_string),
                 'estimation_weight_string': get_string_or_None(self.estimation_weight_string),
                 'simulation_weight_string': get_string_or_None(self.simulation_weight_string),
                 'filter': get_string_or_None(self.filter),
                 'estimation_size_agents': self.estimation_size_agents,
                 'compute_capacity_flag': self.compute_capacity_flag,
                 'number_of_units_string': get_string_or_None(self.number_of_units_string), 
                 'run_config': {'agent_units_string': get_string_or_None(self.agent_units_string),
                                'lottery_max_iterations': self.lottery_max_iterations},
                 'variable_package': "'%s'" % self.variable_package
                 },
             'name': 'EmploymentLocationChoiceModel'
             },
         'prepare_for_estimate': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_for_estimation_storage': 'base_cache_storage',
                 'agents_for_estimation_table': get_string_or_None(self.agents_for_estimation_table),
                 'join_datasets':self.join_datasets,
                 'data_objects': 'datasets',
                 'portion_to_unplace': self.portion_to_unplace,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 'filter': get_string_or_None(self.filter_for_estimation),
                 },
             'name': 'prepare_for_estimate',
             'output': '(%s, %s)' % (_specification, _index)
             },
         'prepare_for_run': {
             'arguments': {
                 'coefficients_storage': 'base_cache_storage',
                 'coefficients_table': "'%s'" % self.coefficients_table, 
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 },
             'name': 'prepare_for_run',
             'output': '(%s, %s)' % (_specification, _coefficients)
             },
         'run': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_index': self.input_index,
                 'chunk_specification': "{'records_per_chunk':%s}" % self.records_per_chunk,
                 'coefficients': _coefficients,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 'maximum_runs': self.maximum_runs
                 }
             }
         })
Example #12
0
 def execute(self):
     _coefficients = 'coefficients'
     _specification = 'specification'
     _index = 'index'
     
     return Configuration({
         'estimate': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_index': _index,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 },
             'output': '(%s, _)' % _coefficients
             },
         'import': {
             'urbansim.models.%s' % self._model_name: 'HouseholdLocationChoiceModel'
             },
         'init': {
             'arguments': {
                 'sampler': get_string_or_None(self.sampler),
                 'choices': "'%s'" % self.choices,
                 'estimation': "'%s'" % self.estimation_procedure,
                 'dataset_pool': 'dataset_pool',
                 'location_set': self.location_set,
                 'sample_size_locations': self.sample_size_locations,
                 'capacity_string': get_string_or_None(self.capacity_string),
                 'estimation_weight_string': get_string_or_None(self.estimation_weight_string),
                 'simulation_weight_string': get_string_or_None(self.simulation_weight_string),
                 'number_of_units_string': get_string_or_None(self.number_of_units_string),
                 'number_of_agents_string': get_string_or_None(self.number_of_agents_string),
                 'location_id_string': get_string_or_None(self.location_id_name),
                 'submodel_string': get_string_or_None(self.submodel_string),
                 'estimation_size_agents': self.estimation_size_agents,
                 'filter': get_string_or_None(self.location_filter),
                 'run_config': self.run_config,
                 'estimate_config': self.estimate_config,
                 "variable_package": "'%s'" % self.variable_package
                 },
             'name': 'HouseholdLocationChoiceModel'
             },
         'prepare_for_estimate': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_for_estimation_storage': 'base_cache_storage',
                 'agents_for_estimation_table': "'%s'" % self.agents_for_estimation_table_name,
                 'data_objects': 'datasets',
                 'index_to_unplace': self.index_to_unplace,
                 'join_datasets': '%s' % self.join_agents_for_estimation_with_all_agents,
                 'portion_to_unplace': self.portion_to_unplace,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 'filter': get_string_or_None(self.agent_filter_for_estimation)
                 },
             'name': 'prepare_for_estimate',
             'output': '(%s, %s)' % (_specification, _index)
             },
         'prepare_for_run': {
             'arguments': {
                 'coefficients_storage': 'base_cache_storage',
                 'coefficients_table': "'%s'" % self.coefficients_table,
                 'specification_storage': 'base_cache_storage',
                 'specification_table': "'%s'" % self.specification_table,
                 },
             'name': 'prepare_for_run',
             'output': '(%s, %s)' % (_specification, _coefficients)
             },
         'run': {
             'arguments': {
                 'agent_set': self.agent_set,
                 'agents_index': self.input_index,
                 'chunk_specification': self.chunk_specification,
                 'coefficients': _coefficients,
                 'data_objects': 'datasets',
                 'debuglevel': self.debuglevel,
                 'specification': _specification,
                 'maximum_runs': self.maximum_runs
                 }
             }
         })
Example #13
0
    def execute(self):
        # Names of intermediate objects used to get data between steps
        # in this model process.
        _coefficients = 'coefficients'
        _specification = 'specification'
        _index = 'repm_index'

        return Configuration({
            'estimate': {
                'arguments': {
                    'data_objects': 'datasets',
                    'dataset': self.dataset,
                    'outcome_attribute': "'%s'" % self.outcome_attribute,
                    'debuglevel': self.debuglevel,
                    'index': _index,
                    'specification': _specification,
                },
                'output': '(%s, _)' % _coefficients
            },
            'import': {
                'urbansim.models.%s' % self._model_name: 'RealEstatePriceModel'
            },
            'init': {
                'arguments': {
                    'dataset_pool': 'dataset_pool',
                    'debuglevel': self.debuglevel,
                    'filter_attribute': None,
                    'outcome_attribute': "'%s'" % self.outcome_attribute,
                    'submodel_string': get_string_or_None(self.submodel_string)
                },
                'name': 'RealEstatePriceModel'
            },
            'prepare_for_estimate': {
                'arguments': {
                    'dataset': self.dataset,
                    'filter_variable':
                    get_string_or_None(self.filter_variable),
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_estimate',
                'output': '(%s, %s)' % (_specification, _index)
            },
            'prepare_for_run': {
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'%s'" % self.coefficients_table,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_run',
                'output': '(%s, %s)' % (_specification, _coefficients)
            },
            'run': {
                'arguments': {
                    'chunk_specification': "{'nchunks':%s}" % self.nchunks,
                    'coefficients': _coefficients,
                    'data_objects': 'datasets',
                    'dataset': self.dataset,
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                }
            }
        })
    def execute(self):
        _coefficients = 'coefficients'
        _specification = 'specification'
        _index = 'index'

        return Configuration({
            'estimate': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_index': _index,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                },
                'output': '(%s, _)' % _coefficients
            },
            'import': {
                #'urbansim.models.%s' % self._model_name: 'HouseholdLocationChoiceModelWithPriceAdj'
                self._model_name:
                'HouseholdLocationChoiceModelWithPriceAdj'  #model module in current directory
            },
            'init': {
                'arguments': {
                    'sampler':
                    get_string_or_None(self.sampler),
                    'choices':
                    "'%s'" % self.choices,
                    'estimation':
                    "'%s'" % self.estimation_procedure,
                    'dataset_pool':
                    'dataset_pool',
                    'location_set':
                    self.location_set,
                    'sample_size_locations':
                    self.sample_size_locations,
                    'capacity_string':
                    get_string_or_None(self.capacity_string),
                    'demand_string':
                    get_string_or_None(self.demand_string),
                    'number_of_units_string':
                    get_string_or_None(self.number_of_units_string),
                    'number_of_agents_string':
                    get_string_or_None(self.number_of_agents_string),
                    'run_config': {
                        'lottery_max_iterations': self.lottery_max_iterations
                    }
                },
                'name': 'HouseholdLocationChoiceModelWithPriceAdj'
            },
            'prepare_for_estimate': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_for_estimation_storage': 'base_cache_storage',
                    'agents_for_estimation_table':
                    "'%s'" % self.agents_for_estimation_table_name,
                    'data_objects': 'datasets',
                    'index_to_unplace': self.input_index,
                    'join_datasets': 'True',
                    'portion_to_unplace': self.portion_to_unplace,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_estimate',
                'output': '(%s, %s)' % (_specification, _index)
            },
            'prepare_for_run': {
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'%s'" % self.coefficients_table,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_run',
                'output': '(%s, %s)' % (_specification, _coefficients)
            },
            'run': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_index': self.input_index,
                    'chunk_specification': "{'nchunks':%s}" % self.nchunks,
                    'coefficients': _coefficients,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                    'maximum_runs': self.maximum_runs
                }
            }
        })
Example #15
0
    def execute(self):
        # Names of intermediate objects used to get data between steps
        # in this model process.
        _coefficients = 'coefficients'
        _specification = 'specification'
        _index = 'index'

        try:
            attribute_to_group_by_dataset_name, attribute_to_group_by_attribute_name = self.attribute_to_group_by.split(
                '.')
        except:
            raise Exception(
                "Attribute to group by must be of the form "
                "'dataset_name.attribute_name', where dataset_name is the name "
                "of the dataset containing the attribute to group by "
                "(attribute_name). Received '%s'." %
                self.attribute_to_group_by)

        return Configuration({
            'estimate': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_index': _index,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                },
                'output': '(%s, _)' % _coefficients
            },
            'group_by_attribute': (attribute_to_group_by_dataset_name,
                                   attribute_to_group_by_attribute_name),
            'import': {
                'urbansim.models.%s' % self._model_name:
                'EmploymentLocationChoiceModel'
            },
            'init': {
                'arguments': {
                    'sampler':
                    get_string_or_None(self.sampler),
                    'choices':
                    "'%s'" % self.choices,
                    'estimation':
                    "'%s'" % self.estimation_procedure,
                    'dataset_pool':
                    'dataset_pool',
                    'location_set':
                    self.location_set,
                    'sample_size_locations':
                    self.sample_size_locations,
                    'capacity_string':
                    get_string_or_None(self.capacity_string),
                    'estimation_weight_string':
                    get_string_or_None(self.estimation_weight_string),
                    'simulation_weight_string':
                    get_string_or_None(self.simulation_weight_string),
                    'filter':
                    get_string_or_None(self.filter),
                    'estimation_size_agents':
                    self.estimation_size_agents,
                    'compute_capacity_flag':
                    self.compute_capacity_flag,
                    'number_of_units_string':
                    get_string_or_None(self.number_of_units_string),
                    'run_config': {
                        'agent_units_string':
                        get_string_or_None(self.agent_units_string),
                        'lottery_max_iterations':
                        self.lottery_max_iterations
                    },
                    'variable_package':
                    "'%s'" % self.variable_package
                },
                'name': 'EmploymentLocationChoiceModel'
            },
            'prepare_for_estimate': {
                'arguments': {
                    'agent_set':
                    self.agent_set,
                    'agents_for_estimation_storage':
                    'base_cache_storage',
                    'agents_for_estimation_table':
                    get_string_or_None(self.agents_for_estimation_table),
                    'join_datasets':
                    self.join_datasets,
                    'data_objects':
                    'datasets',
                    'portion_to_unplace':
                    self.portion_to_unplace,
                    'specification_storage':
                    'base_cache_storage',
                    'specification_table':
                    "'%s'" % self.specification_table,
                    'filter':
                    get_string_or_None(self.filter_for_estimation),
                },
                'name': 'prepare_for_estimate',
                'output': '(%s, %s)' % (_specification, _index)
            },
            'prepare_for_run': {
                'arguments': {
                    'coefficients_storage': 'base_cache_storage',
                    'coefficients_table': "'%s'" % self.coefficients_table,
                    'specification_storage': 'base_cache_storage',
                    'specification_table': "'%s'" % self.specification_table,
                },
                'name': 'prepare_for_run',
                'output': '(%s, %s)' % (_specification, _coefficients)
            },
            'run': {
                'arguments': {
                    'agent_set': self.agent_set,
                    'agents_index': self.input_index,
                    'chunk_specification':
                    "{'records_per_chunk':%s}" % self.records_per_chunk,
                    'coefficients': _coefficients,
                    'data_objects': 'datasets',
                    'debuglevel': self.debuglevel,
                    'specification': _specification,
                    'maximum_runs': self.maximum_runs
                }
            }
        })