Could you specify the problem a bit more?
At which place (class.method) do you think is isValid(..)
not evaluated correctly?
One general thing is that the supergene cannot ensure in
any case that a valid state is kept. Just image what would
happen if there were only very few valid states or no valid
ones at all: The application would sow down enormously or
being captured in an endless loop.
Thanx for your feedback :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
on JGAP 2.5 it works well and generates a supergene where
n2 > n1 > n3, but fails in JGAP 2.6.
Other helpfully code that creates conditions of sample
supergene:
[code]
List <Gene> sampleGenes = new LinkedList<Gene>();
sampleGenes.add(new MySupergene (
new Gene[] {
new IntegerGene(3, 32),
new IntegerGene(3, 64),
new IntegerGene(2, 16)
}
));
[/code]
What you could do is look at class AbstractSupergene,
method applyMutation(..).
There, three lines of code have been commented out because
of the reason I mentioned in my previous reply. You could
reactivate those lines and see what happens.
If that helps, we should add an option to switch that piece
of code on or off.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I still use the 2.5 version of JGAP. But I have just
looked at applyMutation(...) function of 2.6 JGAP and I
think that increase of MAX_RETRIES constant will resolve
the problem.
Defalt it is set to 1 and for that our overloaded function
isValid(...) should always return true.
Sometimes we need a gene whose values (alleles) are burden
by several constraints and the probability of return valid
gene by isValid(...) function is decrease drastically.
Thx for good job, Klaus.
Dawid
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=722855
Could you specify the problem a bit more?
At which place (class.method) do you think is isValid(..)
not evaluated correctly?
One general thing is that the supergene cannot ensure in
any case that a valid state is kept. Just image what would
happen if there were only very few valid states or no valid
ones at all: The application would sow down enormously or
being captured in an endless loop.
Thanx for your feedback :-)
Logged In: YES
user_id=1317896
I prepared that supergene:
[code]
public static class MySupergene extends
AbstractSupergene {
private static final long
serialVersionUID = -1209876093698252823L;
/* It is important to provide
these two constructors: */
public MySupergene() {}
public MySupergene( Gene[]
a_genes )
{
super(a_genes);
}
@Override
public boolean isValid(Gene[]
genes, Supergene arg1) {
int n1 = ((IntegerGene)
genes[0]).intValue();
int n2 = ((IntegerGene)
genes[1]).intValue();
int n3 = ((IntegerGene)
genes[2]).intValue();
//System.out.println
(n1.getAllele() + " " + n2.getAllele() + " " + n3.getAllele
());
return n1 < n2 && n1 > n3;
}
}
[/code]
on JGAP 2.5 it works well and generates a supergene where
n2 > n1 > n3, but fails in JGAP 2.6.
Other helpfully code that creates conditions of sample
supergene:
[code]
List <Gene> sampleGenes = new LinkedList<Gene>();
sampleGenes.add(new MySupergene (
new Gene[] {
new IntegerGene(3, 32),
new IntegerGene(3, 64),
new IntegerGene(2, 16)
}
));
[/code]
Related
Code: code
Logged In: YES
user_id=722855
What you could do is look at class AbstractSupergene,
method applyMutation(..).
There, three lines of code have been commented out because
of the reason I mentioned in my previous reply. You could
reactivate those lines and see what happens.
If that helps, we should add an option to switch that piece
of code on or off.
Logged In: YES
user_id=722855
Dawid,
I close the bug herewith. If you still have an open issue,
please let me know.
Best
Klaus
Logged In: YES
user_id=722855
Closed
Logged In: YES
user_id=1317896
I still use the 2.5 version of JGAP. But I have just
looked at applyMutation(...) function of 2.6 JGAP and I
think that increase of MAX_RETRIES constant will resolve
the problem.
Defalt it is set to 1 and for that our overloaded function
isValid(...) should always return true.
Sometimes we need a gene whose values (alleles) are burden
by several constraints and the probability of return valid
gene by isValid(...) function is decrease drastically.
Thx for good job, Klaus.
Dawid