
The Foundation of BioGA
Multi-Objective Genetic Algorithm for Genomic Data Optimization
Dany Mukesha
2026-10-17
Source:vignettes/Foundation.Rmd
Foundation.RmdIntroduction
The BioGA utilizes multi-objective Genetic Algorithm (GA) specifically tailored for the optimization and analysis of genomic data. A detailed mathematical and theoretical analysis of the algorithms implemented within this package is described below; covering all major components of the evolutionary process with formal mathematical notation, proofs, and a discussion of key properties.
The Genetic Algorithm Framework
The BioGA package employs a standard generational Genetic Algorithm structure, modified for multi-objective optimization. This framework involves the iterative evolutionary cycle of initialization, evaluation, selection, reproduction (crossover and mutation), and replacement.
Mathematical Representation
Let us define the core elements of the search space and the algorithm’s state:
- is the gene network, where are genes.
- is the genomic data matrix, consisting of genes across samples.
- is the population matrix at generation , containing individuals (rows) and gene values (columns).
The evolution from one generation to the next, , is described by the following functional relationship:
Where the functions represent the core operators:
- : Fitness Evaluation function.
- : Selection operator (NSGA-II inspired).
- : Crossover operator (SBX).
- : Mutation operator (Adaptive).
- : Replacement operator (Elitism + Diversity Preservation).
Population Initialization
The initialization phase creates the starting population, , by drawing random samples directly from the measured genomic data .
Mathematical Formulation
Given the genomic data and a population size , the value of gene in the -th individual of the initial population is set as:
This means that for each element in , a sample is chosen uniformly at random from the available samples, and the corresponding gene expression value is used.
Initialization with Clustering:
If a clustering breakdown is provided (e.g., is the set of clusters), the initialization respects the structure: for all genes belonging to the same cluster .
Statistical Properties
- Distribution Preservation: This method ensures that the initial population individuals maintain the original statistical distribution of expression values for each gene .
- Structural Integrity: If clustering is used, the method preserves the pre-defined cluster structure within the initial population.
- Expected Value: The expected value of any element over the initialization process is the mean of the observed expression for gene :
Fitness Evaluation
The BioGA package uses a two-objective formulation. Both
objectives are minimised. The package supports two representations, and
the meaning of the objectives depends on which one is used.
Real representation
In the real representation an individual is a continuous expression profile .
Objective 1: Data fidelity (). The squared Euclidean distance between the individual and every observed sample. It is minimised when each gene value equals the per-gene mean :
Objective 2: Parsimony (). The mean absolute gene value (an penalty). It is minimised by driving gene values toward zero:
Binary representation
In the binary representation an individual is a selection indicator and class labels are required.
Objective 1: Predictive signal (). For each gene an ANOVA -statistic measures how strongly it separates the classes: where and are the between- and within-class sums of squares. The objective is the negated mean over the selected genes (so that better-separating subsets have a smaller value): with when no gene is selected.
Objective 2: Sparsity (). The fraction of selected genes:
Because rewards including informative genes while rewards including few genes, the two objectives conflict and the solution is a Pareto front rather than a single point.
Selection (NSGA-II)
The selection mechanism is based on the principles of the Non-dominated Sorting Genetic Algorithm II (NSGA-II), ensuring that evolutionary pressure drives the population toward the Pareto front.
Domination Criteria
Individual dominates individual (denoted ) if and only if:
- Individual is no worse than on all objectives, and
- Individual is strictly better than on at least one objective.
Formally:
Proof of Partial Order
The two-objective domination relation defines a partial order on the solution set because it satisfies the following properties:
- Irreflexive: No individual dominates itself. If , the second condition () is false.
- Antisymmetric Property: If , then cannot dominate . If is strictly better on at least one objective, must be strictly worse ().
- Transitive: If and , then . This follows directly from the transitivity of the combined and relations.
Front Construction
The population is sorted into non-dominated fronts:
- Domination Metrics: For every individual, we compute its domination count (number of individuals that dominate it) and its dominated set (set of individuals it dominates).
- First Front (): This front consists of all individuals whose domination count is . These are the current non-dominated solutions.
- Subsequent Fronts: Individuals in are temporarily removed. The domination counts of the individuals they dominated are reduced by one. The next front, , consists of all remaining individuals whose updated domination count is . This process continues until the entire population is sorted.
Theorem on Computational Complexity
The non-dominated sorting and front construction algorithm terminates in quadratic time complexity relative to the population size.
Theorem: The front construction algorithm terminates in time, where is the population size and is the number of objectives.
Proof Sketch:
- The pairwise domination check between any two individuals is an operation.
- The computation of the domination count and dominated set for all individuals requires time, as it involves comparisons.
- Once these metrics are computed, the iterative process of assigning individuals to fronts requires time per front, leading to an overall complexity dominated by the initial comparison phase.
Crossover (Simulated Binary Crossover - SBX)
The Simulated Binary Crossover (SBX) is a prominent operator for real-coded GAs, designed to mimic the convergence properties of binary crossover while operating directly on continuous variables.
Given two parent individuals, , the SBX operator generates two complementary offspring vectors. For each gene :
With crossover probability , the offspring genes are determined: 1. A random number is drawn: . 2. The spreading factor is computed based on the distribution index : 3. The two complementary gene values are calculated: and one of them is assigned to the offspring.
Otherwise (with probability ) the gene is copied unchanged from one of the parents. In the binary representation uniform crossover is used instead: each gene is copied from a randomly chosen parent.
Properties of SBX
- Mean Preservation: The two complementary children satisfy , so the expected value of an offspring gene (with the child chosen uniformly at random) is the parents’ average: .
- Distribution Control: The distribution index controls the proximity of the offspring to the parents.
- Low (e.g., ): Produces a wide spread and approaches uniform crossover, generating many extreme values.
- High (e.g., ): Clusters offspring tightly around the parents, approaching no crossover.
Mutation
The mutation operation introduces random small changes to the
offspring for exploration. The BioGA uses an adaptive
mutation rate and incorporates network constraints.
For each gene , with adaptive probability : where is the initial rate, is the current generation, and is the total number of generations. This rate increases linearly over time to enhance exploration in later stages.
In the real representation the change applied to gene value is:
A Gaussian perturbation is generated: .
If a gene network is provided (adjacency matrix ), the perturbation is damped by the gene’s relative connectivity. With the degree and : so highly connected genes mutate less.
If no network is provided, standard Gaussian mutation is applied:
In the binary representation mutation is a bit flip: with the adaptive probability the selected/not-selected state of a gene is inverted.
Properties of Adaptive Network Mutation
- Adaptive Rate: The mutation rate increases with generation , maintaining exploration later in the run.
- Network Constraint Impact: The damping factor reduces the mutation magnitude for highly connected genes, preserving known network structure. It is a normalised, non-negative quantity, so mutation is never amplified.
- Expected Change: Since , the expected change remains zero: .
- Variance Control: The variance of the change is which shrinks monotonically with the gene’s connectivity.
Replacement
The replacement operator constructs the next population from the current population and the offspring using NSGA-II environmental selection.
- Rank and crowding. The candidates are sorted into non-dominated fronts and a crowding distance is computed within each front (as in selection).
-
Elitist retention. The best
parents, where
is the replacement budget
num_to_replace, are retained. - Offspring admission. The best offspring, ranked by the same (rank, crowding) criterion, fill the remaining slots.
Because
dominates
,
non-dominated solutions are never discarded in favour of dominated ones;
ties are broken towards less crowded (more diverse) solutions. The best
solution with respect to the first objective is non-dominated by
construction, so it is always retained when
,
giving monotonic non-increasing best
.
If num_to_replace is zero the population is returned
unchanged.
Convergence Analysis
BioGA is a heuristic. It does not provide a guarantee of finding the global Pareto front in a finite number of generations; the results below only outline the idealised conditions under which asymptotic convergence is expected, and should not be read as a practical guarantee.
Assumptions
For convergence results in MOEAs, the following are typically assumed:
-
Finite Search Space: While the gene values are
continuous, they can be discretised in theory (or bounded in practice).
The real-coded search space is not finite, so this assumption does not
strictly hold for
"real"mode. -
Strictly Positive Mutation Probability:
for all
,
which enables ergodicity. This fails when
mutation_rate = 0. -
Elitism: The best solutions are preserved across
generations. This holds only when
num_to_replace < population_size.
Result (idealised)
Statement: Under the assumptions above, standard MOEA theory (e.g. Rudolph 1998, and analyses of NSGA-II) indicates that the population converges in probability to the true Pareto front as .
Sketch:
- Preservation of optimality: Elitist replacement retains non-dominated solutions across generations.
- Ergodicity: A strictly positive mutation probability lets any point be reached from any other in finitely many steps.
- Convergence: Selection pressure toward non-dominated solutions, combined with ergodic variation, drives the population toward the Pareto front in the limit.
In practice, the useful convergence diagnostics are the
per-generation best objective (history) and the final
Pareto front; the theoretical guarantee above requires assumptions that
real runs may violate.
Computational Complexity
Analyzing the complexity is crucial for understanding the algorithm’s performance on large genomic datasets. Key variables are defined:
- = population size
- = number of genes
- = number of samples
- = number of objectives ( in BioGA)
- = number of generations
Component Complexities
| GA Component | Complexity (Per Generation) | Dominating Variables |
|---|---|---|
| Initialization | ||
| Fitness Evaluation | ||
| Selection (NSGA-II sort) | (quadratic) | |
| Crossover (SBX) | ||
| Mutation (Adaptive) | ||
| Replacement (environmental selection) |
Total Complexity
The total complexity for generations is dominated by the Fitness Evaluation and the Selection phases:
Factoring : This result highlights that scalability is limited by the quadratic dependency on population size (due to sorting) and the linear dependency on the product of genes/samples (due to fitness evaluation).
Mathematical Optimization Interpretation
From a purely mathematical perspective, the BioGA algorithm serves as a robust stochastic optimization solver for the following multi-objective problem:
Core Characteristics that Favor GA:
- Multi-Objective Nature: Explicitly seeking a set of trade-off solutions (the Pareto front).
- High Dimensionality: The real search space is , making deterministic grid search intractable.
- Non-Differentiable Objective: The sparsity objective in the binary representation is non-differentiable, so gradient-based methods do not apply.
- Non-Convexity: The combined fitness landscape may be non-convex, so global search heuristics are useful to avoid poor local optima.
Biological Interpretation and Relevance
The mathematical operations within the BioGA framework have direct analogues in the biological context of genomic data analysis, ensuring the algorithm is biologically meaningful.
| Mathematical Component | Biological Concept | Function |
|---|---|---|
| Population Initialization | Initial Biological Variability | Starting the search process by sampling observed expression levels. |
| Fitness () | Functional Efficacy & Parsimony | ensures the optimized solution is relevant to observed data; enforces biological simplicity (Minimal Regulatory Model). |
| Network Constraints | Gene-Gene Interactions | Incorporating known biological constraints (e.g., regulatory or metabolic pathways) to guide mutation. |
| Clustering | Co-expressed Gene Modules | Respecting known functional groupings during initialization. |
Conclusion
The BioGA package implements a structured
multi-objective evolutionary algorithm. Its components—NSGA-II rank and
crowding for selection and environmental replacement, SBX (or uniform)
crossover, and adaptive mutation with optional degree-based network
damping—provide a coherent framework for trade-offs between data
fidelity (or predictive signal) and model sparsity in genomic data
optimisation.
Session Info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.6.1 (2026-06-24)
#> os Ubuntu 24.04.5 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language en
#> collate C.UTF-8
#> ctype C.UTF-8
#> tz UTC
#> date 2026-10-17
#> pandoc 3.8.3 @ /opt/hostedtoolcache/pandoc/3.8.3/x64/ (via rmarkdown)
#> quarto NA
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> bookdown 0.48 2026-08-28 [1] RSPM
#> bslib 0.12.0 2026-08-04 [1] RSPM
#> cachem 1.1.0 2024-05-16 [1] RSPM
#> cli 3.6.6 2026-04-09 [1] RSPM
#> desc 1.4.3 2023-12-10 [1] RSPM
#> digest 0.6.39 2025-11-19 [1] RSPM
#> evaluate 1.0.5 2025-08-27 [1] RSPM
#> fastmap 1.2.0 2024-05-15 [1] RSPM
#> fs 2.1.0 2026-04-18 [1] RSPM
#> htmltools 0.5.9 2025-12-04 [1] RSPM
#> htmlwidgets 1.6.4 2023-12-06 [1] RSPM
#> jquerylib 0.1.4 2021-04-26 [1] RSPM
#> jsonlite 2.0.0 2025-03-27 [1] RSPM
#> knitr 1.52 2026-09-06 [1] RSPM
#> lifecycle 1.0.5 2026-01-08 [1] RSPM
#> otel 0.2.0 2025-08-29 [1] RSPM
#> pkgdown 2.2.1 2026-07-07 [1] RSPM
#> R6 2.6.1 2025-02-15 [1] RSPM
#> ragg 1.5.2 2026-03-23 [1] RSPM
#> rlang 1.3.0 2026-07-05 [1] RSPM
#> rmarkdown 2.32 2026-09-01 [1] RSPM
#> sass 0.4.10 2025-04-11 [1] RSPM
#> sessioninfo 1.2.4 2026-06-04 [1] RSPM
#> systemfonts 1.3.2 2026-03-05 [1] RSPM
#> textshaping 1.0.5 2026-03-06 [1] RSPM
#> xfun 0.62 2026-10-16 [1] RSPM
#> yaml 2.3.12 2025-12-10 [1] RSPM
#>
#> [1] /home/runner/work/_temp/Library
#> [2] /opt/R/4.6.1/lib/R/site-library
#> [3] /opt/R/4.6.1/lib/R/library
#>
#> ──────────────────────────────────────────────────────────────────────────────