MCPcopy Create free account
hub / github.com/Arash-codedev/openGA / crossover

Function crossover

examples/so-init-solutions/example_so-init-solutions.cpp:91–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91MySolution crossover(
92 const MySolution& X1,
93 const MySolution& X2,
94 const std::function<double(void)> &rnd01)
95{
96 MySolution X_new;
97 for(unsigned long i=0;i<X1.x.size();i++)
98 {
99 double r=rnd01();
100 X_new.x.push_back(r*X1.x[i]+(1.0-r)*X2.x[i]);
101 }
102 return X_new;
103}
104
105double calculate_SO_total_fitness(const GA_Type::thisChromosomeType &X)
106{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected