Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
genetic_algorithm_tool [2015/10/11 21:18]
admin
genetic_algorithm_tool [2026/08/28 03:20] (current)
hermann Sync from local documentation review
Line 1: Line 1:
-====== Genetic Algorithm Tool ====== ​+====== Genetic Algorithm Tool ======
  
 ===== Description ===== ===== Description =====
  
-Global Optimization tool. Solves ​Genetic Algorithm ​that mimics ​the principle ​of biological evolution ​in a search for a global optimization solution for the contained model.+This container is global optimization tool that solves a genetic algorithm, mimicking ​the principles ​of biological evolution, to search for a global optimization solution for the model it contains. It evolves a population of candidate individuals across generations,​ guided by a fitness value that the contained model computes for each individual, and returns the best individual found across all generations. 
 + 
 +The [[Get Current Individual]] and [[Set Fitness]] functors must be placed inside this container: the former retrieves the individual being evaluated in the current iteration, and the latter reports the fitness value calculated for that individual back to this container.
  
 ===== Inputs ===== ===== Inputs =====
  
-^ Name ^ Type ^ Description ^ +^ Name  ^ Type  ^ Description ​ 
-| Use Convergence Stopping Criteria ​ | [[ Bool Type| Bool]]  | If true, the optimization process ​will halt if evolution of generations becomes asymptotic, as defined by the asymptotic parameterOtherwise, the total number of generations specified by "Number Of Generations" is used.  | +| Use Convergence Stopping Criteria ​ | [[Boolean Value Type]] ​ | If true, the optimization process ​halts once the evolution of generations becomes asymptotic, as defined by Convergence LimitIf falsethe process runs for the total number of generations specified by Number Of Generations. ​ | 
-| Number ​of Generations ​ | [[Positive ​Int Type|Positive Int]]  | If the "Use Convergence Stopping Criteria" ​is true, the "​Number Of Generations" ​specifies the minimum number of generations to detect convergence. Otherwise, it becomes ​the maximum number of generations. ​ | +| Number ​Of Generations ​ | [[Positive ​Integer Value Type]] ​ | If Use Convergence Stopping Criteria is true, this specifies the minimum number of generations ​needed ​to detect convergence. Otherwise, it is the maximum number of generations. ​ | 
-| Population Size  | [[Positive ​Int Type|Positive Int]]  | Number of individuals per population. ​ | +| Population Size  | [[Positive ​Integer Value Type]] ​ | Number of individuals per population. ​ | 
-| Individual Genotype ​ | [[Lookup Table Group Type|Lookup Table Group  ​]]  | The genotype ​that defines the template for individuals. ​ | +| Individual Genotype ​ | [[Lookup Table Group Type]] ​ | Genotype ​that defines the template for individuals. ​ | 
-| Default Lower Bound  | [[Real Value Type|Real Value]]  | The default ​lower value for alleles. ​ | +| Default Lower Bound  | [[Real Value Type]] ​ | Default ​lower value for alleles. Must be less than Default Upper Bound.  | 
-| Default Upper Bound  | [[Real Value Type|Real Value]]  | The default ​upper value for alleles. ​ |+| Default Upper Bound  | [[Real Value Type]] ​ | Default ​upper value for alleles. ​ |
  
 ===== Optional Inputs ===== ===== Optional Inputs =====
  
-^ Name ^ Type ^ Description ^ Default Value ^ +^ Name  ^ Type  ^ Description ​ ^ Default Value  
-| Convergence Limit | [[ Percent Type| Percent  ​]]  | Convergence limit (in percentage of fitness variationacross the given number of generations used to halt the optimization process. ​ | 0.99  | +| Convergence Limit  | [[Percent Type]] ​ | Convergence limit, as a percentage of fitness variation across the given number of generationsused to halt the optimization process ​when Use Convergence Stopping Criteria is true. This is an advanced port.  | 0.99  | 
-| Lower Bounds ​ | [[Lookup Table Group Type|Lookup Table Group ]]  | The lower limits per allelesIf omitted, the "Default Lower Bound" ​is used for missing limits.  | None  | +| Lower Bound  | [[Lookup Table Group Type]] ​ | Lower limits per alleleMissing limits fall back to Default Lower Bound. This is an advanced port.  | None  | 
-| Upper Bounds ​| [[Lookup Table Group Type|Lookup Table Group ]]  | The upper limits per allelesIf omitted, the "Default Upper Bound" ​is used for missing limits.  | None  | +| Upper Bound  ​| [[Lookup Table Group Type]] ​ | Upper limits per alleleMissing limits fall back to Default Upper Bound. This is an advanced port.  | None  | 
-| Meta Heuristic Evaluation Percent ​ | [[Percent Type|Percent  ​]]  | A percentage ​of individuals whose finesses are obtained via meta-heuristic ​estimation ​(in percentage of individuals).  | None  | +| Meta Heuristic Evaluation Percent ​ | [[Percent Type]] ​ | Percentage ​of individuals whose fitness is estimated using a meta-heuristic (KNNinstead of being calculated by the contained model. This is an advanced port.  | None  | 
-| Maximum Log Level  | [[Log Tag Type|Log Tag  ​]]  | Maximum log level used to run the contained functors. ​ | Warning ​ |+| Maximum Log Level  | [[Log Tag Type]] ​ | Maximum log level used while running ​the contained functors. This is an advanced port.  | Warning ​ | 
 +| Sequence Input  | [[None Type]] ​ | Ensures that the functor connected to this port runs before this container. ​ | None  |
  
 ===== Outputs ===== ===== Outputs =====
  
-^ Name ^ Type ^ Description ^ +^ Name  ^ Type  ^ Description ​ 
-| Best Individual ​ | [[ Lookup Table Group Type|Lookup Table Group  ​]]  | The resulting best individual ​from all generations. ​ | +| Best Individual ​ | [[Lookup Table Group Type]] ​ | Best individual ​found across ​all generations. ​ | 
-| Best Individual Fitness ​ | [[Real Value Type|Real Value  ​]]  | The '​fitness'​ score of the overall best individual. ​ | +| Best Individual Fitness ​ | [[Real Value Type]] ​ | Fitness value of the overall best individual. ​ | 
-Worst Fitness Per Generation | [[Real Value Type|Real Value  ​]] ​ | The '​fitness'​ score of the worst individual ​per generation. ​ |+Best Fitness Per Generation ​ | [[Lookup Table Type]]  ​Fitness value of the best individual, for each generation. ​ 
 +| Worst Fitness Per Generation ​ | [[Lookup Table Type]]  | Fitness value of the worst individual, for each generation.  | 
 +| Sequence Output ​ | [[None Type]] ​ | Ensures that this container runs before the functor connected to this port.  |
  
 ===== Group ===== ===== Group =====
Line 35: Line 40:
 [[Functor List#​Calibration | Calibration]] [[Functor List#​Calibration | Calibration]]
  
-===== Notes =====+===== Internal Outputs ​=====
  
-To calibrate Weights of Evidence coefficients,​ the "​.dcf"​ file representing the Weight of Evidence ranges and coefficients can be converted into the corresponding set of "​.csv"​ tables and back to the original format using the [[weights_of_evidence_file_conversion|ConvertWeightFiles utility]].+^ Name  ^ Type  ^ Description ​ ^ 
 +| Current Individual ​ | [[Lookup Table Group Type]]  | Individual being evaluated in the current iteration |
  
-If the "Meta Heuristic Evaluation Percent"​ parameter is defined, a percent of individuals estimate their corresponding fitness value using the [[wp>​K-nearest_neighbor_algorithm| KNN algorithm]]. To ensure ​the KNN estimations are accurate, the meta heuristic is used only after a given number of generations (usually after 30% of the total generations).+===== Internal Inputs ===== 
 + 
 +^ Name  ^ Type  ^ Description ​ ^ 
 +| Fitness ​ | [[Real Value Type]]  | Fitness value calculated for the current individual | 
 + 
 +===== Notes =====
  
-When the convergence ​is usedit is detected when there is not even minimum percent (1 - "​Convergence Limit"​) ​of improvement in the best fitness value in the window formed ​by the "​Number of Generations"​ last generations.+A summary of the algorithm this container implements: first, an initial population ​is generated using Individual Genotype as a seed and the given bounds as limits for each allele. Thenfor each generation, the fitness of every individual ​is calculated and the best individual ​is recorded; ​portion ​of the population is selected through tournament, and those individuals are reproduced through crossover and mutation to form the next generation. This repeats until the stopping criteria set by Use Convergence Stopping Criteria is reached, at which point the best individual found across all generations ​is returned.
  
-Here is a summary of the algorithm implemented ​by this functor:+When Use Convergence Stopping Criteria ​is true, convergence is detected when the best fitness value has not improved ​by at least the minimum percentage (1 - Convergence Limit) across the window formed by the last Number Of Generations generations.
  
-1) Firstan initial population ​of "​Population Size" ​individuals ​is generated using the initial individual ("​Individual Genotype"​) as seed and the given bounds as lower and upper limit ("Upper Bound" and "Lower Bound",​ respectively).+When Meta Heuristic Evaluation Percent is setthat percentage ​of individuals ​have their fitness estimated with the [[wp>​K-nearest_neighbor_algorithm|KNN algorithm]] instead of being evaluated by the contained model. This estimation is only used after portion of the generations have run (typically 30% of the total), so that the KNN algorithm has enough prior results to estimate from.
  
-2) Basically, there are two different execution modes (controlled by the "Use Convergence Stopping Criteria" ​flag): fixed number ​of generations ("​Number ​of Generations") or iteration until convergence.+"dcf" ​file holding Weights ​of Evidence ranges and coefficients can be converted to a corresponding set of "csv" tables, and back, with the [[Weights Of Evidence File Conversion|ConvertWeightFiles utility]], which is useful for calibrating those coefficients with this container.
  
-3) The fitness value for all individuals ​is calculated and the individual having the best fitness value is saved internally as the best individual for the current generation.+Reports an error if Default Lower Bound is not less than Default Upper Bound.
  
-4) A given percent of the individuals ​is selected based on [[wp>​Tournament_selection|tournament]] results. The selected individuals are reproduced using [[wp>​Crossover_(genetic_algorithm)|crossovers]] ​and [[wp>​Mutation_(genetic_algorithm)|mutations]] and used to form the next generation.+Reports an error if Use Convergence Stopping Criteria ​is true and Convergence Limit is zero.
  
-6) If the stopping criteria defined by item 2 was not reached yet, the execution ​continues at item 3. Otherwise, the individual having ​the best fitness among all generations is returned+Reports a warning that cancelling or interrupting ​the execution ​of a model using this container may crash the application.
  
-===== Internal Name ===== +===== Internal Name =====
  
 GeneticAlgorithmTool GeneticAlgorithmTool