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

Copy Markdown View Source

A policy that scans the object in a square spiral and nothing else.

Mirrors tbp/monty/frameworks/models/motor_policies.py::NaiveScanPolicy, the simplest thing that collects a view worth matching: look up, turn left, look down, turn right, each by the same fixed amount, with each leg one step longer than the last on alternating sides:

1x up, 1x left, 2x down, 2x right, 3x up, 3x left, ...

Monty draws the picture: |_ _ _| round and round, outward. What makes it worth having is that nothing in it is learned: every action is fixed at construction, so it is the policy an experiment uses to ask what the sensor sees rather than what a policy decides.

It is an InformedPolicy in Monty, but it overrides the step completely: the percept, the state, the observations and the goal are all ignored. The constructor still takes an action sampler, as Monty's does, and never draws from it — the actions it makes are the four it was built with.

Summary

Functions

The next action of the spiral, and nothing else.

Moves to the next leg of the spiral once the current one is long enough.

A spiral scanner for :agent_id, turning :fixed_amount degrees a leg.

Starts the next episode at the first leg, with legs one step long.

Nothing to report: the spiral is fixed at construction.

Types

t()

@type t() :: %Monty.Frameworks.Models.MotorPolicies.NaiveScanPolicy{
  action_sampler: Monty.Frameworks.Actions.ActionSamplers.ActionSampler.t(),
  agent_id: atom() | String.t(),
  current_action_id: non_neg_integer(),
  fixed_amount: float(),
  step_on_action: non_neg_integer(),
  steps_per_action: pos_integer()
}

Functions

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

The next action of the spiral, and nothing else.

motor_only_step stays false: every one of these actions is something the learning modules want to see, which is the whole point of scanning.

check_cycle_action(policy)

@spec check_cycle_action(t()) :: t()

Moves to the next leg of the spiral once the current one is long enough.

Monty's check_cycle_action. After the second and the fourth leg of each circuit the leg gets one step longer, so the square grows by one on every side.

new(options)

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

A spiral scanner for :agent_id, turning :fixed_amount degrees a leg.

The action sampler is required because Monty's constructor takes one — it is never asked for anything.

reset(policy)

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

Starts the next episode at the first leg, with legs one step long.

state_dict(naive_scan_policy)

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

Nothing to report: the spiral is fixed at construction.