gflownet.envs.setbox

This environment is a conditional set of cubes and grids. The set is flexible in that in can consist of a variable number of cubes and grids. The number of grids and cubes for each trajectory can be regarded as the conditions of the set and in this environment these conditions are sampled by an auxiliary 2D grid environment, where each dimension will indicate the number of cubes and grids, respectively. Therefore, the overall environment is a Stack of a Grid and a Set of Cubes and Grids.

This environment was originally designed for debugging the conditional mode of the Set environment.

Attributes

IDX_CUBE

IDX_GRID

Classes

SetBox

Initializes the SetBox environment.

Module Contents

gflownet.envs.setbox.IDX_CUBE = 0[source]
gflownet.envs.setbox.IDX_GRID = 1[source]
class gflownet.envs.setbox.SetBox(max_elements_per_subenv=3, n_dim=2, cube_kwargs=None, grid_kwargs=None, **kwargs)[source]

Bases: gflownet.envs.composite.stack.Stack

Initializes the SetBox environment.

Parameters:
  • max_elements_per_subenv (int) – The maximum number of elements of each kind in the Set. The total maximum number of elements in the set will thus be 2 * max_elements_per_subenv.

  • n_dim (int) – The dimensionality of the Cubes and Grids in the Set.

  • cube_kwargs (Optional[Dict])

  • grid_kwargs (Optional[Dict])

max_elements_per_subenv = 3[source]
n_dim = 2[source]
cube_kwargs[source]
grid_kwargs[source]
idx_conditioning_grid = 0[source]
idx_set = 1[source]
property conditioning_grid: gflownet.envs.grid.Grid[source]

Returns the sub-environment corresponding to the Grid that is the first sub-environment in the Stack, which is used to sample the conditions of the Set.

Returns:

Grid

Return type:

gflownet.envs.grid.Grid

property set: gflownet.envs.composite.setflex.SetFlex[source]

Returns the sub-environment corresponding to the set of cubes and grids.

Returns:

SetFlex

Return type:

gflownet.envs.composite.setflex.SetFlex

property cube: gflownet.envs.cube.ContinuousCube[source]

Returns the ContinuousCube environment that is used as unique environment to define the Cubes in the Set.

The Cube is the unique environment in the first (0) dimension of subenvs_unique in the Set.

Returns:

ContinuousCube

Return type:

gflownet.envs.cube.ContinuousCube

property grid: gflownet.envs.grid.Grid[source]

Returns the Grid environment that is used as unique environment to define the Grids in the Set.

The Grid is the unique environment in the second (1) dimension of subenvs_unique in the Set.

Returns:

Grid

Return type:

gflownet.envs.grid.Grid

states2proxy(states)[source]

Prepares a batch of states in “environment format” for a proxy.

The proxy representation is the average of the proxy representation across all the cubes and grids in the set.

Parameters:

states (list) – A batch of states in environment format.

Returns:

A tensor containing all the states in the batch in the proxy representation.

Return type:

torchtyping.TensorType[batch, state_oracle_dim]