if(ind instanceof InstructionGene){
copy.add(((InstructionGene)ind).clone());
}else if(ind instanceof StackInstructionGene){
copy.add(((StackInstructionGene)ind).clone());
}else if(ind instanceof IntegerGene){
IntegerGene c = (IntegerGene)ind;
IntegerGene n = null;
try {
n = new IntegerGene(ind.getConfiguration(), c.getLowerBounds(), c.getUpperBounds());
} catch (InvalidConfigurationException ex) {
Logger.getLogger(RandomMutationHillClimbingSearch.class.getName()).log(Level.SEVERE, null, ex);
}
n.setAllele(c.intValue());
copy.add(n);
}else{
throw new RuntimeException(String.format("Can't make a clone of gene of type %s object is: %s ",ind.getClass().toString(), ind));
}