Deleted Added
full compact
Solution.h (256281) Solution.h (263508)
1//===-- Solution.h ------- PBQP Solution ------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 12 unchanged lines hidden (view full) ---

21namespace PBQP {
22
23 /// \brief Represents a solution to a PBQP problem.
24 ///
25 /// To get the selection for each node in the problem use the getSelection method.
26 class Solution {
27 private:
28
1//===-- Solution.h ------- PBQP Solution ------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 12 unchanged lines hidden (view full) ---

21namespace PBQP {
22
23 /// \brief Represents a solution to a PBQP problem.
24 ///
25 /// To get the selection for each node in the problem use the getSelection method.
26 class Solution {
27 private:
28
29 typedef std::map<Graph::ConstNodeItr, unsigned,
30 NodeItrComparator> SelectionsMap;
29 typedef std::map<Graph::NodeId, unsigned> SelectionsMap;
31 SelectionsMap selections;
32
33 unsigned r0Reductions, r1Reductions, r2Reductions, rNReductions;
34
35 public:
36
37 /// \brief Initialise an empty solution.
38 Solution()

--- 27 unchanged lines hidden (view full) ---

66 /// \brief Records a reduction via the RN rule. Should be called from the
67 /// solver only.
68 void recordRN() { ++ rNReductions; }
69
70 /// \brief Returns the number of RN reductions applied to solve the problem.
71 unsigned numRNReductions() const { return rNReductions; }
72
73 /// \brief Set the selection for a given node.
30 SelectionsMap selections;
31
32 unsigned r0Reductions, r1Reductions, r2Reductions, rNReductions;
33
34 public:
35
36 /// \brief Initialise an empty solution.
37 Solution()

--- 27 unchanged lines hidden (view full) ---

65 /// \brief Records a reduction via the RN rule. Should be called from the
66 /// solver only.
67 void recordRN() { ++ rNReductions; }
68
69 /// \brief Returns the number of RN reductions applied to solve the problem.
70 unsigned numRNReductions() const { return rNReductions; }
71
72 /// \brief Set the selection for a given node.
74 /// @param nItr Node iterator.
75 /// @param selection Selection for nItr.
76 void setSelection(Graph::NodeItr nItr, unsigned selection) {
77 selections[nItr] = selection;
73 /// @param nodeId Node id.
74 /// @param selection Selection for nodeId.
75 void setSelection(Graph::NodeId nodeId, unsigned selection) {
76 selections[nodeId] = selection;
78 }
79
80 /// \brief Get a node's selection.
77 }
78
79 /// \brief Get a node's selection.
81 /// @param nItr Node iterator.
82 /// @return The selection for nItr;
83 unsigned getSelection(Graph::ConstNodeItr nItr) const {
84 SelectionsMap::const_iterator sItr = selections.find(nItr);
80 /// @param nodeId Node id.
81 /// @return The selection for nodeId;
82 unsigned getSelection(Graph::NodeId nodeId) const {
83 SelectionsMap::const_iterator sItr = selections.find(nodeId);
85 assert(sItr != selections.end() && "No selection for node.");
86 return sItr->second;
87 }
88
89 };
90
91}
92
93#endif // LLVM_CODEGEN_PBQP_SOLUTION_H
84 assert(sItr != selections.end() && "No selection for node.");
85 return sItr->second;
86 }
87
88 };
89
90}
91
92#endif // LLVM_CODEGEN_PBQP_SOLUTION_H