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

Copy Markdown View Source

A policy that teleports the agent to a goal, and takes it back if that lands somewhere useless.

Mirrors tbp/monty/frameworks/models/motor_policies.py::JumpToGoal, the policy a distant agent's selector reaches for when a learning module has a hypothesis worth testing. A jump is two actions — SetAgentPose at the goal's location facing along the goal's direction, and an identity SetSensorRotation so the sensors keep the orientation the jump was planned in — and it always remembers the two actions that would put the agent back where it started.

It is meant to be called twice: once to jump, and once to judge where the jump landed. Landing on the object is the end of it, and the selector moves on to the next policy; landing anywhere else — empty space, or inside something — answers with the undo actions instead. The judgement reads the percept (on_object), not the depth, which is where it differs from InformedPolicy's version of the same idea.

With no jump in flight and no goal it raises NoGoalProvided, because a selector that routes a goal to this policy has already decided there is one; a run configured to suppress runtime errors gets a warning and no action instead.

:sensor_id is stored and never read, as in Monty, whose docstring says it is for a depth-at-centre calculation this policy no longer does.

Summary

Functions

A jump, or a verdict on the last one.

A jump policy for :agent_id, judging with :sensor_id.

Starts the next episode with no jump in flight.

The jump in flight, as plain values.

Types

t()

@type t() :: %Monty.Frameworks.Models.MotorPolicies.JumpToGoal{
  agent_id: atom() | String.t(),
  is_jumping: boolean(),
  is_undoing_jump: boolean(),
  pre_jump_state: Monty.Frameworks.Models.MotorSystemState.AgentState.t() | nil,
  sensor_id: atom() | String.t(),
  undo_action: Monty.Frameworks.Actions.Action.t() | nil,
  undo_jump_actions: [Monty.Frameworks.Actions.Action.t()]
}

Functions

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

A jump, or a verdict on the last one.

A jump in flight is judged first: an undo answers with the actions that put the agent back, and a landing on the object leaves the step free to start the next jump — or, with no goal, to ask for nothing at all.

new(options)

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

A jump policy for :agent_id, judging with :sensor_id.

:sensor_id is kept for the sake of the constructor Monty has, and unused.

reset(policy)

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

Starts the next episode with no jump in flight.

state_dict(policy)

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

The jump in flight, as plain values.

Monty's memento, written with one name and read with another — see docs/monty-differences.md §1.6. There is no load path here, so this is what a run records and not something a policy is restored from.