next up previous index
Next: The Estimate Method Up: Location Choice Model Previous: Initialization   Index

The Run Method

The run() method runs the simulation of location choice model on basis of a given specification and coefficients.

Input:
It takes the same arguments as the run() method of its parent (see Section 22.4.3 for more details):
specification, coefficients, agent_set, agents_index, chunk_specification, data_objects, and run_config.

Algorithm:
The model is processed in chunks. The run_chunk() method moves the agents out of their locations, i.e. the values of an agent_set attribute of the same name as the unique identifier of location_set is set to $ -1$ for each agent of the currently processed chunk. If agent_set does not have this attribute, it is appended to it.

If an entry ``compute_capacity_flag'' is given in run_config and its value is True, an entry ``capacity_string'' is expected in run_config which gives the name of attribute/variable of location_set that determines capacity for each location. In such a case, after removing agents from their locations, the capacity is computed using method determine_units_capacity(). Note that by removing agents of only the current chunk from their locations, the capacity is influenced by only those agents. Each chunk then see the state of the world updated by all previously running chunks.

By default, the capacity values are used as weights of locations in the case of sampling. This can be changed by setting the entry 'weights_for_simulation_string' of run_config, which should be a fully-qualified variable name of the location set that determines weights. The weights are multiplied by the filter given in the initialization. The model then invokes sampling of alternatives by calling the run() method of the sampler class, passing the possibly filtered weights. The parent class then takes care of creating the interaction set, for agents of the corresponding chunk and possibly sampled alternatives and of running the upc_sequence.

The location IDs that agents chose in the choice process are stored in the agent_set attribute specifying locations.

Output:
The method returns an array of size agents_index, representing the location IDs that agents (elements of agent_set determined by agents_index) made. Agents whose choice is less equal zero were not included in the choice process, for example because they do not belong to any submodels given in the specification.


next up previous index
Next: The Estimate Method Up: Location Choice Model Previous: Initialization   Index
info (at) urbansim.org