next up previous index
Next: GeneralResources, SessionConfiguration, Configuration and Up: Other Classes Previous: Dataset Pool   Index


ModelGroup and ModelGroupMember

These two classes are designed to be used in models that are considered as model groups, i.e. models that are to be run multiple times, each time on different subsets of one dataset.

A model group is defined by the following:

Example: Suppose we would like to run a model on a 'job' dataset, subset according to its building type. Then our grouping dataset, say 'job_building_type', can contain the following data:

id	name
1	'commercial'
2	'industrial'
3	'residential'
The attribute 'name' is our grouping attribute, values of the 'id' attribute are member codes. The dataset 'job' contains an attribute, say 'building_type' that has value 1 for all commercial jobs, 2 for all industrial and 3 for all residential jobs. 'building_type' is then the agents grouping attribute.

The class ModelGroup is initialized by

dataset
- Object of class Dataset that is the grouping dataset.
grouping_attribute
- Name of the grouping attribute.
The class offers useful methods for accessing member names and codes of this group.

The class ModelGroupMember is initialized by

model_group
- An object of class ModelGroup.
member_name
- Name of this specific member. It must be contained in the grouping attribute of 'model_group'.
A model that uses this class should use the method set_agents_grouping_attribute(attribute) to set the agents grouping attribute. Then the class can be used for subsetting any dataset according to the member codes, e.g. by the method get_index_of_my_agents(dataset, index) which selects those entries from the given index that correspond to this group member.


next up previous index
Next: GeneralResources, SessionConfiguration, Configuration and Up: Other Classes Previous: Dataset Pool   Index
info (at) urbansim.org