remove \r
[extl.git] / extl / intelligence / ga / fopti / fopti_ga_config.h
blob29983f0a9c6eb0175957accae2b8c5790f42eb7a
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: fopti_ga_config.h
4 * Created: 08.10.07
5 * Updated: 08.10.13
7 * Brief: The fopti_ga_config class
9 * [<Home>]
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
19 #ifndef __cplusplus
20 # error fopti_ga_config.h need be supported by c++.
21 #endif
23 /* ///////////////////////////////////////////////////////////////////////
24 * Includes
26 #include "prefix.h"
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
51 : ga_config_base
53 /// \name The Configuration Types
54 /// @{
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;
65 #else
66 typedef population<fopti_individual<func_type::param_num> > population_type;
67 #endif
69 /// The rmake_traits type - basic
70 typedef fopti_rmake_traits < population_type
71 , random_type
72 > rmake_traits_type;
74 /// The fitness_traits type - basic
75 typedef fopti_fitness_traits < for_max
76 , population_type
77 , fopti_penalty_traits< typename_type_k population_type::individual_type
78 , func_type
80 , rmake_traits_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
88 , random_type
89 , rank_based_probability_traits<population_type, 30>
90 > selection_traits_type;
92 /*typedef roulette_wheel_selection_traits < population_type
93 , random_type
94 , proportional_probability_traits<population_type>
95 > selection_traits_type;*/
97 /*typedef tournament_selection_traits < population_type
98 , random_type
99 > selection_traits_type;*/
101 /// The crossover_traits type - fopti
102 typedef middle_recombination_crossover_traits < population_type
103 , random_type
104 > crossover_traits_type;
107 /*typedef discrete_recombination_crossover_traits < population_type
108 , random_type
109 > crossover_traits_type;*/
111 /*typedef linear_recombination_crossover_traits < population_type
112 , random_type
113 > crossover_traits_type;*/
115 /// The mutation_traits type - fopti
116 typedef fopti_mutation_traits < population_type
117 , random_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
132 , random_type
133 , rmake_traits_type
134 , fitness_traits_type
135 > local_search_traits_type;*/
137 typedef simulated_annealing_local_search_traits < population_type
138 , random_type
139 , rmake_traits_type
140 , fitness_traits_type
141 > local_search_traits_type;
143 /*typedef hill_climbing_local_search_traits < population_type
144 , random_type
145 , rmake_traits_type
146 , fitness_traits_type
147 > local_search_traits_type;*/
149 /// @}
152 template< e_bool_t for_max
153 , typename_param_k Func
155 struct fopti_simple_ga_config
156 : ga_config_base
158 /// \name The Configuration Types
159 /// @{
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;
170 #else
171 typedef population<fopti_individual<func_type::param_num> > population_type;
172 #endif
174 /// The rmake_traits type - basic
175 typedef fopti_rmake_traits < population_type
176 , random_type
177 > rmake_traits_type;
179 /// The fitness_traits type - basic
180 typedef fopti_fitness_traits < for_max
181 , population_type
182 , fopti_penalty_traits< typename_type_k population_type::individual_type
183 , func_type
185 , rmake_traits_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
193 , random_type
194 , proportional_probability_traits<population_type>
195 > selection_traits_type;
196 /*typedef tournament_selection_traits < population_type
197 , random_type
198 > selection_traits_type;*/
200 /// The crossover_traits type - fopti
201 typedef middle_recombination_crossover_traits < population_type
202 , random_type
203 > crossover_traits_type;
204 /*typedef discrete_recombination_crossover_traits < population_type
205 , random_type
206 > crossover_traits_type;*/
208 /*typedef linear_recombination_crossover_traits < population_type
209 , random_type
210 > crossover_traits_type;*/
212 /// The mutation_traits type - fopti
213 typedef fopti_mutation_traits < population_type
214 , random_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
225 , random_type
226 , rmake_traits_type
227 , fitness_traits_type
228 > local_search_traits_type;
230 /// @}
233 template< e_bool_t for_max
234 , typename_param_k Func
236 struct fopti_default_ga_config
237 : ga_config_base
239 /// \name The Configuration Types
240 /// @{
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;
251 #else
252 typedef population<fopti_individual<func_type::param_num> > population_type;
253 #endif
255 /// The rmake_traits type - basic
256 typedef fopti_rmake_traits < population_type
257 , random_type
258 > rmake_traits_type;
260 /// The fitness_traits type - basic
261 typedef fopti_fitness_traits < for_max
262 , population_type
263 , fopti_penalty_traits< typename_type_k population_type::individual_type
264 , func_type
266 , rmake_traits_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
274 , random_type
275 > selection_traits_type;
277 /// The crossover_traits type - fopti
278 typedef middle_recombination_crossover_traits < population_type
279 , random_type
280 > crossover_traits_type;
282 /// The mutation_traits type - fopti
283 typedef fopti_mutation_traits < population_type
284 , random_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
295 , random_type
296 , rmake_traits_type
297 , fitness_traits_type
298 > local_search_traits_type;
299 /// @}
302 /* ///////////////////////////////////////////////////////////////////////
303 * ::extl::intelligence namespace
305 EXTL_INTELLIGENCE_END_WHOLE_NAMESPACE
307 /* //////////////////////////////////////////////////////////////////// */
308 #endif /* EXTL_INTELLIGENCE_FOPTI_GA_CONFIG_H */
309 /* //////////////////////////////////////////////////////////////////// */