This document provides a summary of the OscillatorOptimization.jl package, a Julia-based framework for optimizing oscillatory biological systems using evolutionary algorithms.
OscillatorOptimization.jl is a specialized package developed for a computational biophysics PhD project. Its primary purpose is to discover parameter sets in biochemical reaction networks, modeled as systems of ordinary differential equations (ODEs), that produce sustained, regular oscillations.
The package is built around a custom Quality Diversity (QD) evolutionary algorithm. Unlike standard genetic algorithms that seek a single optimal solution, the QD approach aims to find a diverse archive of high-performing solutions, exploring various ways a system can oscillate.
The architecture is designed to be modular and extensible, particularly for incorporating new biological models.
- Biological models are defined using
Catalyst.jl'sReactionSystemmacro. This provides a symbolic, human-readable way to specify species, parameters, and reactions. - The package includes two primary built-in models:
fullrn(Lipid Oscillator Model): A comprehensive model of a lipid-based biochemical oscillator. The key output (observable) isAmem, representing the fraction of a specific protein (AP2) bound to the cell membrane.trimer_rn(Trimer Assembly Model): An extension of the lipid oscillator that couples its dynamics to the assembly of a protein heterotrimer. This model introduces additional complexity and new observables likeTrimerYield.
- A key feature is the use of a trait-based dispatch system (
src/api/traits.jl). Thefitness_observablestrait allows the optimization pipeline to be model-agnostic. - By implementing this trait for a new
ReactionSystem, a user can specify which observables should be used for fitness scoring (one for frequency-domain analysis via FFT, and one for time-domain analysis). This allows the entire framework to be applied to new models without changing the core optimization code.
The end-to-end workflow is as follows:
- Initialization: An
OptimizationReactionSystemstruct is created, which bundles theReactionSystem, the correspondingODEProblem, the ODE solver algorithm, and other metadata. Thefitness_observablestrait is called here to determine which outputs to monitor. - Population Generation: A
DimArray(fromDimensionalData.jl) is used to create an initial population of individuals. Each individual is a vector of parameter values ("genes"). - Evaluation Loop:
- For each individual,
evaluate_individual!(src/api/evaluate_individual.jl) is called. - This function
remakes theODEProblemwith the individual's parameters and solves it. - The resulting time-series solution is passed to
calculate_fitness!(src/api/fitness_functions/FitnessFunction.jl).
- For each individual,
- Fitness Calculation:
- The fitness function analyzes the primary observable's time-series.
- It performs a Fast Fourier Transform (FFT) to identify dominant frequencies. A strong, single peak is rewarded.
- It also analyzes the time-domain signal to find peaks and troughs, calculating the period and amplitude of the oscillation.
- The final fitness score reflects the regularity and prominence of the oscillation.
- Evolution:
- The custom Quality Diversity (QD) algorithm (
src/evolutionary_overloads/quality-diversity.jl) drives the evolution. - It uses tournament selection to choose parents, and Simulated Binary Crossover (SBX) and Polynomial Mutation (PLM) to create offspring.
- The process is repeated over many generations to evolve a population of highly oscillatory parameter sets.
- The custom Quality Diversity (QD) algorithm (
- Results: The entire run is tracked, and the final population of unique, high-fitness individuals is compiled into a
DataFramefor analysis.
src/OscillatorOptimization.jl: Main module file, exports key functionalities.src/models/*.jl: Definitions of theReactionSystemmodels.src/api/traits.jl: The core of the model-agnostic design.src/api/optimization.jl: Contains the mainrun_optimizationfunction and theOptimizationReactionSystemstruct.src/evolutionary_overloads/quality-diversity.jl: Implementation of the custom QD algorithm.src/api/evaluate_individual.jl: The function that orchestrates the evaluation of a single parameter set.src/api/fitness_functions/FitnessFunction.jl: The fitness calculation logic.Project.toml: Lists the extensive set of dependencies, includingCatalyst,OrdinaryDiffEq,Evolutionary, andDimensionalData.