automatic commit
[universe.git] / intelligence.h
1
2 ////////////////////////////////////////////////////////////////////////////////
3 // This program is free software; you can redistribute it and/or              //
4 // modify it under the terms of the GNU General Public License                //
5 // version 2 as published by the Free Software Foundation.                    //
6 //                                                                            //
7 // This program is distributed in the hope that it will be useful, but        //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of                 //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          //
10 // General Public License for more details.                                   //
11 //                                                                            //
12 // Written and (C) by François Fleuret                                        //
13 // Contact <francois.fleuret@epfl.ch> for comments & bug reports              //
14 ////////////////////////////////////////////////////////////////////////////////
15
16 #include "map.h"
17 #include "approximer.h"
18 #include "manipulator.h"
19
20 class Intelligence {
21   int _nb_actions;
22   Map *_input;
23   Manipulator *_manipulator;
24   int _max_memory_tick, _memory_tick;
25   scalar_t *_memory, *_rewards;
26   int *_actions;
27   MappingApproximer **_q_predictors;
28   int _nb_weak_learners;
29 public:
30   Intelligence(Map *input, Manipulator *manipulator, int max_memory_tick, int nb_weak_learners);
31   ~Intelligence();
32   void load(istream &is);
33   void save(ostream &os);
34   void update(int last_action, scalar_t last_reward);
35   void save_memory(char *filename);
36   void load_memory(char *filename);
37   void learn(scalar_t proportion_for_training);
38   int best_action();
39 };