public class SimulatedAnnealing.IncrementalState
extends java.lang.Object
IncrementalState
object on which it apply the
changes. After STEP_THREAD
iterations all
IncrementalState
s of all worker threads are compared and the
state with best score becomes the new state for all threads.makeGlobal()
Constructor and Description |
---|
SimulatedAnnealing.IncrementalState(java.util.List<PlacementFrame.PlacementNode> allNodes,
java.util.List<PlacementFrame.PlacementNetwork> allNetworks)
Creates this.
|
Modifier and Type | Method and Description |
---|---|
double |
addNode(int index,
SimulatedAnnealing.PlacementNodePosition newNode)
Adds a node to the list of changed nodes.
|
boolean |
chooseAndSwapNodes()
Swaps two nodes.
|
double |
getC1() |
double |
getC2() |
SimulatedAnnealing.PlacementNodePosition |
getNodeFromState(int index)
Returns the
PlacementNodePosition for a node given the
index. |
java.util.List<PlacementFrame.PlacementNode> |
getOriginalNodes() |
double |
getScore()
Returns the score of the two metrics.
|
boolean |
isNodeChanged(int index) |
double |
makeGlobal()
This methods makes this
IncrementalState object a global
state, i.e. |
boolean |
moveNode()
Moves a node.
|
double |
removeNode(int index) |
double |
reset()
Resets the state.
|
public SimulatedAnnealing.IncrementalState(java.util.List<PlacementFrame.PlacementNode> allNodes, java.util.List<PlacementFrame.PlacementNetwork> allNetworks)
allNodes
- a list of all PlacementNode
s.allNetworks
- a list of all PlacementNetwork
s.public double addNode(int index, SimulatedAnnealing.PlacementNodePosition newNode)
index
- the index of the changed node.newNode
- a new PlacementNodePosition
for the changed
node.public double removeNode(int index)
public boolean moveNode()
public boolean chooseAndSwapNodes()
public SimulatedAnnealing.PlacementNodePosition getNodeFromState(int index)
PlacementNodePosition
for a node given the
index.index
- the index of the nodePlacementNodePosition
for this node.public boolean isNodeChanged(int index)
public java.util.List<PlacementFrame.PlacementNode> getOriginalNodes()
public double getC1()
public double getC2()
public double getScore()
public double reset()
public double makeGlobal()
IncrementalState
object a global
state, i.e. the changes of this state will be applied to the nodes
that are to be placed.