Is there a Design Pattern for Data Object structures that frequently change?
I am refactoring a Genetic Algorithm where the structure of the Chromosomes (number of genes, type of genes and boundary of genes) change from problem to problem. For example:
One problem may use
class Chromosome{
double gene1; // 0.0 < gene1 < 100.0
double gene2; // -7.3 < gene2 < 9.0
}
Another problem may use
class Chromosome{
int gene1; // 200 < gene1 < 1000
double gene2; // 50.0 < gene2
double gene3; // gene3 < -5.0
}
Currently the chromosome structure is hard coded and is difficult to modify for a new problem. I am considering modifying the Strategy Pattern for chromosome changes, unless someone has a better idea.
Aucun commentaire:
Enregistrer un commentaire