Biorithm
1.1
|
A subgraph of MyAbstractAnnealState that computes the most heavy subgraph of a graph. The heavy subgraph need not be connected. More...
#include <graph.C>
Public Member Functions | |
MyDensestSubgraphAnnealState (const MyGraph &g) | |
MyDensestSubgraphAnnealState & | operator= (const MyDensestSubgraphAnnealState &rhs) |
MyDensestSubgraphAnnealState (const MyGraph &g, MyAbstractGraphModification *graphMod, bool keepOldPermutation=true) | |
virtual void | computeRandomNeighbour (MyAbstractAnnealState &neighbour) |
virtual void | getCurrentGraph (MyGraph &graph) const |
virtual MyNT | computeScore () const |
Compute the score of the state. | |
virtual void | print (ostream &ostr) const |
Print the score and length of the path followed by the elements of the path. | |
virtual void | undo () |
Undo the previous change made to the state. | |
Protected Attributes | |
const MyGraph * | _graph |
MyAbstractGraphModification * | _previousModification |
bool | _restart |
Static Protected Attributes | |
static MyGraph | _currentGraph = MyGraph() |
static vector< MyEdge > | _randomlyPermutedEdges = vector< MyEdge >() |
static vector< MyNode > | _randomlyPermutedNodes = vector< MyNode >() |
A subgraph of MyAbstractAnnealState that computes the most heavy subgraph of a graph. The heavy subgraph need not be connected.
MyDensestSubgraphAnnealState::MyDensestSubgraphAnnealState | ( | const MyGraph & | g, |
MyAbstractGraphModification * | graphMod, | ||
bool | keepOldPermutation = true |
||
) | [inline] |
Constructor that initialises both _graph and _currentGraph. This constructor is useful during MySimulatedAnnealer::run().
[in] | keepOldPermutation,if | this Boolean is true, do not change the static member variable _randomlyPermuteEdges. Otherwise, create a new random permutation. |
virtual void MyDensestSubgraphAnnealState::computeRandomNeighbour | ( | MyAbstractAnnealState & | neighbour | ) | [inline, virtual] |
Compute a random neighbour of *this.
We define a neighbour as any graph that differs from _currentGraph by one edge or by one node (deleted or inserted). The method makes an edge-change or a node-change with equal probability. If changing by an edge (respectively, node), the method picks an edge (respectively, node) uniformly at random from the set of all edges (respectively, nodes) in _graph.
Implements MyAbstractAnnealState.
Reimplemented in MyDensestSubgraphConnectedBruteForceAnnealState.