Class Energies
public class Energies extends Object
The main intended usage is with the various force layout algorithms that use a an "energy" minimization process to compute a layout. This class allows to store the energy at a current step of layout computation and to remember a history of such steps.
At a current step of layout computation, one can accumulate energy in the
current cell of the energies buffer using accumulateEnergy(double).
When the step finishes, one calls storeEnergy() to store this
accumulated energy in a cell of the memory, push a new cell on the memory and
therefore start a new step.
At any time you can get the last energy value computed with
getEnergy(). Be careful this is not the energy currently accumulated
but the value of the last energy stored with storeEnergy(). You can
also get at any time the average energy in the memory with
getAverageEnergy(), as well as an estimate of the stabilization (how
much the energies are varying) using getStabilization().
-
Constructor Summary
Constructors Constructor Description Energies() -
Method Summary
Modifier and Type Method Description voidaccumulateEnergy(double value)Accumulate some energy in the current energy cell.doublegetAverageEnergy()The average energy in the whole buffer.intgetBufferSize()The number of energy values remembered, the memory.doublegetEnergy()The last computed energy value.doublegetPreviousEnergyValue(int stepsBack)A previous energy value.doublegetStabilization()A number in [0..1] with 1 meaning fully stabilized.voidstoreEnergy()Add a the current accumulated energy value in the set.
-
Constructor Details
-
Energies
public Energies()
-
-
Method Details
-
getEnergy
public double getEnergy()The last computed energy value.- Returns:
- The actual level of energy.
-
getBufferSize
public int getBufferSize()The number of energy values remembered, the memory. -
getStabilization
public double getStabilization()A number in [0..1] with 1 meaning fully stabilized.- Returns:
- A value that indicates the level of stabilization in [0-1].
-
getAverageEnergy
public double getAverageEnergy()The average energy in the whole buffer.- Returns:
- The average energy.
-
getPreviousEnergyValue
public double getPreviousEnergyValue(int stepsBack)A previous energy value.- Parameters:
stepsBack- The number of steps back in history. This number must not be larger than the size of the memory (energy buffer) else it is set to this size.- Returns:
- The energy value at stepsBack in time.
-
accumulateEnergy
public void accumulateEnergy(double value)Accumulate some energy in the current energy cell.- Parameters:
value- The value to accumulate to the current cell.
-
storeEnergy
public void storeEnergy()Add a the current accumulated energy value in the set.
-