# Tiles¶

class mushroom_rl.features.tiles.tiles.Tiles(x_range, n_tiles, state_components=None)[source]

Bases: object

Class implementing rectangular tiling. For each point in the state space, this class can be used to compute the index of the corresponding tile.

__init__(x_range, n_tiles, state_components=None)[source]

Constructor.

Parameters: x_range (list) – list of two-elements lists specifying the range of each state variable; n_tiles (list) – list of the number of tiles to be used for each dimension. state_components (list, None) – list of the dimensions of the input to be considered by the tiling. The number of elements must match the number of elements in x_range and n_tiles.
__call__(x)[source]

Call self as a function.

static generate(n_tilings, n_tiles, low, high, uniform=False)[source]

Factory method to build n_tilings tilings of n_tiles tiles with a range between low and high for each dimension.

Parameters: n_tilings (int) – number of tilings; n_tiles (list) – number of tiles for each tilings for each dimension; low (np.ndarray) – lowest value for each dimension; high (np.ndarray) – highest value for each dimension. uniform (bool, False) – if True the displacement for each tiling will be w/n_tilings, where w is the tile width. Otherwise, the displacement will be k*w/n_tilings, where k=2i+1, where i is the dimension index. The list of the generated tiles.