Catching nulls in defaultInit(Problem)
This commit is contained in:
parent
5cda401398
commit
f08cd297ab
@ -253,7 +253,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
if (prob instanceof InterfaceHasInitRange && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange());
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange());
|
||||
else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range);
|
||||
}
|
||||
/**********************************************************************************************************************
|
||||
|
@ -300,7 +300,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
if (prob instanceof InterfaceHasInitRange && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange());
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange());
|
||||
else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range);
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
int[][] range = m_Range;
|
||||
if (prob instanceof InterfaceHasInitRange && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange();
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange();
|
||||
for (int i = 0; i < this.m_Genotype.length; i++) {
|
||||
this.m_Genotype[i] = RNG.randomInt(range[i][0], range[i][1]);
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
|
||||
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
double[][][] range = m_Range;
|
||||
if (prob instanceof InterfaceHasInitRange && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (double[][][])((InterfaceHasInitRange)prob).getInitRange();
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (double[][][])((InterfaceHasInitRange)prob).getInitRange();
|
||||
|
||||
for (int i = 0; i < this.m_Genotype.length; i++) {
|
||||
ESIndividualDoubleData.defaultInit(m_Genotype[i], range[i]);
|
||||
|
@ -273,7 +273,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
int[][] range = m_Range;
|
||||
if (prob instanceof InterfaceHasInitRange && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange();
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange();
|
||||
|
||||
for (int i = 0; i < this.m_Genotype.length; i++) {
|
||||
this.m_Genotype[i] = RNG.randomInt(range[i][0], range[i][1]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user