Menu

#23 Supergen isValid condition does not checked

next JGAP version
closed-works-for-me
Klaus
5
2006-05-01
2006-04-21
No

On version 2.6 of JGAP a return of a function:
public boolean isValid(Gene [] genes, Supergene s)
is probably not checked.

It might generate a supergen with undesirable values.

Discussion

  • Klaus

    Klaus - 2006-04-22

    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 :-)

     
  • Dawid Marcin Grzesiak

    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

  • Klaus

    Klaus - 2006-04-22

    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.

     
  • Klaus

    Klaus - 2006-05-01
    • assigned_to: nobody --> klausikm
    • status: open --> open-works-for-me
     
  • Klaus

    Klaus - 2006-05-01

    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

     
  • Klaus

    Klaus - 2006-05-01

    Logged In: YES
    user_id=722855

    Closed

     
  • Klaus

    Klaus - 2006-05-01
    • status: open-works-for-me --> closed-works-for-me
     
  • Dawid Marcin Grzesiak

    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

     

Log in to post a comment.

MongoDB Logo MongoDB