great, I've started reading your code and noticed an error in the
comment of generate_contin_neighbor:
* It generates the contin neighbor with the haming distance from
* the given instance.For examples, if the contin[it.idx()] is encoded
* with depth = 4,like (L R S S), so the neighbors with distance = 1 of it
* are (R L S S), (L L S S),(L R L S) and (L R R S). And we randomly chose
* one of them to return.
(R L S S) is not at distance 1 of (L R S S) but at distance 2, instead
it should be (L S S S) (that is probably a typo).
Oh, it is my fault. hmm, according to the currently implementation, the situation of (L S S S)
is not considered.Well, It should be added later.
You will also need to update generate_all_in_neighborhood, eventually.
Also, I think you should remove completely the functions:
template<typename Out>
void sample_from_neighborhood(const eda::field_set& fs, int n,
int sample_size, Out out, opencog::RandGen& rng)
and
template<typename Out>
void generate_all_in_neighborhood(const eda::field_set& fs, int n, Out out)
That are the versions without instance (center) in input, and update
moses so that it uses the ones taking an instance in input, because
now that contin is introduced, we cannot assume that a deme exemplar
has all its knobs set to 0.
BTW, as the neighborhood sampling code start to be bigger I think it
would make sense to move it to another file, say
neighborhood_sampling.h
And finally, please rebase your code and use OC_ASSERT(...) instead of
opencog::cassert(TRACE_INFO, ...).
Thanks!
Nil