[galib] An unconstrained gene
Peter Jay Salzman
p at dirac.org
Fri Nov 23 14:47:35 EST 2007
I have a genome with three genes: x, y, z. I'd like the constraints on
these genes to be:
x = [0, 1.1]
y = (2, 4.5]
z is unconstrained
I understand how to do x, and y:
alleles.add(0.0, 1.1, GAAllele::INCLUSIVE, GAAllele::INCLUSIVE); // x
alleles.add(-2.0, 4.5, GAAllele::EXCLUSIVE, GAAllele::INCLUSIVE); // y
// Note: GARealGenome takes either a length and allele set, or just an
// allele set array.
GARealGenome genome(alleles, objective);
But how do I leave the 3rd gene unconstrained? In the above code, there are
only 2 genes (I think the length of the genome is determined by the number
of alleles in the GARealAlleleSetArray, which is 2).
I tried adding:
alleles.add( -FLT_MAX, FLT_MAX, GAAllele::EXCLUSIVE, GAAllele::EXCLUSIVE );
but that wreaks havoc; the solutions turn out wrong and the 3rd gene is inf.
Is there a way of leaving the 3rd gene unconstrained?
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
Last night I dreamt of 09-f9-11-02-9d-74-e3-5b-d8-41-56-c5-63-56-88-c0
"A mathematician is a machine for converting coffee p at dirac.org
into theorems." -- Paul Erdös http://www.dirac.org
More information about the galib