Reward API Reference
IsingRewardModule
Bases: BaseRewardModule[IsingEnvState, IsingEnvParams]
Source code in gfnx/reward/ising.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
log_reward(state, env_params)
Compute log reward for Ising model states.
Args: - state: IsingEnvState with state field of shape [B, dim] containing values in {0, 1} - env_params: Environment parameters containing reward_params with alpha and J
Returns: - Log reward tensor of shape [B] for each state in the batch
The Ising model energy is computed as
E = -alpha * sum_{i,j} J_{ij} * s_i * s_j
where s_i are the spin values in {-1, 1} (transformed from {0, 1} input).
The log reward is simply -E, so higher energy states have lower reward.
Source code in gfnx/reward/ising.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |