sparse_goal_reward

Function sparse_goal_reward 

Source
pub fn sparse_goal_reward(
    achieved: &[f32],
    desired: &[f32],
    tolerance: f32,
) -> f32
Expand description

Compute sparse goal-conditioned reward.

Returns 0.0 if ||achieved - desired||_2 < tolerance, else -1.0.

Uses squared distance comparison to avoid a costly sqrt.