[jgap-users] IntegerGene.applyMutation correct/meaningful?
Brought to you by:
klausikm
From: Daniel S. <dan...@gm...> - 2010-08-24 14:07:59
|
Hi everyone, I just played around with this framework and found that the IntegerGene.applyMutation method is not really meaningfull - or do I just not understand it? Would not something like the following make more sense? greets, Daniel /** * Scales value uniformly, i.e. a_percentage of 1 sets the value to * the upper bound and all positive percentages scale linearly between * the current value and the upper bound. * Analogously for negative percentages. * @param a_index ignored (because there is only 1 atomic element) * @param a_percentage percentage of mutation (greater than -1 and smaller * than 1) * * @author Daniel Schreiber * @since 1.1 */ public void applyMutation(final int a_index, final double a_percentage) { int add; if(a_percentage >= 0) { add = (int) Math.round(((long) getUpperBounds() - (long) intValue()) * a_percentage); } else { add = (int) Math.round(((long) intValue() - (long) getLowerBounds()) * a_percentage); //negative! } setAllele(new Integer(intValue()+add)); } |