1 /* ///////////////////////////////////////////////////////////////////////
2 * File: fopti_ga_config.h
7 * Brief: The fopti_ga_config class
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_INTELLIGENCE_FOPTI_GA_CONFIG_H
14 #define EXTL_INTELLIGENCE_FOPTI_GA_CONFIG_H
16 /*!\file fopti_ga_config.h
17 * \brief The fopti_ga_config class
20 # error fopti_ga_config.h need be supported by c++.
23 /* ///////////////////////////////////////////////////////////////////////
27 #include "fopti_individual.h"
28 #include "fopti_crossover_traits.h"
29 #include "fopti_mutation_traits.h"
30 #include "fopti_rmake_traits.h"
31 #include "fopti_fitness_traits.h"
32 #include "fopti_penalty_traits.h"
35 /* ///////////////////////////////////////////////////////////////////////
36 * ::extl::intelligence namespace
38 EXTL_INTELLIGENCE_BEGIN_WHOLE_NAMESPACE
40 /*!\brief fopti_ga_config class
42 * \param for_max Set \true for maximum
43 * \param Func The function type
45 * \ingroup extl_group_intelligence
47 template< e_bool_t for_max
48 , typename_param_k Func
50 struct fopti_test_ga_config
53 /// \name The Configuration Types
56 /// The function type - fopti
57 typedef Func func_type
;
59 /// The random type - basic
60 typedef linear_rand random_type
;
62 /// The population type - basic
63 #if EXTL_WORKAROUND_BORLAND(==, 0x551)
64 typedef population
<fopti_individual
<(func_type::param_num
)> > population_type
;
66 typedef population
<fopti_individual
<func_type::param_num
> > population_type
;
69 /// The rmake_traits type - basic
70 typedef fopti_rmake_traits
< population_type
74 /// The fitness_traits type - basic
75 typedef fopti_fitness_traits
< for_max
77 , fopti_penalty_traits
< typename_type_k
population_type::individual_type
81 > fitness_traits_type
;
83 /// The stop_traits type - basic
84 typedef external_minimal_residual_stop_traits
<population_type
, 64> stop_traits_type
;
86 /// The selection_traits type - basic
87 typedef roulette_wheel_selection_traits
< population_type
89 , rank_based_probability_traits
<population_type
, 30>
90 > selection_traits_type
;
92 /*typedef roulette_wheel_selection_traits < population_type
94 , proportional_probability_traits<population_type>
95 > selection_traits_type;*/
97 /*typedef tournament_selection_traits < population_type
99 > selection_traits_type;*/
101 /// The crossover_traits type - fopti
102 typedef middle_recombination_crossover_traits
< population_type
104 > crossover_traits_type
;
107 /*typedef discrete_recombination_crossover_traits < population_type
109 > crossover_traits_type;*/
111 /*typedef linear_recombination_crossover_traits < population_type
113 > crossover_traits_type;*/
115 /// The mutation_traits type - fopti
116 typedef fopti_mutation_traits
< population_type
118 > mutation_traits_type
;
120 /// The cross_p_traits type - basic
121 typedef adaptive_cross_p_traits
<population_type
> cross_p_traits_type
;
123 //typedef simple_cross_p_traits<population_type> cross_p_traits_type;
125 /// The mutate_p_traits type - basic
126 typedef adaptive_mutate_p_traits
<population_type
> mutate_p_traits_type
;
128 //typedef simple_mutate_p_traits<population_type> mutate_p_traits_type;
130 /// The local_search_traits type - basic
131 /*typedef no_local_search_traits < population_type
134 , fitness_traits_type
135 > local_search_traits_type;*/
137 typedef simulated_annealing_local_search_traits
< population_type
140 , fitness_traits_type
141 > local_search_traits_type
;
143 /*typedef hill_climbing_local_search_traits < population_type
146 , fitness_traits_type
147 > local_search_traits_type;*/
152 template< e_bool_t for_max
153 , typename_param_k Func
155 struct fopti_simple_ga_config
158 /// \name The Configuration Types
161 /// The function type - fopti
162 typedef Func func_type
;
164 /// The random type - basic
165 typedef linear_rand random_type
;
167 /// The population type - basic
168 #if EXTL_WORKAROUND_BORLAND(==, 0x551)
169 typedef population
<fopti_individual
<(func_type::param_num
)> > population_type
;
171 typedef population
<fopti_individual
<func_type::param_num
> > population_type
;
174 /// The rmake_traits type - basic
175 typedef fopti_rmake_traits
< population_type
179 /// The fitness_traits type - basic
180 typedef fopti_fitness_traits
< for_max
182 , fopti_penalty_traits
< typename_type_k
population_type::individual_type
186 > fitness_traits_type
;
188 /// The stop_traits type - basic
189 typedef external_minimal_residual_stop_traits
<population_type
, 64> stop_traits_type
;
191 /// The selection_traits type - basic
192 typedef roulette_wheel_selection_traits
< population_type
194 , proportional_probability_traits
<population_type
>
195 > selection_traits_type
;
196 /*typedef tournament_selection_traits < population_type
198 > selection_traits_type;*/
200 /// The crossover_traits type - fopti
201 typedef middle_recombination_crossover_traits
< population_type
203 > crossover_traits_type
;
204 /*typedef discrete_recombination_crossover_traits < population_type
206 > crossover_traits_type;*/
208 /*typedef linear_recombination_crossover_traits < population_type
210 > crossover_traits_type;*/
212 /// The mutation_traits type - fopti
213 typedef fopti_mutation_traits
< population_type
215 > mutation_traits_type
;
217 /// The cross_p_traits type - basic
218 typedef simple_cross_p_traits
<population_type
> cross_p_traits_type
;
220 /// The mutate_p_traits type - basic
221 typedef simple_mutate_p_traits
<population_type
> mutate_p_traits_type
;
223 /// The local_search_traits type - basic
224 typedef no_local_search_traits
< population_type
227 , fitness_traits_type
228 > local_search_traits_type
;
233 template< e_bool_t for_max
234 , typename_param_k Func
236 struct fopti_default_ga_config
239 /// \name The Configuration Types
242 /// The function type - fopti
243 typedef Func func_type
;
245 /// The random type - basic
246 typedef linear_rand random_type
;
248 /// The population type - basic
249 #if EXTL_WORKAROUND_BORLAND(==, 0x551)
250 typedef population
<fopti_individual
<(func_type::param_num
)> > population_type
;
252 typedef population
<fopti_individual
<func_type::param_num
> > population_type
;
255 /// The rmake_traits type - basic
256 typedef fopti_rmake_traits
< population_type
260 /// The fitness_traits type - basic
261 typedef fopti_fitness_traits
< for_max
263 , fopti_penalty_traits
< typename_type_k
population_type::individual_type
267 > fitness_traits_type
;
269 /// The stop_traits type - basic
270 typedef external_minimal_residual_stop_traits
<population_type
, 64> stop_traits_type
;
272 /// The selection_traits type - basic
273 typedef tournament_selection_traits
< population_type
275 > selection_traits_type
;
277 /// The crossover_traits type - fopti
278 typedef middle_recombination_crossover_traits
< population_type
280 > crossover_traits_type
;
282 /// The mutation_traits type - fopti
283 typedef fopti_mutation_traits
< population_type
285 > mutation_traits_type
;
287 /// The cross_p_traits type - basic
288 typedef adaptive_cross_p_traits
<population_type
> cross_p_traits_type
;
290 /// The mutate_p_traits type - basic
291 typedef adaptive_mutate_p_traits
<population_type
> mutate_p_traits_type
;
293 /// The local_search_traits type - basic
294 typedef simulated_annealing_local_search_traits
< population_type
297 , fitness_traits_type
298 > local_search_traits_type
;
302 /* ///////////////////////////////////////////////////////////////////////
303 * ::extl::intelligence namespace
305 EXTL_INTELLIGENCE_END_WHOLE_NAMESPACE
307 /* //////////////////////////////////////////////////////////////////// */
308 #endif /* EXTL_INTELLIGENCE_FOPTI_GA_CONFIG_H */
309 /* //////////////////////////////////////////////////////////////////// */