Class UAbstractBrain
- class UAbstractBrain : public UObject
-
An AbstractBaseClass for subclasses representing different ways of synchronizing policy, observations and actions.
Subclassed by USynchronousBrain
Public Functions
- void SetStep(int NewStep)
-
Set the current agent step.
- Parameters:
-
NewStep – the value to update the step too
- bool IsActive()
-
Check if this brain is active (e.g.
Not closed or errored out)
- Returns:
-
true iff this brain is functional (e.g. Not closed or errored out)
- virtual bool IsDecisionStep(int StepToCheck)
-
Check whether a specific step will require a brain decision.
- Parameters:
-
StepToCheck – the timestep to check
- Returns:
-
true iff the agent should be requesting a decision
- virtual bool IsDecisionStep()
-
If the current step is a decision step, as defined by the step frequency.
- Returns:
-
true iff the current step is a decision step
- void Init(UAbstractPolicy *InjectedPolicy)
-
Initialize this brain by supplying a policy.
Note
this is so that we can avoid having massively nested structs in the editor when opening the Agent
- Parameters:
-
InjectedPolicy – [inout] The policy that this brain will use to make decisions
- inline virtual bool HasAction()
-
Check if this brain has an action prepared.
- Returns:
-
true iff this brain has an action prepared (e.g. a GetAction() call on this step will suceed)
- inline virtual FAction *GetAction()
-
get an action from this brain
- Returns:
-
A pointer to the current action
- inline virtual bool RequestDecision(const FDictPoint &Observations)
-
Request that the brain determine a new action.
- Parameters:
-
Observations – [in] The current state of the agent used to inform the brains choice of action
- Returns:
-
Status True if decision request suceeded and False otherwise
- virtual bool GetAbstractSettingsVisibility() const
-
Use by subclasses to set whether the settings are visible or not.
- Returns:
-
true if settings in this class are visible in the editor.
- virtual void SetStatus(EBrainStatus NewStatus)
-
Update the status of the brain.
- Parameters:
-
NewStatus – [in] The new status to set
- virtual void UpdateStatusFromDecision(const FPolicyDecision &Decision)
-
Update the status of the brain from a PolicyDecision.
- Parameters:
-
Decision – [in] The PolicyDecision to unpack and use when updating the status
Public Members
- UAbstractPolicy *Policy
-
The underlying policy this brain wraps.
- bool bTakeActionBetweenDecisions = true
-
If true the agent will repeat it’s last action each step between decision requests.
- int DecisionRequestFrequency = 5
-
The number of steps between requests for new actions.
If this is different across agents it may cause issues training in some frameworks (e.g. Stable Baselines 3).