IGLib  1.5
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary Class Reference

A case of simulated annealing. More...

+ Inheritance diagram for IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary:
+ Collaboration diagram for IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary:

Public Member Functions

void ShiftALink ()
 Picks out a random link and shifts it a notch up or down. If the resulting change in potential energy is negative, the shift will take place. If it is positive, the shift will take place with a probability proportional to the falling exponential distribution. More...
 
void SimulatedAnnealing ()
 
 MolecularCatenary ()
 
- Public Member Functions inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableModelBase
PlotZedgraphCurve NewCurveFromPlottableData (PlotterZedGraph plotter, int x, int y)
 Creates a new PlotZedgraphCurve object from the available plottable data. More...
 
void LoadPlottableDataToCurve (PlotZedgraphCurve curve, int x, int y)
 Copies the calculated data to the existing PlotZedgraphCurve object. Enough space must be available on the curve object's list. More...
 

Protected Attributes

PlotHQ _plothq1
 
PlotZedgraphCurve _curve1
 
double _initialBeta = 0.01
 
double _finalBeta = 30
 
int _stepsAtTemperature = 5000
 
int _coolingLevels = 7
 
double _gamma
 The factor for which the inverse temperature beta rises after each cooling level. The inverse alpha, where alpha is the analogous factor asocciated with the gradual fall of the temperature. More...
 
int _plotEveryNShifts = 50
 
- Protected Attributes inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableModelBase
string _title
 

Properties

List< double[]> LinkPositions [get, set]
 Holds the positions of all the links of the molecular chain. The coordinates are integers. More...
 
int NLinks [get, set]
 The number of links, including the two static (fastened) ones at the boundary. More...
 
double PotentialEnergy [get, set]
 The current potential energy of the molecular chain. More...
 
double A [get, set]
 The constant accompanying the gravitational potential energy. More...
 
double B [get, set]
 The constant accompanying the elastic potential energy. More...
 
double Beta [get, set]
 The parameter beta of the falling exponential (Boltzmann) distribution. The "inverse" temperature. More...
 
PlotHQ PlotHQ1 [get, set]
 The chain's own plotting window. Displays the chain's current state. This is used across two threads. More...
 
PlotZedgraphCurve Curve1 [get, set]
 The chain object on the Plotter (PlotHQ). Used across two threads. More...
 
double InitialBeta [get, set]
 The initial inverse temperature for the simulated annealing process. More...
 
double FinalBeta [get, set]
 The final inverse temperature for the simulated annealing process. More...
 
int StepsAtTemperature [get, set]
 How many chain link shifts the method will make at a certain temperature. More...
 
int CoolingLevels [get, set]
 How granular the cooling will be. Example: T0 = 1000, TN=100, CoolingLevels = 10: 1000, 900, 800, ..., 200, 100. More levels means higher reliability, but also more time wasted. More...
 
int PlotEveryNShifts [get, set]
 How often the plotting window should refresh. A smaller number means more often and makes it more interesting. However, a bigger number makes the whole calculation much faster. More...
 
- Properties inherited from IG.MPetekLib.Algorithms.PlottableModels.PlottableModelBase
string Title [get, set]
 The plottable model's name. Also used as a plot title. More...
 
List< double[]> PlottableData [get, set]
 The main solution array, which is used by the plotter. More...
 

Private Member Functions

void ShowPlot ()
 The plotting thread. The plotter must be initialized on the same thread it will be shown on. More...
 

Private Attributes

List< double[]> _linkPositions
 
int _nLinks
 
double _potentialEnergy = 0
 
double _A = 1
 
double _B = 0.3
 
double _beta = 0.3
 
Random _rng = new Random()
 An all-purpose RNG. More...
 
int _linkNumber
 Which link get's picked to be shifted. More...
 
double _oldEnergy
 The potential energy of the system before the link shift. More...
 
double _energyChange
 The difference between the new and the old energy. More...
 
int _shiftDirection
 Indicates whether to shift the link up or down. Can be either +1 or -1. More...
 
double _diceRoll
 A random real number between 0 and 1. Used for the simulated annealing (Boltzmann) criterion. More...
 
readonly object _locker = new object()
 A locker for wait/pulse methods. More...
 
bool _go = false
 A blocking condition for the wait/pulse methods. More...
 

Detailed Description

A case of simulated annealing.

Constructor & Destructor Documentation

IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.MolecularCatenary ( )
inline

Member Function Documentation

void IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.ShiftALink ( )
inline

Picks out a random link and shifts it a notch up or down. If the resulting change in potential energy is negative, the shift will take place. If it is positive, the shift will take place with a probability proportional to the falling exponential distribution.

Referenced by IG.MPetekLib.Application.Scripts.CompPhys._01AnnealingCatenary.Run().

void IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.SimulatedAnnealing ( )
inline
void IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.ShowPlot ( )
inlineprivate

Member Data Documentation

List<double[]> IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._linkPositions
private
int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._nLinks
private
double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._potentialEnergy = 0
private
double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._A = 1
private
double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._B = 0.3
private
double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._beta = 0.3
private
PlotHQ IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._plothq1
protected
PlotZedgraphCurve IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._curve1
protected
Random IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._rng = new Random()
private

An all-purpose RNG.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._linkNumber
private

Which link get's picked to be shifted.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._oldEnergy
private

The potential energy of the system before the link shift.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._energyChange
private

The difference between the new and the old energy.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._shiftDirection
private

Indicates whether to shift the link up or down. Can be either +1 or -1.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._diceRoll
private

A random real number between 0 and 1. Used for the simulated annealing (Boltzmann) criterion.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._initialBeta = 0.01
protected
double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._finalBeta = 30
protected
int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._stepsAtTemperature = 5000
protected
int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._coolingLevels = 7
protected
double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._gamma
protected

The factor for which the inverse temperature beta rises after each cooling level. The inverse alpha, where alpha is the analogous factor asocciated with the gradual fall of the temperature.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._plotEveryNShifts = 50
protected
readonly object IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._locker = new object()
private

A locker for wait/pulse methods.

bool IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary._go = false
private

A blocking condition for the wait/pulse methods.

Property Documentation

List<double[]> IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.LinkPositions
getset

Holds the positions of all the links of the molecular chain. The coordinates are integers.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.NLinks
getset

The number of links, including the two static (fastened) ones at the boundary.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.PotentialEnergy
getset

The current potential energy of the molecular chain.

Referenced by IG.MPetekLib.Application.Scripts.CompPhys._01AnnealingCatenary.Run().

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.A
getset

The constant accompanying the gravitational potential energy.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.B
getset

The constant accompanying the elastic potential energy.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.Beta
getset

The parameter beta of the falling exponential (Boltzmann) distribution. The "inverse" temperature.

Referenced by IG.MPetekLib.Application.Scripts.CompPhys._01AnnealingCatenary.Run().

PlotHQ IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.PlotHQ1
getset

The chain's own plotting window. Displays the chain's current state. This is used across two threads.

PlotZedgraphCurve IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.Curve1
getset

The chain object on the Plotter (PlotHQ). Used across two threads.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.InitialBeta
getset

The initial inverse temperature for the simulated annealing process.

double IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.FinalBeta
getset

The final inverse temperature for the simulated annealing process.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.StepsAtTemperature
getset

How many chain link shifts the method will make at a certain temperature.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.CoolingLevels
getset

How granular the cooling will be. Example: T0 = 1000, TN=100, CoolingLevels = 10: 1000, 900, 800, ..., 200, 100. More levels means higher reliability, but also more time wasted.

int IG.MPetekLib.Algorithms.PlottableModels.CompPhys.MolecularCatenary.PlotEveryNShifts
getset

How often the plotting window should refresh. A smaller number means more often and makes it more interesting. However, a bigger number makes the whole calculation much faster.


The documentation for this class was generated from the following file: