ContentsIndexHome
PreviousUpNext
Data Views

Besides the default view on the data of a multidimensional identifier, corresponding to all tuple-value pairs associated with that identifier, you can also define alternative views which represent slices or subset domains of the identifier at hand.

By defining a filter on the data of an identifier, you can create a new view which potentially allows for much faster processing due to less data that needs to be examined / transferred.

Using a fixed element to filter

For example, to just view the data of the UnitTransportCost from 'London' to any other city you would create a filter, and restrict the first index to the value 'London':

IFilter filter = parameterUnitTransportCost.createFilter();
filter.restrict(0, "London");

Next you can open a new view based on this filter with the UnitTransportCost:

IDataView costLondon = parameterUnitTransportCost.openView(filter);

The resulting IDataView represents a slice of the original identifier, and its dimension is decreased by one. It can be used to assign or read values, just like any other view.

Iterators

Although you can also open an iterator on this view, it is also possible to directly create a filtered iterator on the identifier, i.e.

IFilter filter = parameterUnitTransportCost.createFilter();
filter.restrict(0, "London");
IIterator iterCostLondon = parameterUnitTransportCost.createIterator(filter);

Similarly to the filtered data view above, the dimension of the tuples returned by this iterator is decreased by one.

Using sets to filter

Instead of using a fixed element for a specific index it is also possible to restrict an index to the values of a specific subset (that exists in the AIMMS project):

ISetData largeCities = session.openSet("LargeCities");
IFilter filter = parameterUnitTransportCost.createFilter();
filter.restrict(0, largeCities);
IIterator iterCostLargeCities = parameterUnitTransportCost.createIterator(filter);

In contrast to the sliced examples above, the tuple dimension of this iterator is the same as the unfiltered iterator, but it will iterate over less tuples.