Show / Hide Table of Contents

Interface IDescriptor

Interface that bundles up and exposes the basic components required to describe a puzzle's logic and its constraints.

Namespace: TreeProblemFramework.Description

Properties

Transformations

Gets the set of ITransformation objects which are to be executed on the IEntity objects of a given IEnvironment object.

Declaration
TransformationCollection Transformations { get; }
Property Value
Type Description
TransformationCollection

An instance of the TransformationCollection class.

Methods

RetrieveNextEntities(IEnvironment)

Method whose implementation should iteratively yield the first/next set of IEntity objects on which transformations are to be executed.

Declaration
IEnumerable<EntityCollection> RetrieveNextEntities(IEnvironment env)
Parameters
Type Name Description
IEnvironment env

The specified IEnvironment form which to yield sets of IEntity objects.

Returns
Type Description
System.Collections.Generic.IEnumerable<EntityCollection>

An enumerator of EntityCollection on whose elements transformations are to be executed.

Remarks

An IEnvironment object is provided to this method in case it be needed. Yet in fact, if puzzle's logic requires the first/next set of IEntity objects be yielded from an external source in any sort of controlled manner, like Round-robin, said IEnvironment object can be obviated. Still, it is useful to TPF's internals since it helps for tracking states and changes.

ValidateSolution(IEnvironment, Double)

Method whose implementation should validate whether a given IEnvironment object either meets the constraints required to be considered as a solution to the puzzle, or is in fact equal or equivalent to a previously defined solution IEnvironment object.

Declaration
bool ValidateSolution(IEnvironment env, double heuristicValue)
Parameters
Type Name Description
IEnvironment env

The specified IEnvironment whose correspondence to the solution to the puzzle is to be determined.

System.Double heuristicValue

The heuristic value directly calculated from the specified IEnvironment object, which provides an insight on how far or close such IEnvironment object is to an actual solution to the puzzle. Such value is the result returned by the ComputeHeuristic(IEnvironment) method.

Returns
Type Description
System.Boolean

True if the specified IEnvironment object corresponds to a solution to the puzzle; false if it does not.

Remarks

As a matter of a hint, if SmallestFirst is set to the HeuristicPriority parameter, an heuristic value equals to the smallest possible value returned by the ComputeHeuristic(IEnvironment) method means that the the specified IEnvironment does correspond to a solution to the puzzle. The same applies if GreatestFirst is set to the HeuristicPriority parameter and the heuristic value equals the greatest possible value returned by the ComputeHeuristic(IEnvironment) method.

Back to top TreeProblemFramework from Ecuador.