Last change
on this file since 145 was
145,
checked in by sz, 11 years ago
|
Genetics reorganization (affects ALL applications!):
- Converters/Validators? are now configured/initialized in a more verbose but also less confusing way
- At the same time, the PreconfiguredGenetics? object will help you avoid the increased complexity by creating the ready-to-use environment that is sufficient in 99% of cases (see the demos)
- Format F genetics updated (work in progress)
|
-
Property svn:eol-style set to
native
|
File size:
1.4 KB
|
Line | |
---|
1 | #ifndef _PRECONFIGURED_GENETICS_H_ |
---|
2 | #define _PRECONFIGURED_GENETICS_H_ |
---|
3 | |
---|
4 | #include "genman.h" |
---|
5 | #include "defgenoconv.h" |
---|
6 | |
---|
7 | /** This class handles a typical initialization procedure and configuration of genetics: |
---|
8 | - adds converters between genetic formats as configured by gen-config.h, |
---|
9 | - validation of genotypes by dedicated genetic operators, or by conversion to f0 if no genetic operator is found that can validate a genotype. |
---|
10 | */ |
---|
11 | class PreconfiguredGenetics |
---|
12 | { |
---|
13 | public: |
---|
14 | DefaultGenoConvManager gcm; |
---|
15 | GenMan genman; |
---|
16 | ModelGenoValidator model_validator; //validation through conversion |
---|
17 | |
---|
18 | PreconfiguredGenetics() |
---|
19 | { |
---|
20 | gcm.addDefaultConverters(); //without converters, the application would only handle "format 0" genotypes |
---|
21 | Geno::useConverters(gcm); |
---|
22 | |
---|
23 | Geno::addValidator(&genman); //primary validation: use the extended validity checking (through dedicated genetic operators) |
---|
24 | Geno::addValidator(&model_validator); //secondary validation: this simple validator handles all cases when there is no dedicated genetic validation operator, but a converter for a particular format is available. Converters may be less strict in detecting invalid genotypes but using them and checking whether they produced a valid f0 genotype is also some way to tell whether the initial genotype was valid. Otherwise, without dedicated genetic validation operator, we would have no validity check at all. |
---|
25 | } |
---|
26 | }; |
---|
27 | |
---|
28 | #endif |
---|
29 | |
---|
Note: See
TracBrowser
for help on using the repository browser.