Table of Contents

Class RepeatGoalStructure<TBeliefSet>

Namespace
Aplib.Core.Desire.GoalStructures
Assembly
Aplib.Core.dll

Represents a goal structure that will complete if any of its children complete. This structure will repeatedly execute the goal it was created with until the goal is finished, or the maximum number of retries is reached.

public class RepeatGoalStructure<TBeliefSet> : GoalStructure<TBeliefSet>, IGoalStructure<TBeliefSet>, ICompletable, ILoggable, IDocumented where TBeliefSet : IBeliefSet

Type Parameters

TBeliefSet

The belief set of the agent.

Inheritance
GoalStructure<TBeliefSet>
RepeatGoalStructure<TBeliefSet>
Implements
IGoalStructure<TBeliefSet>
Inherited Members
Extension Methods

Constructors

RepeatGoalStructure(IGoalStructure<TBeliefSet>)

public RepeatGoalStructure(IGoalStructure<TBeliefSet> goalStructure)

Parameters

goalStructure IGoalStructure<TBeliefSet>

RepeatGoalStructure(IGoalStructure<TBeliefSet>, int)

public RepeatGoalStructure(IGoalStructure<TBeliefSet> goalStructure, int maxRetries)

Parameters

goalStructure IGoalStructure<TBeliefSet>
maxRetries int

RepeatGoalStructure(IMetadata, IGoalStructure<TBeliefSet>)

public RepeatGoalStructure(IMetadata metadata, IGoalStructure<TBeliefSet> goalStructure)

Parameters

metadata IMetadata
goalStructure IGoalStructure<TBeliefSet>

RepeatGoalStructure(IMetadata, IGoalStructure<TBeliefSet>, int)

public RepeatGoalStructure(IMetadata metadata, IGoalStructure<TBeliefSet> goalStructure, int maxRetries)

Parameters

metadata IMetadata
goalStructure IGoalStructure<TBeliefSet>
maxRetries int

RepeatGoalStructure(IMetadata, IGoalStructure<TBeliefSet>, int?)

Initializes a new instance of the RepeatGoalStructure<TBeliefSet> class.

protected RepeatGoalStructure(IMetadata metadata, IGoalStructure<TBeliefSet> goalStructure, int? maxRetries)

Parameters

metadata IMetadata

Metadata about this goal, used to quickly display the goal in several contexts.

goalStructure IGoalStructure<TBeliefSet>

The GoalStructure to repeat.

maxRetries int?

The maximum number of times to retry the goal after it has failed. If omitted, the goal will be retried indefinitely.

Exceptions

ArgumentOutOfRangeException

If maxRetries is less than zero.

Fields

_maxRetries

The maximum number of times to retry the goal after it has failed. If this is null, the goal will be retried indefinitely.

protected readonly int? _maxRetries

Field Value

int?

_retryCount

The number of times the goal has been retried so far.

protected int _retryCount

Field Value

int

Methods

GetCurrentGoal(TBeliefSet)

Gets the current goal using the given IBeliefSet.

public override IGoal<TBeliefSet> GetCurrentGoal(TBeliefSet beliefSet)

Parameters

beliefSet TBeliefSet

The belief set of the agent.

Returns

IGoal<TBeliefSet>

The current goal to be fulfilled.

GetLogChildren()

Gets the children of the loggable object.

public override IEnumerable<ILoggable> GetLogChildren()

Returns

IEnumerable<ILoggable>

The children of the loggable object.

UpdateStatus(TBeliefSet)

Updates the status of the RepeatGoalStructure<TBeliefSet>. The goal structure status is set to:

  • SuccessWhen the underlying goal structure is successful.
  • Failure If the underlying goal structure fails when the maximum number of retries has been reached. But never if no maximum number of retries has been specified.
  • Unfinished When the underlying goal structure is unfinished. The underlying goal structure will be retried when it fails.
public override void UpdateStatus(TBeliefSet beliefSet)

Parameters

beliefSet TBeliefSet

The belief set of the agent.