Skip to main content

pi_iw

Function pi_iw 

Source
pub fn pi_iw<P, F>(problem: &P, policy: F, seed: u64) -> SearchResult<P::Action>
where P: WidthProblem, F: FnMut(&P::State, &[(P::Action, P::State)], &mut Vec<f64>),
Expand description

π-IW (Junyent, Jonsson & Gómez, ICAPS 2019): rollout_iw with rollouts guided by a policy.

When a node is expanded, policy gets its state and all of its (action, successor) pairs, and pushes one weight per successor into the (empty) output vector, for example the action probabilities of a learned policy. A rollout then moves to an unsolved child with probability proportional to its weight. Children of weight 0 are picked, uniformly at random, only once every unsolved sibling has weight 0, so π-IW explores the same tree as rollout_iw in a different order and still reaches every goal of width 1. Constant weights give uniform choices.

The paper also learns the policy from the planner’s choices; that loop is left to the caller. seed fixes the random choices.

§Panics

Panics if policy pushes a different number of weights than there are successors, a weight that is negative or not finite, or weights whose sum is not finite.