a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
BalancedPartitionCandidate.hpp
Go to the documentation of this file.
1/*
2 * BalancedPartitionCandidate.hpp
3 *
4 * Created on: Jul 12, 2012
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 *
7 * This file is part of BOLlib, released under the
8 * GNU General Public License. Please see the accompanying
9 * README.BOLlib.txt file for a full list of files, brief documentation
10 * on how to use these classes, and further details on the license.
11 */
12
13#ifndef BALANCEDPARTITIONCANDIDATE_HPP_
14#define BALANCEDPARTITIONCANDIDATE_HPP_
15
16#include <vector>
17#include <list>
18#include "UsefulStuff.hpp"
19#include "VectorlikeArray.hpp"
20
21namespace BOL
22{
23 // this class is used by the BalancedPartitioner class to hold candidates for
24 // the partition.
26 {
27 public:
30
31 void
32 buildFrom( BalancedPartitionCandidate const& basePartition,
33 unsigned int const extraIndex,
34 double const candidateWeight,
35 double const inverseWeight );
36 // this sets up this BalancedPartitionCandidate to be
37 // basePartition + extraIndex, using the given weights (rather than
38 // working them out itself).
39
40 std::vector< unsigned int >&
41 getVector();
42 double
43 getWeight() const;
44 void
45 setWeight( double const candidateWeight );
46 double
47 getInverseWeight() const;
48 void
49 setInverseWeight( double const inverseWeight );
50
51
52 protected:
53 std::vector< unsigned int > indexVector;
56 };
57
58
59
60
61
62 inline void
64 BalancedPartitionCandidate const& basePartition,
65 unsigned int const extraIndex,
66 double const candidateWeight,
67 double const inverseWeight )
68 // this sets up this BalancedPartitionCandidate to be
69 // basePartition + extraIndex, using the given weights (rather than working
70 // them out itself).
71 {
72 indexVector = basePartition.indexVector;
73 indexVector.push_back( extraIndex );
74 this->candidateWeight = candidateWeight;
75 this->inverseWeight = inverseWeight;
76 }
77
78 inline std::vector< unsigned int >&
80 {
81 return indexVector;
82 }
83
84 inline double
86 {
87 return candidateWeight;
88 }
89
90 inline void
91 BalancedPartitionCandidate::setWeight( double const candidateWeight )
92 {
93 this->candidateWeight = candidateWeight;
94 }
95
96 inline double
98 {
99 return inverseWeight;
100 }
101
102 inline void
104 {
105 this->inverseWeight = inverseWeight;
106 }
107
108}
109
110#endif /* BALANCEDPARTITIONCANDIDATE_HPP_ */
void setWeight(double const candidateWeight)
void buildFrom(BalancedPartitionCandidate const &basePartition, unsigned int const extraIndex, double const candidateWeight, double const inverseWeight)
void setInverseWeight(double const inverseWeight)
std::vector< unsigned int > & getVector()