MCPcopy Create free account
hub / github.com/davisking/dlib / policy

Class policy

dlib/control/approximate_linear_models.h:61–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 typename feature_extractor
60 >
61 class policy
62 {
63 public:
64
65 typedef feature_extractor feature_extractor_type;
66 typedef typename feature_extractor::state_type state_type;
67 typedef typename feature_extractor::action_type action_type;
68
69
70 policy (
71 )
72 {
73 w.set_size(fe.num_features());
74 w = 0;
75 }
76
77 policy (
78 const matrix<double,0,1>& weights_,
79 const feature_extractor& fe_
80 ) : w(weights_), fe(fe_) {}
81
82 action_type operator() (
83 const state_type& state
84 ) const
85 {
86 return fe.find_best_action(state,w);
87 }
88
89 const feature_extractor& get_feature_extractor (
90 ) const { return fe; }
91
92 const matrix<double,0,1>& get_weights (
93 ) const { return w; }
94
95
96 private:
97 matrix<double,0,1> w;
98 feature_extractor fe;
99 };
100
101 template < typename feature_extractor >
102 inline void serialize(const policy<feature_extractor>& item, std::ostream& out)

Callers 5

initializeMethod · 0.50
castFunction · 0.50
castMethod · 0.50
castMethod · 0.50
castMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected