next up previous index
Next: Implementing a Child Class Up: ChunkModel Class Previous: ChunkModel Class   Index

The Run Method

Input:
chunk_specification
- a dictionary specifying how to determine the number of chunks to run the model in. It must contain either the key 'records_per_chunk' or the key 'nchunks'. The method passes it to the constructor of ChunkSpecification (see Section 24.7.3). None translates to 1 chunk.
dataset
- an object of class Dataset along whose elements the model will be chunked.
dataset_index
- an index of elements within dataset that are to be chunked. Default is None which means that all elements of dataset are considered.
result_array_type
- a type of the resulting array. It can be any numerical type of numpy array. The default value is float32.
...
- optional additional arguments that are passed to the method run_chunk(). They are expected to be keyword arguments.

Algorithm
For each chunk (determined by the chunk_specification) the model calls the method run_chunk() and passes as arguments the corresponding portion of dataset_index, the whole dataset and all additional arguments. By default the order of elements in dataset_index is preserved. This can be changed by redefining the method get_agents_order() (see below).

Output
The class returns an array of the same size as dataset_index and of type result_array_type (passed to the method as input). Values of this array are return values of the (possibly) multiple calls of the method run_chunk(). The $ i$ -th value in this array is a result for the dataset_index[$ i$ ]-th element of dataset.


next up previous index
Next: Implementing a Child Class Up: ChunkModel Class Previous: ChunkModel Class   Index
info (at) urbansim.org