Ignore:
Timestamp:
11/13/08 22:37:07 (5 years ago)
Author:
wehart
Message:

Update to get the EAminlp building in scolib.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scolib/trunk/scolib/DomainOpsIntArray.h

    r5797 r5803  
    1818 
    1919#include <acro_config.h> 
     20#include <scolib/DomainOpsArray.h> 
     21#include <colin/BoundTypeArray.h> 
    2022#include <utilib/_math.h> 
    2123#include <utilib/Uniform.h> 
    22 #include <colin/BoundTypeArray.h> 
    23 #include <scolib/DomainOpsArray.h> 
    2424 
    2525#define INT_ARRAY_MUTATION_UNIFORM  1 
     
    2828namespace scolib { 
    2929 
    30 using utilib::ParameterSet; 
    31  
    3230template <class InfoT> 
    3331class DomainOpsIntArray : public DomainOpsArray<int, InfoT> 
     
    4240 
    4341  /// 
    44   DomainOpsIntArray(); 
     42  DomainOpsIntArray(utilib::OptionParser& option); 
    4543 
    4644  /// 
     
    105103 
    106104template <class InfoT> 
    107 DomainOpsIntArray<InfoT>::DomainOpsIntArray() 
     105DomainOpsIntArray<InfoT>::DomainOpsIntArray(utilib::OptionParser& option) 
    108106{ 
    109107this->crossover_blocksize=1; 
    110 ParameterSet::create_categorized_parameter("intarray_xover_blocksize", 
    111         this->crossover_blocksize, 
    112         "<int>","1", 
    113         "Block size used with array-based two-point and uniform crossover", 
    114         "Crossover"); 
     108option.add("intarray_xover_blocksize", this->crossover_blocksize, 
     109        "Block size used with array-based two-point and uniform crossover"); 
     110option.categorize("intarray_xover_blocksize","Crossover"); 
    115111 
    116112this->crossover_str="twopoint"; 
    117 ParameterSet::create_categorized_parameter("intarray_xover_type", 
    118         this->crossover_str, 
    119         "<string>","twopoint", 
    120         "Crossover type\n\ 
    121 \t  onepoint      - standard one-point mutation\n\ 
    122 \t  twopoint      - standard two-point mutation\n\ 
    123 \t  uniform       - standard uniform mutation", 
    124         "Crossover"); 
     113option.add("intarray_xover_type", this->crossover_str, 
     114"Crossover type\n\ 
     115    onepoint      - standard one-point mutation\n\ 
     116    twopoint      - standard two-point mutation\n\ 
     117    uniform       - standard uniform mutation"); 
     118option.categorize("intarray_xover_type","Crossover"); 
    125119 
    126120this->mutation_str = "uniform"; 
    127 ParameterSet::create_categorized_parameter("intarray_mutation_type", 
    128         this->mutation_str, 
    129         "<string>","uniform", 
    130         "Integer mutation type\n\ 
    131 \t  uniform  - replace the value with a uniformly random variable\n\ 
    132 \t  interval - replace the value with a uniform value in a local interval", 
    133         "Mutation"); 
     121option.add("intarray_mutation_type", this->mutation_str, 
     122"Integer mutation type\n\ 
     123    uniform  - replace the value with a uniformly random variable\n\ 
     124    interval - replace the value with a uniform value in a local interval"); 
     125option.categorize("intarray_mutation_type","Mutation"); 
    134126 
    135127this->mutation_range=1; 
    136 ParameterSet::create_categorized_parameter("intarray_mutation_range", 
    137         this->mutation_range, 
    138         "<int>","1", 
    139         "Range of mutation used for 'interval' mutation", 
    140         "Mutation"); 
     128option.add("intarray_mutation_range", this->mutation_range, 
     129        "Range of mutation used for 'interval' mutation"); 
     130option.categorize("intarray_mutation_range","Mutation"); 
    141131 
    142132this->mutate_independently=false; 
    143 ParameterSet::create_categorized_parameter("intarray_mutate_independently", 
    144         this->mutate_independently, 
    145         "<bool>","false", 
    146         "If true, then only mutate a single dimension.  Note that if this\n\ 
    147 \tvalue is true, then a single dimension is always mutated, so the\n\ 
    148 \tmutation allele rate is ignored.", 
    149         "Mutation"); 
     133option.add("intarray_mutate_independently", this->mutate_independently, 
     134        "If true, then only mutate a single dimension.  Note that if this value is true, then a single dimension is always mutated, so the mutation allele rate is ignored."); 
     135option.categorize("intarray_mutate_independently","Mutation"); 
    150136 
    151137this->mutation_allele_rate=1.0; 
    152 ParameterSet::create_categorized_parameter("intarray_mutation_allele_rate", 
    153         this->mutation_allele_rate, 
    154         "<double>","1.0", 
    155         "The probability that any given dimension of the intarray is mutated\n\tgiven that the individual is mutated", 
    156         "Mutation"); 
     138option.add("intarray_mutation_allele_rate", this->mutation_allele_rate, 
     139        "The probability that any given dimension of the intarray is mutated given that the individual is mutated"); 
     140option.categorize("intarray_mutation_allele_rate","Mutation"); 
    157141} 
    158142 
Note: See TracChangeset for help on using the changeset viewer.