| Modifier and Type | Method and Description |
|---|---|
void |
concoct(Genome genericTarget,
double[] r,
Genome[] genomes)
Sets the genes in the current genome to values that are a weighted
average of three supplied genomes.
|
static MonochromeTriangler |
getInstance() |
public static MonochromeTriangler getInstance()
public void concoct(Genome genericTarget, double[] r, Genome[] genomes)
procedure Concoct (r1, r2, r3: real; a, b, c: person; var new: person);
var
j, weight: Integer;
begin
with new do
begin
SegNoGene := round(r1 * a.SegNoGene + r2 * b.SegNoGene + r3 * c.SegNoGene);
if SegNoGene < 1 then
SegNoGene := 1;
SegDistGene := round(r1 * a.SegDistGene + r2 * b.SegDistGene + r3 * c.SegDistGene);
CompletenessGene := CompletenessType(Force2(r1 * Integer(a.CompletenessGene) + r2 * Integer(b.CompletenessGene) + r3 * Integer(c.CompletenessGene)));
SpokesGene := SpokesType(Force3(r1 * Integer(a.SpokesGene) + r2 * Integer(b.SpokesGene) + r3 * Integer(c.SpokesGene)));
for j := 1 to 9 do
gene[j] := round(r1 * a.gene[j] + r2 * b.gene[j] + r3 * c.gene[j]);
SizeWorry := SegNoGene * TwoToThe(gene[9]);
if SizeWorry > WorryMax then
Gene[9] := Gene[9] - 1;
if gene[9] < 1 then
gene[9] := 1;
tricklegene := round(r1 * a.tricklegene + r2 * b.tricklegene + r3 * c.tricklegene);
MutSizeGene := round(r1 * a.MutSizeGene + r2 * b.MutSizeGene + r3 * c.MutSizeGene);
MutProbGene := round(r1 * a.MutProbGene + r2 * b.MutProbGene + r3 * c.MutProbGene);
if mutprobgene < 1 then
mutprobgene := 1;
if mutprobgene > 100 then
mutprobgene := 100;
for j := 1 to 10 do
dgene[j] := swelltype(Force3(r1 * Integer(a.dgene[j]) + r2 * Integer(b.dgene[j]) + r3 * Integer(c.dgene[j])));
end
end; {concoct}