Beispiel #1
0
func (s *Siam) UniformX(mom, dad *Siam) {
	s.schema = mom.schema
	s.order = mom.order
	integer.UniformX(s.start[:], mom.start[:], dad.start[:])
	integer.UniformX(s.ordvec[:], mom.ordvec[:], dad.ordvec[:])
	integer.UniformX(s.breakvec[:], mom.breakvec[:], dad.breakvec[:])
}
Beispiel #2
0
func TestUniformX(t *testing.T) {
	mom := make([]int, 8)
	dad := make([]int, 8)
	for i := range mom {
		mom[i] = 1
	}
	for i := range dad {
		dad[i] = 2
	}
	child := make([]int, 8)
	integer.UniformX(child, mom, dad)
	for i := range child {
		if child[i] != mom[i] && child[i] != dad[i] {
			t.Fail()
		}
	}
}