Class Tactic<TBeliefSet>
Tactics are the real meat of Goal<TBeliefSet>s, as they define how the agent can approach the goal in hopes of finding a solution which makes the Goal's heuristic function evaluate to being completed. A tactic represents a smart combination of Action<TBeliefSet>s, which are executed in a Belief Desire Intent Cycle.
public abstract class Tactic<TBeliefSet> : ITactic<TBeliefSet>, ILoggable, IDocumented where TBeliefSet : IBeliefSet
Type Parameters
TBeliefSet
The belief set of the agent.
- Inheritance
-
Tactic<TBeliefSet>
- Implements
-
ITactic<TBeliefSet>
- Derived
- Inherited Members
Constructors
Tactic()
Initializes a new instance of the object class.
protected Tactic()
Tactic(IMetadata)
protected Tactic(IMetadata metadata)
Parameters
metadata
IMetadata
Tactic(IMetadata, Predicate<TBeliefSet>)
Initializes a new instance of the Tactic<TBeliefSet> class with a specified guard.
protected Tactic(IMetadata metadata, Predicate<TBeliefSet> guard)
Parameters
metadata
IMetadataMetadata about this tactic, used to quickly display the tactic in several contexts.
guard
Predicate<TBeliefSet>The guard of the tactic.
Tactic(Predicate<TBeliefSet>)
Initializes a new instance of the Tactic<TBeliefSet> class with a specified guard.
protected Tactic(Predicate<TBeliefSet> guard)
Parameters
guard
Predicate<TBeliefSet>The guard of the tactic.
Fields
_guard
Gets or sets the guard of the tactic.
protected readonly Predicate<TBeliefSet> _guard
Field Value
- Predicate<TBeliefSet>
Properties
Metadata
Gets the metadata of the instance. This metadata may be useful for debugging or logging.
public IMetadata Metadata { get; }
Property Value
Methods
GetAction(TBeliefSet)
Gets the first enabled action of the tactic.
public abstract IAction<TBeliefSet>? GetAction(TBeliefSet beliefSet)
Parameters
beliefSet
TBeliefSet
Returns
- IAction<TBeliefSet>
A concrete IAction<TBeliefSet> that the tactic can perform, or null if no actions are enabled.
GetLogChildren()
Gets the children of the loggable object.
public abstract IEnumerable<ILoggable> GetLogChildren()
Returns
- IEnumerable<ILoggable>
The children of the loggable object.
IsActionable(TBeliefSet)
Determines whether the tactic is actionable.
public virtual bool IsActionable(TBeliefSet beliefSet)
Parameters
beliefSet
TBeliefSet
Returns
- bool
True if the tactic is actionable, false otherwise.
Operators
implicit operator Tactic<TBeliefSet>(Action<TBeliefSet>)
Implicitly lifts an action into a tactic.
public static implicit operator Tactic<TBeliefSet>(Action<TBeliefSet> action)
Parameters
action
Action<TBeliefSet>The action which on its own can function as a tactic. Meaning, the tactic consists of just a single action.
Returns
- Tactic<TBeliefSet>
The most logically matching tactic, wrapping around
action
.