pub fn split_action(action: &[i64], task_len: usize) -> (&[i64], &[i64])Expand description
Split a flat action vector into its (task, message) halves at task_len.
The action layout is [ ...task dims... , ...message dims... ], so the
first task_len entries are the task action and the remainder are the
message tokens. This factors the Bucket-Brigade-style slicing so every
CommunicatingEnvironment shares one implementation.
Boundary behavior:
task_len == 0→ task slice is empty, message slice is the whole action.task_len == action.len()→ task slice is the whole action, message slice is empty (an agent with no message dims).
§Panics
Panics if task_len > action.len() — that indicates a mismatch between the
env’s declared agent_action_space and the action vector it was handed.
§Examples
use thrust_rl::multi_agent::comms::split_action;
// Bucket-Brigade-style [house, mode, signal] with a 1-dim message tail.
let action = [7, 1, 0];
let (task, message) = split_action(&action, 2);
assert_eq!(task, &[7, 1]);
assert_eq!(message, &[0]);