示例#1
0
			size_t crossover(const sequence_type& a, const sequence_type& b, ea::IOutputAdapter<sequence_type>& output) override
			{
				sequence_len_t separator;

				assert(_base.len(a) >= 4);
				assert(_base.len(a) < std::numeric_limits<int32_t>::max());

				separator = _rnd->get_int32(1, _base.len(a) - 3);

				output.push(create_child(a, b, separator));
				output.push(create_child(b, a, separator));

				return 2;
			}
示例#2
0
    size_t crossover(const sequence_type& a, const sequence_type& b, ea::IOutputAdapter<sequence_type>& output) override
    {
        sequence_len_t offset0;
        sequence_len_t offset1;

        assert(_base.len(a) >= 5);
        assert(_base.len(a) < std::numeric_limits<int32_t>::max());

        offset0 = _rnd->get_int32(1, _base.len(a) - 3);

        assert(_base.len(b) > offset0 + 2);
        assert(_base.len(b) < std::numeric_limits<int32_t>::max());

        offset1 = _rnd->get_int32(offset0 + 1, _base.len(b) - 1);

        output.push(create_child(b, a, offset0, offset1));
        output.push(create_child(a, b, offset0, offset1));

        return 2;
    }