#include <PowerCircuitGraph.h>
Classes | |
struct | IntMarking |
struct | IntNode |
struct | NodeUsedByType |
Public Member Functions | |
PowerCircuitGraph () | |
virtual | ~PowerCircuitGraph () |
virtual void | reduce () |
void | reduce (std::list< Marking > markingList) |
virtual void | reduce (std::vector< Node > &nodeVector, std::vector< Marking > &markingVector) |
virtual Marking | createMarking (int i=0) |
virtual Marking | createMarking (const std::list< Node > &nodes) |
virtual Marking | createMarking (const std::list< Node > &nodeList, const std::list< int > &signList) |
virtual Marking | createMarking (const std::list< std::pair< Node, Sign > > &nodeList) |
virtual Node | createNode (const Marking &succ) |
virtual void | connect (const Marking &m, const Marking &p) |
virtual void | connectInv (const Marking &m, const Marking &q) |
virtual void | remove (const Marking &m) |
virtual Node | getReducedNode (unsigned int ord) |
virtual std::list< Node > | getNodes () |
virtual std::list< Marking > | getMarkings () |
virtual std::list< Node > | getMarkingNodes (const Marking &m) |
virtual PowerCircuit * | clone (std::vector< Marking > &markingsToKeep) |
virtual void | print (std::ostream &os=std::cout) |
void | printMarking (const Marking &m, std::ostream &os=std::cout) |
void | printMarking (const std::list< std::pair< Node, Sign > > &l, std::ostream &os=std::cout) |
double | getMatrixUsage () |
virtual void | printStatistics (std::ostream &os=std::cout) |
bool | checkCyclesRecursive (int n, std::vector< bool > &visited) |
bool | checkCycles () |
bool | checkConsistency () |
Private Member Functions | |
bool | checkMarkingValid (const Marking &m) const |
bool | checkNodeValid (Node n) const |
void | deleteNode (Node node) |
void | deleteMarking (Marking &mark) |
Marking | newMarking (std::list< std::pair< Node, Sign > > nodeList) |
Node | newNode (std::list< std::pair< Node, Sign > > nodeList) |
Node | newOneNode () |
Marking | newOneMarking () |
Marking | newZeroMarking () |
Marking | newUnitMarking (int onePos) |
Marking | newCopyMarking (const Marking &mark) |
std::list< std::pair< Node, Sign > > | inc (const std::list< std::pair< Node, Sign > > &nodeList) |
void | moveNodeIntoReducedPart (Node node, int newPos) |
int | compare (std::list< std::pair< Node, Sign > > &l1, std::list< std::pair< Node, Sign > > &l2) |
void | sortNodeList (std::list< std::pair< Node, Sign > > &l) |
void | insertNewPowerOfTwoNode (unsigned int power) |
std::list< std::pair< Node, Sign > > | calculateCompactRepresentation (int n) |
void | markSucessors (std::vector< bool > marked, std::list< std::pair< Node, Sign > > &nodeList) |
void | setBV (Node node) |
Node | newDoubleNode (Node node) |
std::list< std::pair< Node, Sign > >::iterator | findNodeInList (unsigned int nodeIndex, std::list< std::pair< Node, Sign > > &nodeList) |
void | removeDoubleNodesFromMarkings (Node oldNode, Node newNode, std::list< NodeUsedByType > *nodeUsedBy) |
int | findNewPosOfReducedNode (Node node, bool &equal) |
int | insertNodeIntoReduced (Node node, std::list< NodeUsedByType > *nodeUsedBy) |
void | topSortNode (Node node, std::vector< bool > &visited, std::vector< Node > &topSortPerm) |
void | extendTree (std::vector< Node > &nodeList, std::vector< Marking > &markingList) |
virtual void | incMarkingRefCount (const Marking &mark) |
virtual void | decMarkingRefCount (Marking &mark) |
virtual Marking | addMarkings (const Marking &m1, const Marking &m2) |
virtual Marking | invMarking (const Marking &m) |
virtual Marking | incMarking (const Marking &mark) |
virtual Marking | intersectMarkings (const Marking &m1, const Marking &m2) |
virtual Marking | cloneMarking (const Marking &mark) |
virtual Node | cloneNode (Node n) |
virtual Marking | copyMarking (const Marking &m) |
virtual bool | isMarkingReduced (const Marking &m) const |
virtual int | compareMarkings (const Marking &m1, const Marking &m2) |
virtual int | getRedNodeOrd (Node n) |
virtual int | getNodeSignInMarking (Node n, const Marking &m) const |
virtual bool | isSuccessorMarking (const Marking &m) const |
virtual Node | getIncidentNode (const Marking &m) |
virtual Node | getSmallestNodeInMarking (const Marking &m) |
virtual Marking | getSuccMarking (Node n) |
Static Private Member Functions | |
static bool | compareNodesLessThan (const std::pair< Node, Sign > &n1, const std::pair< Node, Sign > &n2) |
Private Attributes | |
unsigned int | numNodes |
unsigned int | numMarkings |
unsigned int | numReducedNodes |
std::vector< Node > | nodeOrder |
std::vector< IntNode > | nodes |
std::vector< IntMarking > | markings |
int | firstDeletedNode |
int | firstDeletedMarking |
Definition at line 15 of file PowerCircuitGraph.h.
PC::PowerCircuitGraph::PowerCircuitGraph | ( | ) |
virtual PC::PowerCircuitGraph::~PowerCircuitGraph | ( | ) | [virtual] |
virtual Marking PC::PowerCircuitGraph::addMarkings | ( | const Marking & | m1, | |
const Marking & | m2 | |||
) | [private, virtual] |
Implements PC::PowerCircuit.
std::list< std::pair<Node,Sign> > PC::PowerCircuitGraph::calculateCompactRepresentation | ( | int | n | ) | [private] |
bool PC::PowerCircuitGraph::checkConsistency | ( | ) |
bool PC::PowerCircuitGraph::checkCycles | ( | ) |
bool PC::PowerCircuitGraph::checkCyclesRecursive | ( | int | n, | |
std::vector< bool > & | visited | |||
) |
bool PC::PowerCircuitGraph::checkMarkingValid | ( | const Marking & | m | ) | const [private] |
bool PC::PowerCircuitGraph::checkNodeValid | ( | Node | n | ) | const [private] |
virtual PowerCircuit* PC::PowerCircuitGraph::clone | ( | std::vector< Marking > & | markingsToClone | ) | [virtual] |
Makes a copy of a PowerCircuit. Only the markings in the markingsToClone list are available in the cloned circuit. Reduced nodes and markings are remain reduced. The clone has to be deallocated via delete, once it is not needed anymore!
Implements PC::PowerCircuit.
Implements PC::PowerCircuit.
Implements PC::PowerCircuit.
int PC::PowerCircuitGraph::compare | ( | std::list< std::pair< Node, Sign > > & | l1, | |
std::list< std::pair< Node, Sign > > & | l2 | |||
) | [private] |
virtual int PC::PowerCircuitGraph::compareMarkings | ( | const Marking & | m1, | |
const Marking & | m2 | |||
) | [private, virtual] |
Implements PC::PowerCircuit.
static bool PC::PowerCircuitGraph::compareNodesLessThan | ( | const std::pair< Node, Sign > & | n1, | |
const std::pair< Node, Sign > & | n2 | |||
) | [inline, static, private] |
Definition at line 72 of file PowerCircuitGraph.h.
References nodes.
Adds the marking p to all successor markings of nodes in the support of m. (So, if supp(m) and supp(p) are disjoint, that means, that arrows are drawn from all nodes in supp(m) to p). The user has to assure that, for each node, the sum lies in the range [-1,+1] (for example using clone())! The user is required to check that the resulting graph has no cycles and no successor marking becomes negative. All nodes in supp(m) have to be non-reduced (use clone() to assure that).
Implements PC::PowerCircuit.
The same as connect, only that the marking p is subtracted instead of added.
Implements PC::PowerCircuit.
Implements PC::PowerCircuit.
virtual Marking PC::PowerCircuitGraph::createMarking | ( | const std::list< std::pair< Node, Sign > > & | nodeList | ) | [virtual] |
virtual Marking PC::PowerCircuitGraph::createMarking | ( | const std::list< Node > & | nodeList, | |
const std::list< int > & | signList | |||
) | [virtual] |
Creates a new marking, with the nodes in nodeList set to the respective sign in signList.
Implements PC::PowerCircuit.
Creates a new marking, with the nodes in nodeList set to 1.
Implements PC::PowerCircuit.
virtual Marking PC::PowerCircuitGraph::createMarking | ( | int | i = 0 |
) | [virtual] |
Creates a new marking with value val. The therefore required nodes are inserted into the reduced part of the PC.
Implements PC::PowerCircuit.
Creates a new node with a copy of m as successor-marking.
Implements PC::PowerCircuit.
virtual void PC::PowerCircuitGraph::decMarkingRefCount | ( | Marking & | mark | ) | [private, virtual] |
Implements PC::PowerCircuit.
void PC::PowerCircuitGraph::deleteMarking | ( | Marking & | mark | ) | [private] |
void PC::PowerCircuitGraph::deleteNode | ( | Node | node | ) | [private] |
void PC::PowerCircuitGraph::extendTree | ( | std::vector< Node > & | nodeList, | |
std::vector< Marking > & | markingList | |||
) | [private] |
int PC::PowerCircuitGraph::findNewPosOfReducedNode | ( | Node | node, | |
bool & | equal | |||
) | [private] |
std::list< std::pair<Node,Sign> >::iterator PC::PowerCircuitGraph::findNodeInList | ( | unsigned int | nodeIndex, | |
std::list< std::pair< Node, Sign > > & | nodeList | |||
) | [private] |
Implements PC::PowerCircuit.
Returns a list of all nodes which are non-zero in the marking m.
Implements PC::PowerCircuit.
virtual std::list<Marking> PC::PowerCircuitGraph::getMarkings | ( | ) | [virtual] |
Returns a list of all markings in the PowerCircuit.
Implements PC::PowerCircuit.
double PC::PowerCircuitGraph::getMatrixUsage | ( | ) |
virtual std::list<Node> PC::PowerCircuitGraph::getNodes | ( | ) | [virtual] |
Returns a list of all nodes in the PowerCircuit.
Implements PC::PowerCircuit.
virtual int PC::PowerCircuitGraph::getNodeSignInMarking | ( | Node | n, | |
const Marking & | m | |||
) | const [private, virtual] |
Implements PC::PowerCircuit.
virtual int PC::PowerCircuitGraph::getRedNodeOrd | ( | Node | n | ) | [private, virtual] |
Implements PC::PowerCircuit.
virtual Node PC::PowerCircuitGraph::getReducedNode | ( | unsigned int | ord | ) | [virtual] |
Returns the node with index ord (that means there are ord smaller nodes in the reduced part of the PC) If there are less than ord nodes, the undefined node is returned.
Implements PC::PowerCircuit.
virtual Node PC::PowerCircuitGraph::getSmallestNodeInMarking | ( | const Marking & | m | ) | [private, virtual] |
Implements PC::PowerCircuit.
Implements PC::PowerCircuit.
std::list< std::pair<Node,Sign> > PC::PowerCircuitGraph::inc | ( | const std::list< std::pair< Node, Sign > > & | nodeList | ) | [private] |
Implements PC::PowerCircuit.
virtual void PC::PowerCircuitGraph::incMarkingRefCount | ( | const Marking & | mark | ) | [private, virtual] |
Implements PC::PowerCircuit.
void PC::PowerCircuitGraph::insertNewPowerOfTwoNode | ( | unsigned int | power | ) | [private] |
int PC::PowerCircuitGraph::insertNodeIntoReduced | ( | Node | node, | |
std::list< NodeUsedByType > * | nodeUsedBy | |||
) | [private] |
virtual Marking PC::PowerCircuitGraph::intersectMarkings | ( | const Marking & | m1, | |
const Marking & | m2 | |||
) | [private, virtual] |
Implements PC::PowerCircuit.
Implements PC::PowerCircuit.
virtual bool PC::PowerCircuitGraph::isMarkingReduced | ( | const Marking & | m | ) | const [private, virtual] |
Implements PC::PowerCircuit.
virtual bool PC::PowerCircuitGraph::isSuccessorMarking | ( | const Marking & | m | ) | const [private, virtual] |
Implements PC::PowerCircuit.
void PC::PowerCircuitGraph::markSucessors | ( | std::vector< bool > | marked, | |
std::list< std::pair< Node, Sign > > & | nodeList | |||
) | [private] |
void PC::PowerCircuitGraph::moveNodeIntoReducedPart | ( | Node | node, | |
int | newPos | |||
) | [private] |
Marking PC::PowerCircuitGraph::newMarking | ( | std::list< std::pair< Node, Sign > > | nodeList | ) | [private] |
Marking PC::PowerCircuitGraph::newOneMarking | ( | ) | [private] |
Node PC::PowerCircuitGraph::newOneNode | ( | ) | [private] |
Marking PC::PowerCircuitGraph::newUnitMarking | ( | int | onePos | ) | [private] |
Marking PC::PowerCircuitGraph::newZeroMarking | ( | ) | [private] |
virtual void PC::PowerCircuitGraph::print | ( | std::ostream & | os = std::cout |
) | [virtual] |
Prints the adjacency matrix of the underlying graph.
Implements PC::PowerCircuit.
void PC::PowerCircuitGraph::printMarking | ( | const std::list< std::pair< Node, Sign > > & | l, | |
std::ostream & | os = std::cout | |||
) |
void PC::PowerCircuitGraph::printMarking | ( | const Marking & | m, | |
std::ostream & | os = std::cout | |||
) |
virtual void PC::PowerCircuitGraph::printStatistics | ( | std::ostream & | os = std::cout |
) | [virtual] |
Prints some statistical data.
Reimplemented from PC::PowerCircuit.
virtual void PC::PowerCircuitGraph::reduce | ( | std::vector< Node > & | nodeVector, | |
std::vector< Marking > & | markingVector | |||
) | [virtual] |
Moves all nodes in nodeList and markings in markingList to the reduced part of the PC. Nodes in nodeList MUST NOT be reduced! The support of markings in markingList has to be in nodeList or the already reduced part of the PC.
Implements PC::PowerCircuit.
void PC::PowerCircuitGraph::reduce | ( | std::list< Marking > | markingList | ) |
virtual void PC::PowerCircuitGraph::reduce | ( | ) | [virtual] |
Reduces the whole PC and all its markings.
Implements PC::PowerCircuit.
virtual void PC::PowerCircuitGraph::remove | ( | const Marking & | m | ) | [virtual] |
Deletes all nodes in the given marking. (So if other markings use those nodes, their values may be changed!)
Implements PC::PowerCircuit.
void PC::PowerCircuitGraph::removeDoubleNodesFromMarkings | ( | Node | oldNode, | |
Node | newNode, | |||
std::list< NodeUsedByType > * | nodeUsedBy | |||
) | [private] |
void PC::PowerCircuitGraph::setBV | ( | Node | node | ) | [private] |
void PC::PowerCircuitGraph::topSortNode | ( | Node | node, | |
std::vector< bool > & | visited, | |||
std::vector< Node > & | topSortPerm | |||
) | [private] |
int PC::PowerCircuitGraph::firstDeletedMarking [private] |
Definition at line 66 of file PowerCircuitGraph.h.
int PC::PowerCircuitGraph::firstDeletedNode [private] |
Definition at line 65 of file PowerCircuitGraph.h.
std::vector<IntMarking> PC::PowerCircuitGraph::markings [private] |
Definition at line 63 of file PowerCircuitGraph.h.
std::vector<Node> PC::PowerCircuitGraph::nodeOrder [private] |
Definition at line 60 of file PowerCircuitGraph.h.
std::vector<IntNode> PC::PowerCircuitGraph::nodes [private] |
Definition at line 62 of file PowerCircuitGraph.h.
Referenced by compareNodesLessThan().
unsigned int PC::PowerCircuitGraph::numMarkings [private] |
Definition at line 58 of file PowerCircuitGraph.h.
unsigned int PC::PowerCircuitGraph::numNodes [private] |
Definition at line 57 of file PowerCircuitGraph.h.
unsigned int PC::PowerCircuitGraph::numReducedNodes [private] |
Definition at line 59 of file PowerCircuitGraph.h.