module type LOCAL = sig
.. end
Input signature for the functor Ga_optimize.Make
.
type
data
Data encoding.
type
user_data
Data passed by the user when calling the AG.
type
result
Result to be returned by terminate_AG.
exception Fin_AG
To be raised when the termination criterium is met.
val gvars : Ga_types.gvars
Variables read in the configuration file.
val eval : user_data -> int -> data -> float Lazy.t
eval user_data numgen data
returns the evaluation (fitness) of
data
.
val generate : user_data -> int -> data
generate user_data i
generates a new data. i
is the index of this
data in the population.
val cross : user_data ->
int ->
data ->
data -> data * data
cross user_data numgen parent1 parent2
returns a pair of children
issued from the crossing of parent1
and parent2
.
CAUTION : if parent1
or parent2
contain references, arrays,
hashtables, they must be copied before making any changes. No in-place
modification is to be made.
val mutate : user_data ->
int -> data -> data
mutate user_data numgen element
returns the mutation of element
.
CAUTION : same as for cross
.
val distance : user_data ->
data -> data -> float
Returns the distance between two data.
val barycenter : user_data ->
data ->
int -> data -> int -> data
barycenter user_data elt1 coeff1 elt2 coeff2
.
val init : user_data -> unit
Called at the very beginning of the AG.
val prepare_ag : user_data ->
data Ga_types.population -> unit
prepare_ag user_data population
. Called right after the initial
population has been generated.
val prepare_gen : user_data ->
int -> data Ga_types.population -> unit
prepare_gen user_data numgen population
. Called at the beginning of
each generation.
val after_scale : user_data ->
int ->
data Ga_types.population ->
data Ga_types.chromosome -> unit
after_scale user_data numgen population best
. Called after scaling.
best
is the best element of population
.
val after_share : user_data ->
int -> data Ga_types.population -> Ga_types.sharing -> unit
after_share user_data numgen population sharing
. Called after
sharing. sharing
contains the list of indices of protected elements,
the number of best clusters, the total number clusters and the value of
dmean.
val after_reproduce : user_data ->
int -> data Ga_types.population -> int list -> unit
after_reproduce user_data numgen population protected
. Called after
reproduction. protected
contains the indexes of protected elements.
val after_gen : user_data ->
int -> data Ga_types.population -> unit
after_gen user_data numgen population
. Called at the end of each
generation.
val terminate_ag : user_data ->
data Ga_types.population ->
int list -> int -> result
terminate_ag user_data population bests elapsed
. Called at the end of
the AG. bests
contains the indexes of the best element in each cluster,
elapsed
is the number of generations done.