next up previous index
Next: The Estimate Method Up: ChoiceModel Class Previous: Initialization   Index

The Run Method

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

Input:

specification
- an instance of class EquationSpecification specifying variables to be used in the simulation (see Section 24.6.1).
coefficients
- an instance of class Coefficients that contains values of coefficients to be used in the simulation (see Section 24.6.2).
agent_set
- an instance of class Dataset representing the whole set of agents to be used for the variable computation.
agents_index
- an index within the agent_set determining which agents enter the choice process. If it is not given (default), all agents are considered.
chunk_specification
- a dictionary specifying how to determine the number of chunks to run the model in. It is passed to the run method of ChunkModel (see Section 24.4.2). Default is None, which is equivalent to 1 chunk.
data_objects
- a dictionary containing additional datasets needed for computing variables. This argument is obsolete - the datasets should be included in the dataset_pool argument of the constructor.
run_config
- additional Resources for controlling the simulation run.

Algorithm
The algorithm is implemented in the method run_chunk() called from the parent class ChunkModel for each chunk. It overwrites the ChunkModel method get_agents_order() in a way that it returns a permutation of the agents indices. Thus, the agents make their choices in a random order.

The method creates an interaction set between the agent set and the choice set. It computes all variables given in the specification. Variables that are specific to one of the datasets are computed on all elements of that dataset, interaction variables are computed only on elements entering the choice process. The method then creates the corresponding data matrix using agents_index for selecting the appropriate data values. It runs one simulation per submodel (for submodels specified in the specification) by calling the run() method of the upc_sequence attribute (see 24.5.4) and passing the data matrix and the coefficients for the corresponding submodel.

If run_config contains the entry 'demand_string' having a character string value, an aggregated demand for each choice is computed and stored as an additional attribute (of that name) of the choice dataset.

Output
The method returns an array of size agents_index, representing the choices 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: ChoiceModel Class Previous: Initialization   Index
info (at) urbansim.org