LLVM API Documentation
Heuristic PBQP solver implementation. More...
#include <HeuristicSolver.h>
Public Types | |
typedef SolverEdges::iterator | SolverEdgeItr |
Iterator type for edges in the solver graph. More... | |
Public Member Functions | |
HeuristicSolverImpl (Graph &g) | |
Construct a heuristic solver implementation to solve the given graph. More... | |
Graph & | getGraph () |
Get the graph being solved by this solver. More... | |
HeuristicNodeData & | getHeuristicNodeData (Graph::NodeId nId) |
Get the heuristic data attached to the given node. More... | |
HeuristicEdgeData & | getHeuristicEdgeData (Graph::EdgeId eId) |
Get the heuristic data attached to the given edge. More... | |
SolverEdgeItr | solverEdgesBegin (Graph::NodeId nId) |
Begin iterator for the set of edges adjacent to the given node in the solver graph. More... | |
SolverEdgeItr | solverEdgesEnd (Graph::NodeId nId) |
End iterator for the set of edges adjacent to the given node in the solver graph. More... | |
void | removeSolverEdge (Graph::EdgeId eId) |
Remove a node from the solver graph. More... | |
Solution | computeSolution () |
Compute a solution to the PBQP problem instance with which this heuristic solver was constructed. More... | |
void | pushToStack (Graph::NodeId nId) |
Add to the end of the stack. More... | |
unsigned | getSolverDegree (Graph::NodeId nId) |
Returns the solver degree of the given node. More... | |
void | setSolution (const Graph::NodeId &nId, unsigned selection) |
Set the solution of the given node. More... | |
void | applyR0 (Graph::NodeId nId) |
Apply rule R0. More... | |
void | applyR1 (Graph::NodeId xnId) |
Apply rule R1. More... | |
void | applyR2 (Graph::NodeId xnId) |
Apply rule R2. More... | |
void | recordRN () |
Record an application of the RN rule. More... | |
Heuristic PBQP solver implementation.
This class should usually be created (and destroyed) indirectly via a call to HeuristicSolver<HImpl>::solve(Graph&). See the comments for HeuristicSolver.
HeuristicSolverImpl provides the R0, R1 and R2 reduction rules, backpropagation phase, and maintains the internal copy of the graph on which the reduction is carried out (the original being kept to facilitate backpropagation).
Definition at line 37 of file HeuristicSolver.h.
typedef SolverEdges::iterator PBQP::HeuristicSolverImpl< HImpl >::SolverEdgeItr |
Iterator type for edges in the solver graph.
Definition at line 48 of file HeuristicSolver.h.
|
inline |
Construct a heuristic solver implementation to solve the given graph.
g | The graph representing the problem instance to be solved. |
Definition at line 120 of file HeuristicSolver.h.
|
inline |
Apply rule R0.
nId | Node id for node to apply R0 to. |
Node will be automatically pushed to the solver stack.
Definition at line 223 of file HeuristicSolver.h.
|
inline |
Apply rule R1.
xnId | Node id for node to apply R1 to. |
Node will be automatically pushed to the solver stack.
Definition at line 237 of file HeuristicSolver.h.
|
inline |
Apply rule R2.
xnId | Node id for node to apply R2 to. |
Node will be automatically pushed to the solver stack.
Definition at line 286 of file HeuristicSolver.h.
|
inline |
Compute a solution to the PBQP problem instance with which this heuristic solver was constructed.
Performs the full PBQP heuristic solver algorithm, including setup, calls to the heuristic (which will call back to the reduction rules in this class), and cleanup.
Definition at line 180 of file HeuristicSolver.h.
Referenced by PBQP::HeuristicSolver< HImpl >::solve().
|
inline |
Get the graph being solved by this solver.
Definition at line 125 of file HeuristicSolver.h.
|
inline |
Get the heuristic data attached to the given edge.
eId | Edge id. |
Definition at line 137 of file HeuristicSolver.h.
|
inline |
Get the heuristic data attached to the given node.
nId | Node id. |
Definition at line 130 of file HeuristicSolver.h.
|
inline |
Returns the solver degree of the given node.
nId | Node id for which degree is requested. |
Definition at line 200 of file HeuristicSolver.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR0(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2().
|
inline |
Add to the end of the stack.
nId | Node id to add to the reduction stack. |
Definition at line 192 of file HeuristicSolver.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR0(), PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR1(), PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2(), and PBQP::Heuristics::Briggs::heuristicReduce().
|
inline |
Record an application of the RN rule.
For use by the HeuristicBase.
Definition at line 390 of file HeuristicSolver.h.
|
inline |
Remove a node from the solver graph.
eId | Edge id for edge to be removed. |
Does not notify the heuristic of the removal. That should be done manually if necessary.
Definition at line 164 of file HeuristicSolver.h.
Referenced by PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR1(), and PBQP::HeuristicSolverImpl< PBQP::Heuristics::Briggs >::applyR2().
|
inline |
Set the solution of the given node.
nId | Node id to set solution for. |
selection | Selection for node. |
Definition at line 207 of file HeuristicSolver.h.
|
inline |
Begin iterator for the set of edges adjacent to the given node in the solver graph.
nId | Node id. |
Definition at line 146 of file HeuristicSolver.h.
|
inline |
End iterator for the set of edges adjacent to the given node in the solver graph.
nId | Node id. |
Definition at line 155 of file HeuristicSolver.h.