Cosmetics
This commit is contained in:
parent
2241407cc2
commit
be6c587cac
@ -113,7 +113,7 @@ public class MutateGAInvertBits implements InterfaceMutation, java.io.Serializab
|
|||||||
* @return description
|
* @return description
|
||||||
*/
|
*/
|
||||||
public static String globalInfo() {
|
public static String globalInfo() {
|
||||||
return "This mutation operator inverts n succesive bits.";
|
return "This mutation operator inverts n successive bits.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows you to set the number of mutations that occur in the
|
/** This method allows you to set the number of mutations that occur in the
|
||||||
|
@ -48,21 +48,21 @@ public class MutateOBGAFlip implements InterfaceMutation, java.io.Serializable {
|
|||||||
//nothing to init
|
//nothing to init
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mutate(AbstractEAIndividual individual) {
|
public void mutate(AbstractEAIndividual individual) {
|
||||||
|
|
||||||
int[][] perm = ( (InterfaceOBGAIndividual) individual).
|
int[][] perm = ( (InterfaceOBGAIndividual) individual).
|
||||||
getOBGenotype();
|
getOBGenotype();
|
||||||
for (int p = 0; p < perm.length; p++) {
|
for (int p = 0; p < perm.length; p++) {
|
||||||
for (int i = 0; i < times; i++) {
|
for (int i = 0; i < times; i++) {
|
||||||
int p1 = RNG.randomInt(0, perm[p].length - 1);
|
int p1 = RNG.randomInt(0, perm[p].length - 1);
|
||||||
int p2 = RNG.randomInt(0, perm[p].length - 1);
|
int p2 = RNG.randomInt(0, perm[p].length - 1);
|
||||||
int temp = perm[p][p1];
|
int temp = perm[p][p1];
|
||||||
perm[p][p1] = perm[p][p2];
|
perm[p][p1] = perm[p][p2];
|
||||||
perm[p][p2] = temp;
|
perm[p][p2] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
( (InterfaceOBGAIndividual) individual).SetOBGenotype(perm);
|
( (InterfaceOBGAIndividual) individual).SetOBGenotype(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows you to perform either crossover on the strategy parameters
|
/** This method allows you to perform either crossover on the strategy parameters
|
||||||
* or to deal in some other way with the crossover event.
|
* or to deal in some other way with the crossover event.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user