langgoap.ScalarHeuristic

langgoap.ScalarHeuristic#

class ScalarHeuristic(*args, **kwargs)[source]#

Continuous state-value function consumed by MCTS rollouts.

Maps (state, goal) onto [-1.0, +1.0] where higher values indicate states closer to satisfaction. +1.0 is reserved for fully satisfied states (set automatically by _shape_reward() when state.satisfies(goal.conditions)), so implementations should return strictly less than +1.0 for non-terminal states.

Used instead of the default goal-condition-count reward when supplied to MCTSStrategy or a rollout policy; gives UCB1 a continuous gradient on GOAP problems whose binary condition reward would otherwise collapse to a single value. Not required to be admissible (that’s an A* property); better-is-higher is the only contract.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)