Question
Give C/C++ code that calculates the offspring of two children for a max ones simulation. The crossover should be a one-point crossover, at a randomly
Give C/C++ code that calculates the offspring of two children for a max ones simulation. The crossover should be a one-point crossover, at a randomly determined point in the chromosome. The length of the chromosome and the two parents are given. The children should be placed *offspringOne and *offspringTwo pointers that are passed to the function. The template follows:
void crossover( int parentOne, int parentTwo, int* offspringOne, int* );
Tip: Assume that fitness and chance of crossover (pc) has already been done; and that random() has been initialized and necessary libraries included. Just place the children into the pointers, do not calculate their fitness
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started