Class MinimumDistanceConstraint<TNode, TConfiguration, TEnergyData>
Inheritance
Implements
Namespace: Edgar.GraphBasedGenerator.Common.Constraints.MinimumDistanceConstraint
Assembly: Edgar.dll
Syntax
public class MinimumDistanceConstraint<TNode, TConfiguration, TEnergyData> : Object, INodeConstraint<ILayout<TNode, TConfiguration>, TNode, TConfiguration, TEnergyData> where TConfiguration : IEnergyConfiguration<TEnergyData> where TEnergyData : IMinimumDistanceConstraintData
Type Parameters
| Name | Description |
|---|---|
| TNode | |
| TConfiguration | |
| TEnergyData |
Constructors
MinimumDistanceConstraint(ILevelDescription<TNode>, IRoomShapeGeometry<TConfiguration>, Int32)
Declaration
public MinimumDistanceConstraint(ILevelDescription<TNode> mapDescription, IRoomShapeGeometry<TConfiguration> roomShapeGeometry, int minimumDistance)
Parameters
| Type | Name | Description |
|---|---|---|
| ILevelDescription<TNode> | mapDescription | |
| IRoomShapeGeometry<TConfiguration> | roomShapeGeometry | |
| System.Int32 | minimumDistance |
Methods
ComputeEnergyData(ILayout<TNode, TConfiguration>, TNode, TConfiguration, ref TEnergyData)
Computes energy data for a given node.
Declaration
public bool ComputeEnergyData(ILayout<TNode, TConfiguration> layout, TNode node, TConfiguration configuration, ref TEnergyData energyData)
Parameters
| Type | Name | Description |
|---|---|---|
| ILayout<TNode, TConfiguration> | layout | |
| TNode | node | Node for which an energy data should be computed. |
| TConfiguration | configuration | Current configuration of the node. |
| TEnergyData | energyData | Energy data to be modified. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether the configuration is valid for a given node. |
UpdateEnergyData(ILayout<TNode, TConfiguration>, TNode, TConfiguration, TConfiguration, TNode, TConfiguration, ref TEnergyData)
Updates energy data of a given node based on a perturbed node.
Declaration
public bool UpdateEnergyData(ILayout<TNode, TConfiguration> layout, TNode perturbedNode, TConfiguration oldConfiguration, TConfiguration newConfiguration, TNode node, TConfiguration configuration, ref TEnergyData energyData)
Parameters
| Type | Name | Description |
|---|---|---|
| ILayout<TNode, TConfiguration> | layout | |
| TNode | perturbedNode | Node that was perturbed. |
| TConfiguration | oldConfiguration | Old configuration of the perturbed node. |
| TConfiguration | newConfiguration | New configuration of the perturbed node. |
| TNode | node | Node for which an energy data should be computed. |
| TConfiguration | configuration | Current configuration of the node. |
| TEnergyData | energyData | Energy data to be modified. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether the configuration is valid for a given node. |
Remarks
This method is used to speedup the computation. It would have a complexity of O(n^2) (n being the number of vertices) if all vertices needed all other vertices to compute their energy data. But it can be computed in O(n) if we change only relevant data and do not compute it all again. To support this method, energy data often hold all the information needed to make this kind of update.
UpdateEnergyData(ILayout<TNode, TConfiguration>, ILayout<TNode, TConfiguration>, TNode, ref TEnergyData)
Updates energy data of a perturbed node.
Declaration
public bool UpdateEnergyData(ILayout<TNode, TConfiguration> oldLayout, ILayout<TNode, TConfiguration> newLayout, TNode node, ref TEnergyData energyData)
Parameters
| Type | Name | Description |
|---|---|---|
| ILayout<TNode, TConfiguration> | oldLayout | |
| ILayout<TNode, TConfiguration> | newLayout | |
| TNode | node | Node for which an energy data should be computed. |
| TEnergyData | energyData | Energy data to be modified. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether the configuration is valid for a given node. |
Remarks
The idea of this method is the same as of the overload above.