My Project
move_probability/featureSet.h
Go to the documentation of this file.
1/* featureSet.h
2 */
3#ifndef OSL_MOVE_PROBABILITY_FEATURESET_H
4#define OSL_MOVE_PROBABILITY_FEATURESET_H
5
9#include <boost/ptr_container/ptr_vector.hpp>
10#include <boost/scoped_array.hpp>
11#include <vector>
12
13namespace osl
14{
15 namespace move_probability
16 {
17 class Feature;
18 typedef std::pair<double,Move> WeightedMove;
20
22 {
23 boost::ptr_vector<Feature> features;
24 std::vector<int> offsets, light_features;
25 protected:
26 FeatureSet();
27 public:
29 void pushBack(Feature *, bool light=false);
30 void addFinished();
31 int dimension() const { return offsets.back(); }
32 public:
33 double matchExp(const StateInfo&, Move, const double *weights) const;
34 double matchNoExp(const StateInfo&, Move, const double *weights) const;
35 void generateLogProb(const StateInfo& state,
36 MoveLogProbVector& out, const double *weights) const;
37 double matchLight(const StateInfo&, Move, const double *weights) const;
38
39 bool load(const char *base_filename, double *weights) const;
40 bool load_binary(const char *base_filename, double *weights) const;
41 void showSummary(const double *weights) const;
42 void analyze(const StateInfo& state, Move move, const double *weights) const;
43 // for fine control
44 double generateRating(const StateInfo& state,
45 WeightedMoveVector& out, const double *weights) const;
46 static void ratingToLogProb(const WeightedMoveVector& rating,
47 double sum, MoveLogProbVector& out);
48 };
49
51 {
52 static boost::scoped_array<double> weights, tactical_weights;
54 public:
57
58 static const StandardFeatureSet& instance(bool verbose=false);
59 static bool healthCheck();
60 void generateLogProb(const StateInfo& state, MoveLogProbVector& out) const;
61 void generateLogProb2(const StateInfo& state, MoveLogProbVector& out) const;
62 void generateLogProb(const StateInfo& state, int limit, MoveLogProbVector& out, bool in_pv) const;
63 int logProbTakeBack(const StateInfo& state, Move target) const;
64 int logProbSeePlus(const StateInfo& state, Move target) const;
65 double matchLight(const StateInfo&, Move) const;
66 double matchExp(const StateInfo&, Move) const;
67 double matchNoExp(const StateInfo&, Move) const;
68 bool setUp(bool verbose=false);
69 bool ok() const { return initialized; }
70 private:
71 int tacticalLogProb(int offset, double sum) const;
72 };
73 }
74}
75#endif /* OSL_MOVE_PROBABILITY_FEATURESET_H */
76// ;;; Local Variables:
77// ;;; mode:c++
78// ;;; c-basic-offset:2
79// ;;; End:
圧縮していない moveの表現 .
double generateRating(const StateInfo &state, WeightedMoveVector &out, const double *weights) const
double matchExp(const StateInfo &, Move, const double *weights) const
double matchNoExp(const StateInfo &, Move, const double *weights) const
void generateLogProb(const StateInfo &state, MoveLogProbVector &out, const double *weights) const
bool load_binary(const char *base_filename, double *weights) const
double matchLight(const StateInfo &, Move, const double *weights) const
void analyze(const StateInfo &state, Move move, const double *weights) const
bool load(const char *base_filename, double *weights) const
void showSummary(const double *weights) const
static void ratingToLogProb(const WeightedMoveVector &rating, double sum, MoveLogProbVector &out)
void pushBack(Feature *, bool light=false)
static boost::scoped_array< double > tactical_weights
void generateLogProb(const StateInfo &state, MoveLogProbVector &out) const
static boost::scoped_array< double > weights
int logProbTakeBack(const StateInfo &state, Move target) const
void generateLogProb2(const StateInfo &state, MoveLogProbVector &out) const
int logProbSeePlus(const StateInfo &state, Move target) const
static const StandardFeatureSet & instance(bool verbose=false)
double matchLight(const StateInfo &, Move) const
double matchExp(const StateInfo &, Move) const
int tacticalLogProb(int offset, double sum) const
double matchNoExp(const StateInfo &, Move) const
std::pair< double, Move > WeightedMove
FixedCapacityVector< WeightedMove, Move::MaxUniqMoves > WeightedMoveVector