Table of Contents

Class ListBelief<TReference, TObservation>

Namespace
Aplib.Core.Belief.Beliefs
Assembly
Aplib.Core.dll

A convenience variant of Belief<TReference, TObservation> to track multiple references in one belief. Both the collection storing the references and the references themselves can be changed after the ListBelief<TReference, TObservation> has been created.

public class ListBelief<TReference, TObservation> : Belief<IEnumerable<TReference>, List<TObservation>>, IBelief

Type Parameters

TReference

The type of the object references used to generate/update the observation.

TObservation

The type of the observations that the belief represents.

Inheritance
Belief<IEnumerable<TReference>, List<TObservation>>
ListBelief<TReference, TObservation>
Implements
Inherited Members

Remarks

A ListBelief<TReference, TObservation> can be implicitly converted to a List<T>, which will have the same size as the reference collection the last time that UpdateBelief() was called, and contain the observation results for each element in the collection.

Constructors

ListBelief(Metadata, IEnumerable<TReference>, Func<TReference, TObservation>)

Initializes a new instance of the ListBelief<TReference, TObservation> class from an object reference collection, a function to generate an observation from an object reference, and optionally an update guard.

public ListBelief(Metadata metadata, IEnumerable<TReference> references, Func<TReference, TObservation> getObservationFromReference)

Parameters

metadata Metadata

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

references IEnumerable<TReference>

The collection of reference objects. The underlying type implementing IEnumerable<T>must be a reference type, note that this is not enforced by C#.

getObservationFromReference Func<TReference, TObservation>

A function that takes an object reference and generates an observation.

Exceptions

ArgumentException

Thrown when references is not a reference type.

ListBelief(Metadata, IEnumerable<TReference>, Func<TReference, TObservation>, Predicate<IEnumerable<TReference>>)

Initializes a new instance of the ListBelief<TReference, TObservation> class from an object reference collection, a function to generate an observation from an object reference, and optionally an update guard.

public ListBelief(Metadata metadata, IEnumerable<TReference> references, Func<TReference, TObservation> getObservationFromReference, Predicate<IEnumerable<TReference>> shouldUpdate)

Parameters

metadata Metadata

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

references IEnumerable<TReference>

The collection of reference objects. The underlying type implementing IEnumerable<T>must be a reference type, note that this is not enforced by C#.

getObservationFromReference Func<TReference, TObservation>

A function that takes an object reference and generates an observation.

shouldUpdate Predicate<IEnumerable<TReference>>

A condition on when the observation should be updated. Takes the object references enumerable of the belief as a parameter for the predicate.

Exceptions

ArgumentException

Thrown when references is not a reference type.

ListBelief(IEnumerable<TReference>, Func<TReference, TObservation>)

Initializes a new instance of the ListBelief<TReference, TObservation> class from an object reference collection, a function to generate an observation from an object reference, and optionally an update guard.

public ListBelief(IEnumerable<TReference> references, Func<TReference, TObservation> getObservationFromReference)

Parameters

references IEnumerable<TReference>

The collection of reference objects. The underlying type implementing IEnumerable<T>must be a reference type, note that this is not enforced by C#.

getObservationFromReference Func<TReference, TObservation>

A function that takes an object reference and generates an observation.

Exceptions

ArgumentException

Thrown when references is not a reference type.

ListBelief(IEnumerable<TReference>, Func<TReference, TObservation>, Predicate<IEnumerable<TReference>>)

Initializes a new instance of the ListBelief<TReference, TObservation> class from an object reference collection, a function to generate an observation from an object reference, and optionally an update guard.

public ListBelief(IEnumerable<TReference> references, Func<TReference, TObservation> getObservationFromReference, Predicate<IEnumerable<TReference>> shouldUpdate)

Parameters

references IEnumerable<TReference>

The collection of reference objects. The underlying type implementing IEnumerable<T>must be a reference type, note that this is not enforced by C#.

getObservationFromReference Func<TReference, TObservation>

A function that takes an object reference and generates an observation.

shouldUpdate Predicate<IEnumerable<TReference>>

A condition on when the observation should be updated. Takes the object references enumerable of the belief as a parameter for the predicate.

Exceptions

ArgumentException

Thrown when references is not a reference type.