gflownet.envs.composite.setfix
Classes implementing the family of Set meta-environments, which allow to combine multiple sub-environments without any specific order.
Classes
Module Contents
- class gflownet.envs.composite.setfix.SetFix(subenvs, **kwargs)[source]
Bases:
gflownet.envs.composite.setbase.BaseSet- Parameters:
subenvs (iterable) – An iterable containing the set of the sub-environments.
- states2policy(states)[source]
Prepares a batch of states in environment format for the policy model.
The default policy representation is the concatenation of the following elements: - One-hot encoding of the active sub-environment - Toggle flag - Done flag of each sub-environment - A concatenation of the policy-format states of the sub-environments
- Parameters:
states (list) – A batch of states in environment format.
- Returns:
A tensor containing all the states in the batch.
- Return type:
torchtyping.TensorType[batch, state_policy_dim]
- states2proxy(states)[source]
Prepares a batch of states in environment format for a proxy.
The default proxy format is similar to the environment format, except that the states of the sub-enviroments in the dictionary are converted into their corresponding proxy formats.
- Parameters:
states (list) – A batch of states in environment format.
- Returns:
A tensor containing all the states in the batch.
- Return type:
torchtyping.TensorType[batch, state_oracle_dim]
- state2readable(state=None)[source]
Converts a state into human-readable representation.
It concatenates the readable representations of each sub-environment, separated by “; “ and preceded by Set meta-data: active sub-environment and toggle flag. If a sub-environment is done, it is indicanted with “ | done” after the state.
- Parameters:
state (list) – A state in environment format.
- Returns:
str – The state in readable format.
- Return type:
str