bradleyTerry.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bradleyTerry.h
Go to the documentation of this file.
1 /* bradleyTerry.h
2 */
3 #ifndef _BRADLEYTERRY_H
4 #define _BRADLEYTERRY_H
5
6 #include "osl/rating/featureSet.h"
7 #include <valarray>
8
9 namespace osl
10 {
11 namespace rating
12 {
13 class BradleyTerry
14 {
15 typedef std::valarray<double> valarray_t;
16 FeatureSet& features;
17
18 std::string kisen_filename, output_directory;
19 int kisen_start;
20 size_t num_cpus, num_records;
21 int verbose;
22 int fix_group;
23 size_t min_rating;
24 public:
25 BradleyTerry(FeatureSet& features, const std::string& kisen_file, int kisen_start=0);
26 ~BradleyTerry();
27
28 void setNumCpus(int new_num_cpus) { num_cpus = new_num_cpus; };
29 void setNumRecords(size_t new_num_records) { num_records = new_num_records; };
30 void setOutputDirectory(const std::string& new_output) { output_directory = new_output; };
31 void setFixGroup(int new_fix_group) { fix_group = new_fix_group; };
32 void setVerbose(int new_verbose) { verbose = new_verbose; };
33 void setMinRating(int new_min) { min_rating = new_min; };
34
35 void iterate();
36 private:
37 void update(size_t g);
38 bool addSquare(size_t g, const NumEffectState& state,
39 const RatingEnv& env, Move selected,
40 valarray_t& wins, std::valarray<long double>& denominator) const;
41
42 class Thread;
43 friend class Thread;
44 size_t accumulate(size_t g, size_t first, size_t last, valarray_t& wins, std::valarray<long double>& denominator) const;
45 };
46 }
47 }
48
49 #endif /* _BRADLEYTERRY_H */
50 // ;;; Local Variables:
51 // ;;; mode:c++
52 // ;;; c-basic-offset:2
53 // ;;; End: