Table of Contents

Class DesireSet<TBeliefSet>

Namespace
Aplib.Core.Desire.DesireSets
Assembly
Aplib.Core.dll
public class DesireSet<TBeliefSet> : IDesireSet<TBeliefSet>, ICompletable, ILoggable, IDocumented where TBeliefSet : IBeliefSet

Type Parameters

TBeliefSet
Inheritance
DesireSet<TBeliefSet>
Implements
IDesireSet<TBeliefSet>
Inherited Members

Constructors

DesireSet(IGoalStructure<TBeliefSet>, params (IGoalStructure<TBeliefSet> goalStructure, Predicate<TBeliefSet> guard)[])

public DesireSet(IGoalStructure<TBeliefSet> mainGoal, params (IGoalStructure<TBeliefSet> goalStructure, Predicate<TBeliefSet> guard)[] sideGoals)

Parameters

mainGoal IGoalStructure<TBeliefSet>
sideGoals (IGoalStructure<TBeliefSet> goalStructure, Predicate<TBeliefSet> guard)[]

DesireSet(IMetadata, IGoalStructure<TBeliefSet>, params (IGoalStructure<TBeliefSet> goalStructure, Predicate<TBeliefSet> guard)[])

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

public DesireSet(IMetadata metadata, IGoalStructure<TBeliefSet> mainGoal, params (IGoalStructure<TBeliefSet> goalStructure, Predicate<TBeliefSet> guard)[] sideGoals)

Parameters

metadata IMetadata

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

mainGoal IGoalStructure<TBeliefSet>

The main goal structure that the agent needs to complete.

sideGoals (IGoalStructure<TBeliefSet> goalStructure, Predicate<TBeliefSet> guard)[]

The side goal structures that could be activated during the agent playthrough.

Properties

Metadata

Gets the metadata of the instance. This metadata may be useful for debugging or logging.

public IMetadata Metadata { get; }

Property Value

IMetadata

Status

If there are no goal structures left to be completed, the status of this desire set is set to the main goal status.

public CompletionStatus Status { get; }

Property Value

CompletionStatus

Methods

GetCurrentGoal(TBeliefSet)

Gets the current goal using the given IBeliefSet.

public 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 IEnumerable<ILoggable> GetLogChildren()

Returns

IEnumerable<ILoggable>

The children of the loggable object.

Update(TBeliefSet)

Activates side goal structures when their guard is satisfied, and updates the activation stack by popping goal structures from the top of the stack when they are finished.

public void Update(TBeliefSet beliefSet)

Parameters

beliefSet TBeliefSet

The belief set of the agent.

Operators

implicit operator DesireSet<TBeliefSet>(GoalStructure<TBeliefSet>)

Implicitly lifts a goal structure a desire set.

public static implicit operator DesireSet<TBeliefSet>(GoalStructure<TBeliefSet> goalStructure)

Parameters

goalStructure GoalStructure<TBeliefSet>

The goal structure which on its own can function as a desire set. Meaning, the desire set consists of just a single goal structure.

Returns

DesireSet<TBeliefSet>

The most logically matching desire set, wrapping around goalStructure.

implicit operator DesireSet<TBeliefSet>(Goal<TBeliefSet>)

Implicitly lifts a goal into a desire set.

public static implicit operator DesireSet<TBeliefSet>(Goal<TBeliefSet> goal)

Parameters

goal Goal<TBeliefSet>

The goal which on its own can function as a goal structure. Meaning, the goal structure consists of just a single goal.

Returns

DesireSet<TBeliefSet>

The most logically matching desire set, wrapping around goal.