Skip to content

NevarokML: UNevarokMLSpace API

The UNevarokMLSpace class represents a space in the NevarokML plugin. It provides various methods to create and manipulate different types of spaces.


Properties

  • _shape (TArray<int32>): An array of integers representing the shape of the space.
  • _stack (TArray<int32>): An array of integers representing the stack dimension of the space.
  • _n (int64): An integer representing the size of the space.
  • _num (int32): An integer representing the number of elements in the space.
  • _low (TArray<float>): An array of floats representing the lower bounds of the space.
  • _high (TArray<float>): An array of floats representing the upper bounds of the space.
  • _nVec (TArray<int64>): An array of integers representing the number of actions for each discrete action space.
  • _nneShapes (TArray<UE::NNECore::FTensorShape>): An array of UE::NNECore::FTensorShape objects representing the shapes of the space in the NNECore library.

Methods

IsValid

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
bool IsValid();

Checks if the space is valid. Returns true if the space is valid, and false otherwise.

Discrete

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* Discrete(UObject* owner, int64 size = 1);

Creates a discrete space. The size parameter specifies the number of discrete actions in the space. Returns an instance of UNevarokMLSpace representing the discrete space.

MultiDiscrete

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* MultiDiscrete(UObject* owner, const TArray<int64>& vec);

Creates a multi-discrete space. The vec parameter is an array of positive integers specifying the number of actions for each discrete action space. Returns an instance of UNevarokMLSpace representing the multi-discrete space.

MultiBinary

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* MultiBinary(UObject* owner, int32 size = 1);

Creates a multi-binary space. The size parameter specifies the number of binary actions in the space. Returns an instance of UNevarokMLSpace representing the multi-binary space.

Continuous

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* Continuous(UObject* owner, int size, const TArray<float>& min, const TArray<float>& max);
Creates a continuous space. The size parameter specifies the length of the space. The min and max arrays define the lower and upper bounds for each element of the space. Returns an instance of UNevarokMLSpace representing the continuous space.

Box

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* Box(UObject* owner, FNevarokMLIndex2D size, const TArray<float>& min, const TArray<float>& max);
Creates a box space. The size parameter is a 2D index specifying the shape of the box space. The min and max arrays define the lower and upper bounds for each element of the box space. Returns an instance of UNevarokMLSpace representing the box space.

MultiDiscreteStack

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* MultiDiscreteStack(UObject* owner, const TArray<int64>& vec, int stack = 1);
Creates a stack of multi-discrete spaces. The vec parameter is an array of positive integers specifying the number of actions for each discrete action space. The stack parameter specifies the size of the stack. Returns an instance of UNevarokMLSpace representing the multi-discrete stack space.

MultiBinaryStack

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* MultiBinaryStack(UObject* owner, int32 size = 1, int stack = 1);
Creates a stack of multi-binary spaces. The size parameter specifies the number of binary actions in the space. The stack parameter specifies the size of the stack. Returns an instance of UNevarokMLSpace representing the multi-binary stack space.

ContinuousStack

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* ContinuousStack(UObject* owner, int size, const TArray<float>& min, const TArray<float>& max, int stack = 1);
Creates a stack of continuous spaces. The size parameter specifies the dimensionality of the space. The min and max arrays define the lower and upper bounds for each dimension of the space. The stack parameter specifies the size of the stack. Returns an instance of UNevarokMLSpace representing the continuous stack space.

BoxDXStack

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* BoxDXStack(UObject* owner, FNevarokMLIndex2D size, const TArray<float>& min, const TArray<float>& max, int stack = 1);
Creates a stack of box spaces where the stacking is done along the x-axis. The size parameter is a 2D index specifying the shape of the box space. The min and max arrays define the lower and upper bounds for each element of the box space. The stack parameter specifies the size of the stack. Returns an instance of UNevarokMLSpace representing the box stack space.

BoxDYStack

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
static UNevarokMLSpace* BoxDYStack(UObject* owner, FNevarokMLIndex2D size, const TArray<float>& min, const TArray<float>& max, int stack = 1);
Creates a stack of box spaces where the stacking is done along the y-axis. The size parameter is a 2D index specifying the shape of the box space. The min and max arrays define the lower and upper bounds for each element of the box space. The stack parameter specifies the size of the stack. Returns an instance of UNevarokMLSpace representing the box stack space.

ToDiscrete

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToDiscrete(int64 size);
Converts the space to a discrete space with the specified size. Updates the space in-place.

ToMultiDiscrete

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToMultiDiscrete(const TArray<int64>& vec);
Converts the space to a multi-discrete space with the specified vec, which is an array of positive integers specifying the number of actions for each discrete action space. Updates the space in-place.

ToMultiBinary

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToMultiBinary(int32 size);
Converts the space to a multi-binary space with the specified size. Updates the space in-place.

ToContinuous

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToContinuous(int size, const TArray<float>& min, const TArray<float>& max);
Converts the space to a continuous space with the specified size, min, and max arrays defining the lower and upper bounds for each dimension of the space. Updates the space in-place.

ToBox

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToBox(FNevarokMLIndex2D size, const TArray<float>& min, const TArray<float>& max);
Converts the space to a box space with the specified size, min, and max arrays defining the lower and upper bounds for each element of the box space. Updates the space in-place.

ToMultiDiscreteStack

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToMultiDiscreteStack(const TArray<int64>& vec, int stack);
Converts the space to a stack of multi-discrete spaces with the specified vec, which is an array of positive integers specifying the number of actions for each discrete action space, and stack specifying the size of the stack. Updates the space in-place.

ToMultiBinaryStack

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToMultiBinaryStack(int32 size, int stack);
Converts the space to a stack of multi-binary spaces with the specified size specifying the number of binary actions in the space, and stack specifying the size of the stack. Updates the space in-place.

ToContinuousStack

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToContinuousStack(int size, const TArray<float>& min, const TArray<float>& max, int stack);
Converts the space to a stack of continuous spaces with the specified size specifying the dimensionality of the space, min and max arrays defining the lower and upper bounds for each dimension of the space, and stack specifying the size of the stack. Updates the space in-place.

ToBoxDXStack

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToBoxDXStack(FNevarokMLIndex2D size, const TArray<float>& min, const TArray<float>& max, int stack);
Converts the space to a stack of box spaces where the stacking is done along the x-axis. The size parameter is a 2D index specifying the shape of the box space. The min and max arrays define the lower and upper bounds for each element of the box space. The stack parameter specifies the size of the stack. Updates the space in-place.

ToBoxDYStack

UFUNCTION(BlueprintCallable, Category = "NevarokML|Space")
void ToBoxDYStack(FNevarokMLIndex2D size, const TArray<float>& min, const TArray<float>& max, int stack);
Converts the space to a stack of box spaces where the stacking is done along the y-axis. The size parameter is a 2D index specifying the shape of the box space. The min and max arrays define the lower and upper bounds for each element of the box space. The stack parameter specifies the size of the stack. Updates the space in-place.

GetType

UFUNCTION(BlueprintPure, Category = "NevarokML|Space")
ENevarokMLSpaceEnum GetType() const;
Gets the type of the space. Returns the ENevarokMLSpaceEnum value representing the type of the space.

ToJson

TSharedPtr<FJsonObject> ToJson() const;
Converts the space to a JSON object representation. Returns a shared pointer to the JSON object.

IsSpace

static bool IsSpace(const FString& name, ENevarokMLSpaceEnum space);
Checks if the given space is of the specified type. Returns true if the space is of the specified type, and false otherwise.

GetName

static const FString& GetName(ENevarokMLSpaceEnum space);
Gets the name of the space type. Returns the name of the space as a string.

GetType

static ENevarokMLSpaceEnum GetType(const FString& name);
Gets the space type from the given name. Returns the ENevarokMLSpaceEnum value representing the space type.