pub struct EnvironmentSpec { /* private fields */ }Expand description
Complete single-agent environment schema shared by native and adapter paths.
Implementations§
Source§impl EnvironmentSpec
impl EnvironmentSpec
Sourcepub fn new(
observation: EnvironmentSpace,
action: EnvironmentSpace,
reward: EnvironmentSpace,
terminated: EnvironmentSpace,
truncated: EnvironmentSpace,
) -> Result<Self>
pub fn new( observation: EnvironmentSpace, action: EnvironmentSpace, reward: EnvironmentSpace, terminated: EnvironmentSpace, truncated: EnvironmentSpace, ) -> Result<Self>
Construct the five durable Gymnasium-compatible field contracts.
§Errors
Returns an error unless reward is a scalar Box and both episode-boundary fields are scalar Binary spaces.
Sourcepub const fn observation(&self) -> &EnvironmentSpace
pub const fn observation(&self) -> &EnvironmentSpace
Return the observation field contract.
Sourcepub const fn action(&self) -> &EnvironmentSpace
pub const fn action(&self) -> &EnvironmentSpace
Return the action field contract.
Sourcepub const fn reward(&self) -> &EnvironmentSpace
pub const fn reward(&self) -> &EnvironmentSpace
Return the scalar reward field contract.
Sourcepub const fn terminated(&self) -> &EnvironmentSpace
pub const fn terminated(&self) -> &EnvironmentSpace
Return the task-terminal field contract.
Sourcepub const fn truncated(&self) -> &EnvironmentSpace
pub const fn truncated(&self) -> &EnvironmentSpace
Return the external-truncation field contract.
Sourcepub fn validate_reset(
&self,
observation: &Matrix,
environments: u32,
) -> Result<()>
pub fn validate_reset( &self, observation: &Matrix, environments: u32, ) -> Result<()>
Validate one batched reset observation without reading it back.
§Errors
Returns an error for a zero environment count or shape/dtype mismatch.
Sourcepub fn validate_action(&self, action: &Matrix, environments: u32) -> Result<()>
pub fn validate_action(&self, action: &Matrix, environments: u32) -> Result<()>
Validate one batched action without reading it back.
§Errors
Returns an error for a zero environment count or shape/dtype mismatch.
Sourcepub fn validate_transition(
&self,
action: &Matrix,
transition: &EnvironmentTransition,
environments: u32,
) -> Result<()>
pub fn validate_transition( &self, action: &Matrix, transition: &EnvironmentTransition, environments: u32, ) -> Result<()>
Validate action and all five transition values without readback.
§Errors
Returns an error for a zero environment count or any shape/dtype mismatch.