rushabhshah10 / opennero

Automatically exported from code.google.com/p/opennero
Other
0 stars 0 forks source link

Q-Learning team isn't loaded properly. #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Train Q-Learning team.
2. Save Q-Learning team.
3. Load Q-Learning team (you can see that it doesn't behave as it should).
4. Save Q-Learning team into other file.

What is the expected output? What do you see instead?
The size of second file should be no less than the size of first one.
The size of second file is less than the size of the first one.

What version of the product are you using? On what operating system?
OpenNERO revision 1527 on Windows 7 x64.

Please provide any additional information below.

There's a bug in source/ai/rl/approximator.h lines 119-120.

  for (iter = table.begin(); iter != table.end(); ++iter)
                ar & BOOST_SERIALIZATION_NVP(*iter);

Line 120 isn't executed on deserialization as table is empty.

Original issue reported on code.google.com by red75p...@gmail.com on 5 Dec 2011 at 2:25

GoogleCodeExporter commented 9 years ago
Leif?

Original comment by ikarpov on 5 Dec 2011 at 4:43

GoogleCodeExporter commented 9 years ago
Possible solution: implementation of unobtrusive serialization functions for 
unordered_map.

It requires further compatibility testing.

Original comment by red75p...@gmail.com on 5 Dec 2011 at 7:32

Attachments:

GoogleCodeExporter commented 9 years ago
The solution above doesn't fix a bug.

Original comment by red75p...@gmail.com on 5 Dec 2011 at 3:49

GoogleCodeExporter commented 9 years ago
related patch for boost 1.47:

https://svn.boost.org/trac/boost/ticket/5265

could we just save the number of entries in the map and then load each entry 
individually?

Original comment by ikarpov on 6 Dec 2011 at 10:44

GoogleCodeExporter commented 9 years ago
This looks relevant:

http://code.google.com/p/ntest/source/browse/unordered_map_serialization.h

Original comment by ikarpov on 6 Dec 2011 at 10:50

GoogleCodeExporter commented 9 years ago
the latest link does indeed seem to fix the problem - I am about to commit a 
fix.

Original comment by ikarpov on 6 Dec 2011 at 10:59

GoogleCodeExporter commented 9 years ago
r1537 should fix this problem. To test, save an RL team and observe the 
distribution of table sizes in the logs. It should be the same when you load.

Original comment by ikarpov on 6 Dec 2011 at 11:01

GoogleCodeExporter commented 9 years ago
Although I am new at OpenNero, I believe this last fix may have caused other 
issues.

Here comes my build log on a standard Ubuntu Oneiric 11.10.

[ 74%] Building CXX object source/CMakeFiles/OpenNERO.dir/ai/rl/TD.cpp.o
In file included from opennero/trunk/source/ai/rl/TD.cpp:12:0:
opennero/trunk/source/ai/rl/Approximator.h: In function ‘void 
boost::serialization::load(Archive&, boost::unordered_multimap<Key, Type, Hash, 
Compare, Allocator>&, unsigned int)’:
opennero/trunk/source/ai/rl/Approximator.h:104:17: error: 
‘archive_input_multimap’ is not a member of ‘boost::serialization::stl’
opennero/trunk/source/ai/rl/Approximator.h:104:17: error: 
‘archive_input_multimap’ is not a member of ‘boost::serialization::stl’
opennero/trunk/source/ai/rl/Approximator.h:101:40: error: parse error in 
template argument list
opennero/trunk/source/ai/rl/Approximator.h:110:17: error: expected 
primary-expression before ‘>’ token
make[2]: *** [source/CMakeFiles/OpenNERO.dir/ai/rl/TD.cpp.o] Error 1
make[1]: *** [source/CMakeFiles/OpenNERO.dir/all] Error 2
make: *** [all] Error 2

Original comment by sergiol...@gmail.com on 7 Dec 2011 at 12:41

GoogleCodeExporter commented 9 years ago
Hmm weird - I had already made the binaries on Lucid. What version of boost is 
installed on oneiric?

Original comment by ikarpov on 7 Dec 2011 at 1:25

GoogleCodeExporter commented 9 years ago
It looks like the problem is only in the serialization for multimap, which we 
are not using. So, removing it should allow you to build. See r1538.

Original comment by ikarpov on 7 Dec 2011 at 1:48