Cody

Solution 245496

Submitted on 16 May 2013 by Claudio Gelmi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% mask = [1 0 0 0 1 1 1 0 0]; parent1 = [0 0 0 1 1 1 0 0 0]; parent2 = [1 1 0 0 1 0 1 1 0]; children = [0 1 0 0 1 1 0 1 0;1 0 0 1 1 0 1 0 0]; assert(isequal(uniform_crossover(mask,parent1,parent2),children))
2   Pass
%% mask = 1; parent1 = 1; parent2 = 0; children = [1;0]; assert(isequal(uniform_crossover(mask,parent1,parent2),children))
3   Pass
%% mask = 1; parent1 = 1; parent2 = 0; children = [1;0]; assert(isequal(uniform_crossover(mask,parent1,parent2),children))
4   Pass
%% mask = [1 1 1 0 1 0 1 1 0 0 0 0 0 1 0]; parent1 = [0 1 1 1 1 0 0 0 0 1 0 0 1 0 1]; parent2 = [0 1 1 0 1 0 1 0 1 0 1 1 0 1 1]; children = [0 1 1 0 1 0 0 0 1 0 1 1 0 0 1;0 1 1 1 1 0 1 0 0 1 0 0 1 1 1] assert(isequal(uniform_crossover(mask,parent1,parent2),children))
children = 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 0 1 0 0 1 1 1