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.
coefficients
- an instance of class Coefficients that contains values of coefficients to be used in the simulation.
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, all agents are considered.
chunk_specification
- a dictionary specifying how to determine the number of chunks to run the model in (see Section 4.2.3).
data_objects
- a dictionary containing other datasets and arguments needed for computing variables.
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 7.6.4) and passing the data matrix and the coefficients for the corresponding submodel.

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