14 #ifndef LLVM_CODEGEN_PBQP_SOLUTION_H
15 #define LLVM_CODEGEN_PBQP_SOLUTION_H
29 typedef std::map<Graph::NodeId, unsigned> SelectionsMap;
30 SelectionsMap selections;
32 unsigned r0Reductions, r1Reductions, r2Reductions, rNReductions;
38 : r0Reductions(0), r1Reductions(0), r2Reductions(0), rNReductions(0) {}
42 unsigned numNodes()
const {
return selections.size(); }
76 selections[nodeId] = selection;
83 SelectionsMap::const_iterator sItr = selections.find(nodeId);
84 assert(sItr != selections.end() &&
"No selection for node.");
92 #endif // LLVM_CODEGEN_PBQP_SOLUTION_H
void recordR0()
Records a reduction via the R0 rule. Should be called from the solver only.
unsigned numR2Reductions() const
Returns the number of R2 reductions applied to solve the problem.
void recordR1()
Records a reduction via the R1 rule. Should be called from the solver only.
void recordRN()
Records a reduction via the RN rule. Should be called from the solver only.
unsigned getSelection(Graph::NodeId nodeId) const
Get a node's selection.
Solution()
Initialise an empty solution.
unsigned numR0Reductions() const
Returns the number of R0 reductions applied to solve the problem.
unsigned numNodes() const
Number of nodes for which selections have been made.
void setSelection(Graph::NodeId nodeId, unsigned selection)
Set the selection for a given node.
unsigned numRNReductions() const
Returns the number of RN reductions applied to solve the problem.
unsigned numR1Reductions() const
Returns the number of R1 reductions applied to solve the problem.
Represents a solution to a PBQP problem.
void recordR2()
Records a reduction via the R2 rule. Should be called from the solver only.