Class AbstractConfigurationSpaces<TNode, TShapeContainer, TConfiguration>
Abstract class for configuration spaces with common methods already implemented.
Inheritance
Implements
Namespace: Edgar.Legacy.Core.ConfigurationSpaces
Assembly: Edgar.dll
Syntax
public abstract class AbstractConfigurationSpaces<TNode, TShapeContainer, TConfiguration> : Object, IConfigurationSpaces<TNode, TShapeContainer, TConfiguration, ConfigurationSpace>, IRandomInjectable where TConfiguration : IConfiguration<TShapeContainer, TNode>
Type Parameters
Name | Description |
---|---|
TNode | |
TShapeContainer | |
TConfiguration |
Remarks
It is useful when debugging algorithms based on probabilties.
Constructors
AbstractConfigurationSpaces(ILineIntersection<OrthogonalLineGrid2D>)
Declaration
protected AbstractConfigurationSpaces(ILineIntersection<OrthogonalLineGrid2D> lineIntersection)
Parameters
Type | Name | Description |
---|---|---|
ILineIntersection<OrthogonalLineGrid2D> | lineIntersection |
Fields
LineIntersection
Declaration
protected ILineIntersection<OrthogonalLineGrid2D> LineIntersection
Field Value
Type | Description |
---|---|
ILineIntersection<OrthogonalLineGrid2D> |
Random
Declaration
protected Random Random
Field Value
Type | Description |
---|---|
System.Random |
Methods
CanPerturbShape(TNode)
Checks whether a node can be shape perturbed.
Declaration
public abstract bool CanPerturbShape(TNode node)
Parameters
Type | Name | Description |
---|---|---|
TNode | node |
Returns
Type | Description |
---|---|
System.Boolean |
GetAllShapes()
Gets all shapes that can be used for at least one node.
Declaration
public abstract IEnumerable<TShapeContainer> GetAllShapes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TShapeContainer> |
GetConfigurationSpace(TShapeContainer, TShapeContainer)
Gets a configuration space for two shapes.
Declaration
public abstract ConfigurationSpace GetConfigurationSpace(TShapeContainer movingPolygon, TShapeContainer fixedPolygon)
Parameters
Type | Name | Description |
---|---|---|
TShapeContainer | movingPolygon | |
TShapeContainer | fixedPolygon |
Returns
Type | Description |
---|---|
ConfigurationSpace |
GetConfigurationSpace(TConfiguration, TConfiguration)
Gets a configuration space for given two configurations.
Declaration
public abstract ConfigurationSpace GetConfigurationSpace(TConfiguration mainConfiguration, TConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | mainConfiguration | Configuration with a shape that can be moved. |
TConfiguration | configuration | Configuration with a shape that is fixed. |
Returns
Type | Description |
---|---|
ConfigurationSpace |
GetConfigurationSpaces(TConfiguration, IList<TConfiguration>)
Gets configurations spaces of a given main configuration with respect to other configurations.
Declaration
protected abstract IList<Tuple<TConfiguration, ConfigurationSpace>> GetConfigurationSpaces(TConfiguration mainConfiguration, IList<TConfiguration> configurations)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | mainConfiguration | Plays a role of a shape that can be moved. |
System.Collections.Generic.IList<TConfiguration> | configurations | Fixed configurations. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Tuple<TConfiguration, ConfigurationSpace>> |
Remarks
The main configuration will play a role of a shape that can be moved. Other configurations stays fixed.
GetMaximumIntersection(TConfiguration, IList<TConfiguration>)
Gets a maximum intersection of configuration spaces of given configurations with respect to the main configuration.
Declaration
public IList<OrthogonalLineGrid2D> GetMaximumIntersection(TConfiguration mainConfiguration, IList<TConfiguration> configurations)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | mainConfiguration | Configuration of a node for which we look for a new position. |
System.Collections.Generic.IList<TConfiguration> | configurations | Configurations that we try to satisfy when looking for a new position. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<OrthogonalLineGrid2D> |
GetMaximumIntersection(TConfiguration, IList<TConfiguration>, out Int32)
Gets a maximum intersection of configuration spaces of given configurations with respect to the main configuration.
Declaration
public IList<OrthogonalLineGrid2D> GetMaximumIntersection(TConfiguration mainConfiguration, IList<TConfiguration> configurations, out int configurationsSatisfied)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | mainConfiguration | Configuration of a node for which we look for a new position. |
System.Collections.Generic.IList<TConfiguration> | configurations | Configurations that we try to satisfy when looking for a new position. |
System.Int32 | configurationsSatisfied | How many of given configurations were satisfied. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<OrthogonalLineGrid2D> |
Remarks
Tries possible combinations of given configurations until an intersection is found. Throws when no intersection was found.
GetRandomIntersectionPoint(TConfiguration, IList<TConfiguration>)
Gets a random point in the maximum intersection of configuration spaces of given configurations with respect to the main configuration.
Declaration
public Vector2Int GetRandomIntersectionPoint(TConfiguration mainConfiguration, IList<TConfiguration> configurations)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | mainConfiguration | Configuration of a node for which we look for a new position. |
System.Collections.Generic.IList<TConfiguration> | configurations | Configurations that we try to satisfy when looking for a new position. |
Returns
Type | Description |
---|---|
Vector2Int |
GetRandomIntersectionPoint(TConfiguration, IList<TConfiguration>, out Int32)
Gets a random point in the maximum intersection of configuration spaces of given configurations with respect to the main configuration.
Declaration
public Vector2Int GetRandomIntersectionPoint(TConfiguration mainConfiguration, IList<TConfiguration> configurations, out int configurationsSatisfied)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | mainConfiguration | Configuration of a node for which we look for a new position. |
System.Collections.Generic.IList<TConfiguration> | configurations | Configurations that we try to satisfy when looking for a new position. |
System.Int32 | configurationsSatisfied | How many of given configurations were satisfied. |
Returns
Type | Description |
---|---|
Vector2Int |
GetRandomShape(TNode)
Gets a random shape for a given node.
Declaration
public abstract TShapeContainer GetRandomShape(TNode node)
Parameters
Type | Name | Description |
---|---|---|
TNode | node |
Returns
Type | Description |
---|---|
TShapeContainer |
GetShapesForNode(TNode)
Gets all possible shapes for a given node.
Declaration
public abstract IReadOnlyCollection<TShapeContainer> GetShapesForNode(TNode node)
Parameters
Type | Name | Description |
---|---|---|
TNode | node |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyCollection<TShapeContainer> |
HaveValidPosition(TConfiguration, TConfiguration)
Checks if two configurations are valid with respect to each other.
Declaration
public bool HaveValidPosition(TConfiguration configuration1, TConfiguration configuration2)
Parameters
Type | Name | Description |
---|---|---|
TConfiguration | configuration1 | |
TConfiguration | configuration2 |
Returns
Type | Description |
---|---|
System.Boolean |
InjectRandomGenerator(Random)
Injects an instance of a random numbers generator.
Declaration
public void InjectRandomGenerator(Random random)
Parameters
Type | Name | Description |
---|---|---|
System.Random | random |