Show / Hide Table of Contents

Class SimulatedAnnealingEvolver<TLayout, TNode, TConfiguration>

Implementation of a simulated annealing evolver.

Inheritance
System.Object
SimulatedAnnealingEvolver<TLayout, TNode, TConfiguration>
Implements
ILayoutEvolver<TLayout, TNode>
IRandomInjectable
ICancellable
Namespace: Edgar.Legacy.Core.LayoutEvolvers.SimulatedAnnealing
Assembly: Edgar.dll
Syntax
public class SimulatedAnnealingEvolver<TLayout, TNode, TConfiguration> : Object, ILayoutEvolver<TLayout, TNode>, IRandomInjectable, ICancellable where TLayout : ILayout<TNode, TConfiguration>, ISmartCloneable<TLayout> where TConfiguration : IConfiguration<IntAlias<PolygonGrid2D>, TNode>
Type Parameters
Name Description
TLayout
TNode
TConfiguration

Constructors

SimulatedAnnealingEvolver(IChainBasedLayoutOperations<TLayout, TNode>, SimulatedAnnealingConfiguration, Boolean)

Declaration
public SimulatedAnnealingEvolver(IChainBasedLayoutOperations<TLayout, TNode> layoutOperations, SimulatedAnnealingConfiguration configuration = null, bool addNodesGreedilyBeforeEvolve = false)
Parameters
Type Name Description
IChainBasedLayoutOperations<TLayout, TNode> layoutOperations
SimulatedAnnealingConfiguration configuration
System.Boolean addNodesGreedilyBeforeEvolve

SimulatedAnnealingEvolver(IChainBasedLayoutOperations<TLayout, TNode>, SimulatedAnnealingConfigurationProvider, Boolean)

Declaration
public SimulatedAnnealingEvolver(IChainBasedLayoutOperations<TLayout, TNode> layoutOperations, SimulatedAnnealingConfigurationProvider configurationProvider, bool addNodesGreedilyBeforeEvolve = false)
Parameters
Type Name Description
IChainBasedLayoutOperations<TLayout, TNode> layoutOperations
SimulatedAnnealingConfigurationProvider configurationProvider
System.Boolean addNodesGreedilyBeforeEvolve

Fields

CancellationToken

Declaration
protected Nullable<CancellationToken> CancellationToken
Field Value
Type Description
System.Nullable<System.Threading.CancellationToken>

Configuration

Declaration
protected SimulatedAnnealingConfiguration Configuration
Field Value
Type Description
SimulatedAnnealingConfiguration

ConfigurationProvider

Declaration
protected SimulatedAnnealingConfigurationProvider ConfigurationProvider
Field Value
Type Description
SimulatedAnnealingConfigurationProvider

LayoutOperations

Declaration
protected IChainBasedLayoutOperations<TLayout, TNode> LayoutOperations
Field Value
Type Description
IChainBasedLayoutOperations<TLayout, TNode>

Random

Declaration
protected Random Random
Field Value
Type Description
System.Random

Methods

Evolve(TLayout, Chain<TNode>, Int32)

Returns valid layouts evolved from a given initial layout.

Declaration
public IEnumerable<TLayout> Evolve(TLayout initialLayout, Chain<TNode> chain, int count)
Parameters
Type Name Description
TLayout initialLayout

A layout that is used as the base for the evolution.

Chain<TNode> chain

Only nodes from the chain should be perturbed.

System.Int32 count

How many layouts should be produced.

Returns
Type Description
System.Collections.Generic.IEnumerable<TLayout>
Remarks

It is advised to implement the method lazily using "yield return" syntax. The generation process can be then better controller and optimized.

The evolver may produce less than requested layouts if it finds itself in a situation where it is better to terminate than to continue.

GetConfiguration(Int32)

Declaration
protected SimulatedAnnealingConfiguration GetConfiguration(int chainNumber)
Parameters
Type Name Description
System.Int32 chainNumber
Returns
Type Description
SimulatedAnnealingConfiguration

InjectRandomGenerator(Random)

Declaration
public void InjectRandomGenerator(Random random)
Parameters
Type Name Description
System.Random random

SetCancellationToken(Nullable<CancellationToken>)

Declaration
public void SetCancellationToken(Nullable<CancellationToken> cancellationToken)
Parameters
Type Name Description
System.Nullable<System.Threading.CancellationToken> cancellationToken

SetRandomRestarts(Boolean, SimulatedAnnealingEvolver<TLayout, TNode, TConfiguration>.RestartSuccessPlace, Boolean, Single)

Set up random restarts strategy.

Declaration
public void SetRandomRestarts(bool enable, SimulatedAnnealingEvolver<TLayout, TNode, TConfiguration>.RestartSuccessPlace successPlace, bool resetCounter = false, float scale = 1F)
Parameters
Type Name Description
System.Boolean enable
SimulatedAnnealingEvolver.RestartSuccessPlace<> successPlace
System.Boolean resetCounter
System.Single scale

Events

OnEvent

Declaration
public event EventHandler<SimulatedAnnealingEventArgs> OnEvent
Event Type
Type Description
System.EventHandler<SimulatedAnnealingEventArgs>

OnPerturbed

Declaration
public event EventHandler<TLayout> OnPerturbed
Event Type
Type Description
System.EventHandler<TLayout>

OnValid

Declaration
public event EventHandler<TLayout> OnValid
Event Type
Type Description
System.EventHandler<TLayout>

Implements

ILayoutEvolver<TLayout, TNode>
IRandomInjectable
ICancellable
Back to top Generated by DocFX