Skip to content
ml-recall

#one-point-crossover

1 question from Genetic Algorithms

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

hardAI-checkedGenetic Algorithms

This one-point crossover is adapted from aima-python:

import random

def recombine(x, y):
    n = len(x)
    c = random.randrange(0, n)    # c is one of 0, 1, ..., n - 1
    return x[:c] + y[c:]

For x = [1, 0, 1, 1, 0, 1] and y = [0, 0, 1, 0, 1, 1], how many distinct children can recombine(x, y) return?

a whole number