Struct FDiscreteSpace
Struct FDiscreteSpace
- Defined in File DiscreteSpace.h
Inheritance Relationships
Base Type
public FSpace(Struct FSpace)
struct FDiscreteSpace : public FSpaceSource: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Dependencies: ConstSpaceVisitor, FPoint, SpaceVisitor
A struct representing a discrete space of possible observations or actions.
A discrete space represents a single choice from a finite set of options, numbered from 0 to High-1. This is commonly used for discrete action spaces where an agent selects from a fixed set of actions (e.g., move left, move right, jump).
Public Functions
| Symbol | Details |
|---|---|
FDiscreteSpace | Constructs an empty DiscreteSpace with High=0. |
FDiscreteSpace | Constructs a DiscreteSpace with a specific upper bound. |
Copy | Copies the contents of another DiscreteSpace into this one. |
GetMaxValue | Gets the index of the maximum value in an array. |
GetNumDimensions | Gets the number of dimensions in this space. |
Validate | Validates that a point conforms to this space. |
GetFlattenedSize | Gets the flattened size of this space. |
IsEmpty | Checks if this space is empty. |
Accept | Accepts a mutable visitor for the visitor pattern. |
Accept | Accepts a const visitor for the visitor pattern. |
FDiscreteSpace
FDiscreteSpace()Constructs an empty DiscreteSpace with High=0.
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
FDiscreteSpace
inline FDiscreteSpace(int High)Constructs a DiscreteSpace with a specific upper bound.
Parameters
High – The exclusive upper bound (number of discrete options).
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
Copy
void Copy(const FDiscreteSpace &Other)Copies the contents of another DiscreteSpace into this one.
Parameters
Other – [in] The DiscreteSpace to copy from.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | Other | const FDiscreteSpace & | The DiscreteSpace to copy from. |
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
GetMaxValue
int GetMaxValue(const TArray<float> &Vector) constGets the index of the maximum value in an array.
Parameters
Vector – [in] The vector to find the maximum value in.
Returns:
The index of the maximum value.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | Vector | const TArray< float > & | The vector to find the maximum value in. |
Attributes: const
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
GetNumDimensions
virtual int GetNumDimensions() const overrideGets the number of dimensions in this space.
Returns:
Always returns 1 for discrete spaces.
Attributes: const, virtual
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
Validate
virtual ESpaceValidationResultValidate(const TInstancedStruct<FPoint> &InPoint) const overrideValidates that a point conforms to this space.
Parameters
InPoint – [in] The point to validate.
Returns:
Validation result indicating success or failure reason.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | InPoint | const TInstancedStruct< FPoint > & | The point to validate. |
Attributes: const, virtual
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
GetFlattenedSize
virtual int GetFlattenedSize() const overrideGets the flattened size of this space.
Returns:
The value of High.
Attributes: const, virtual
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
IsEmpty
virtual bool IsEmpty() const overrideChecks if this space is empty.
Returns:
True if High is 0, false otherwise.
Attributes: const, virtual
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Implementation: Source/Schola/Private/Common/Spaces/DiscreteSpace.cpp
Accept
inline virtual void Accept(SpaceVisitor &InVisitor)Accepts a mutable visitor for the visitor pattern.
Parameters
InVisitor – [inout] The visitor to accept.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | InVisitor | SpaceVisitor & | The visitor to accept. |
Attributes: inline, virtual
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Accept
inline virtual void Accept(ConstSpaceVisitor &InVisitor) constAccepts a const visitor for the visitor pattern.
Parameters
InVisitor – [inout] The const visitor to accept.
| # | Direction | Name | Type | Description |
|---|---|---|---|---|
| 1 | — | InVisitor | SpaceVisitor & | The visitor to accept. |
Attributes: inline, virtual
Source: Source/Schola/Public/Common/Spaces/DiscreteSpace.h
Public Members
| Symbol | Details |
|---|---|
High | The exclusive upper bound (maximum value + 1) for this discrete space. |
High
int High = 0The exclusive upper bound (maximum value + 1) for this discrete space.
The lower bound is always 0. For example, High=2 gives valid values {0,1}.