pub struct SignalingGame { /* private fields */ }Expand description
2-agent referential signaling game over a fixed vocabulary.
See the module docs for the full description and the comms layout table.
Implementations§
Source§impl SignalingGame
impl SignalingGame
Sourcepub const NUM_AGENTS: usize = 2
pub const NUM_AGENTS: usize = 2
Number of agents (always 2: speaker + listener).
Sourcepub fn new(vocab: usize) -> Self
pub fn new(vocab: usize) -> Self
Construct a signaling game over a vocab-token vocabulary with hidden
token 0.
§Panics
Panics if vocab == 0 — a signaling game needs at least one token.
Construct a signaling game with an explicit hidden token (for tests / deterministic rollouts).
§Panics
Panics if vocab == 0 or hidden is outside 0..vocab.
The hidden token the speaker must transmit this episode.
Sourcepub fn received(&self) -> i64
pub fn received(&self) -> i64
The message token the listener received on the most recent step, or -1
if no step has occurred since the last reset.
Set the hidden token (0..vocab) and clear the received message.
§Panics
Panics if hidden is outside 0..vocab.
Trait Implementations§
Source§impl Clone for SignalingGame
impl Clone for SignalingGame
Source§fn clone(&self) -> SignalingGame
fn clone(&self) -> SignalingGame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CommunicatingEnvironment for SignalingGame
impl CommunicatingEnvironment for SignalingGame
Source§fn message_vocab(&self, agent_id: usize) -> Vec<usize>
fn message_vocab(&self, agent_id: usize) -> Vec<usize>
MultiAgentEnvironment::agent_action_space. These dims are appended
after the task action dims in each agent’s action vector. An empty vec
means the agent sends nothing.Source§fn message_obs_size(&self, agent_id: usize) -> usize
fn message_obs_size(&self, agent_id: usize) -> usize
get_agent_observation / step_multi (see place_message).Source§impl Debug for SignalingGame
impl Debug for SignalingGame
Source§impl Default for SignalingGame
impl Default for SignalingGame
Source§impl Environment for SignalingGame
impl Environment for SignalingGame
Source§type State = (i64, i64)
type State = (i64, i64)
Full snapshot: the env consumes no RNG, so restoring reproduces every subsequent step exactly.
Source§fn get_observation(&self) -> Vec<f32>
fn get_observation(&self) -> Vec<f32>
Single-agent surface returns the speaker’s observation. Multi-agent
consumers should use MultiAgentEnvironment::get_agent_observation.
Source§fn step(&mut self, action: i64) -> StepResult
fn step(&mut self, action: i64) -> StepResult
Degenerate single-agent step: interpret action as the speaker’s
emitted message and broadcast it. Multi-agent consumers should use
MultiAgentEnvironment::step_multi.
Source§fn observation_space(&self) -> SpaceInfo
fn observation_space(&self) -> SpaceInfo
Source§fn action_space(&self) -> SpaceInfo
fn action_space(&self) -> SpaceInfo
Source§impl JointEnv for SignalingGame
Thin adapter so the joint PPO trainer can drive the signaling game
directly (issue #275, Phase 2). reset_joint / step_joint delegate to
the existing MultiAgentEnvironment surface — all message routing is
already handled inside SignalingGame::step_multi, so no extra plumbing
lives here.
impl JointEnv for SignalingGame
Thin adapter so the joint PPO trainer can drive the signaling game
directly (issue #275, Phase 2). reset_joint / step_joint delegate to
the existing MultiAgentEnvironment surface — all message routing is
already handled inside SignalingGame::step_multi, so no extra plumbing
lives here.
Source§fn reset_joint(&mut self, _seed: Option<u64>) -> Vec<Vec<f32>>
fn reset_joint(&mut self, _seed: Option<u64>) -> Vec<Vec<f32>>
Source§fn step_joint(&mut self, actions: &[Vec<i64>]) -> JointStepResult
fn step_joint(&mut self, actions: &[Vec<i64>]) -> JointStepResult
Source§impl MultiAgentEnvironment for SignalingGame
impl MultiAgentEnvironment for SignalingGame
Source§fn num_agents(&self) -> usize
fn num_agents(&self) -> usize
Source§fn get_agent_observation(&self, agent_id: usize) -> Vec<f32>
fn get_agent_observation(&self, agent_id: usize) -> Vec<f32>
Source§fn agent_action_space(&self, agent_id: usize) -> Vec<usize>
fn agent_action_space(&self, agent_id: usize) -> Vec<usize>
Source§fn step_multi(&mut self, actions: &[Vec<i64>]) -> MultiAgentResult
fn step_multi(&mut self, actions: &[Vec<i64>]) -> MultiAgentResult
Source§fn active_agents(&self) -> Vec<bool>
fn active_agents(&self) -> Vec<bool>
Auto Trait Implementations§
impl Freeze for SignalingGame
impl RefUnwindSafe for SignalingGame
impl Send for SignalingGame
impl Sync for SignalingGame
impl Unpin for SignalingGame
impl UnsafeUnpin for SignalingGame
impl UnwindSafe for SignalingGame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more