Skip to content

FDiscreteSpace

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).

struct FDiscreteSpace : public FSpace

Methods

FDiscreteSpace

FDiscreteSpace()

Constructs an empty DiscreteSpace with High=0.


FDiscreteSpace

inline FDiscreteSpace(int High)

Constructs a DiscreteSpace with a specific upper bound.

Parameters

  • High (int)

Copy

void Copy(const FDiscreteSpace &Other)

Copies the contents of another DiscreteSpace into this one.

Parameters

  • Other (const FDiscreteSpace)

GetMaxValue

int GetMaxValue(const TArray<float> &Vector) const

Gets the index of the maximum value in an array.

Parameters

  • Vector (const TArray<float>)

GetNumDimensions

virtual int GetNumDimensions() const override

Gets the number of dimensions in this space.


Validate

virtual ESpaceValidationResult
Validate(const TInstancedStruct<FPoint> &InPoint) const override

Validates that a point conforms to this space.

Parameters

  • InPoint (const TInstancedStruct<FPoint>)

GetFlattenedSize

virtual int GetFlattenedSize() const override

Gets the flattened size of this space.


IsEmpty

virtual bool IsEmpty() const override

Checks if this space is empty.


Accept

inline virtual void Accept(SpaceVisitor &InVisitor)

Accepts a mutable visitor for the visitor pattern.

Parameters

  • InVisitor (SpaceVisitor)

Accept

inline virtual void Accept(ConstSpaceVisitor &InVisitor) const

Accepts a const visitor for the visitor pattern.

Parameters

  • InVisitor (ConstSpaceVisitor)

Attributes

High

int High = 0

The exclusive upper bound (maximum value + 1) for this discrete space.

Source: Source/Schola/Public/Spaces/DiscreteSpace.h