Monty.Frameworks.Models.MotorPolicies.BasePolicy (ExTbpMonty.Core v0.1.0)

Copy Markdown View Source

A policy that takes one sampled action, whatever the step looked like.

Mirrors tbp/monty/frameworks/models/motor_policies.py::BasePolicy, the bottom of the policy hierarchy: it ignores the observations, the state, the percept and the goal, and asks its sampler for an action. What it is for is the experiments that only need the body to wander — and being the parent that every other policy is built on.

The sampler is a Monty.Frameworks.Actions.ActionSamplers struct, as Monty's is, and the random stream it draws from lives on the policy: nil until the first draw, then whatever that draw left behind. Monty reads the stream from the runtime context and mutates it there; a struct cannot be mutated here, so the policy owns it and ActionSampler.stream/3 starts it from the context (docs/monty-differences.md §2.5).

Summary

Functions

One sampled action, and nothing else.

A policy that takes whatever :action_sampler chooses for :agent_id.

Forgets the stream, so the next step draws from the episode again.

Nothing to report.

Types

t()

@type t() :: %Monty.Frameworks.Models.MotorPolicies.BasePolicy{
  action_sampler: Monty.Frameworks.Actions.ActionSamplers.ActionSampler.t(),
  agent_id: atom() | String.t(),
  rng: :rand.state() | nil
}

Functions

call(policy, ctx, observations, state, percept, goal)

One sampled action, and nothing else.

motor_only_step stays false: a single sample is a real move, and the learning modules have something to look at afterwards.

new(options)

@spec new(keyword()) :: t()

A policy that takes whatever :action_sampler chooses for :agent_id.

reset(policy)

@spec reset(t()) :: t()

Forgets the stream, so the next step draws from the episode again.

Monty's reset is a no-op because its stream belongs to the context rather than to the policy.

state_dict(base_policy)

@spec state_dict(t()) :: map()

Nothing to report.