Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bayesian Optimization for Multi-Drug Cancer Treatment

This project uses Bayesian Optimization (specifically the Gryffin algorithm) to optimize multi-drug treatment schedules for cancer therapy. The goal is to find optimal combinations of drug doses and timing that minimize tumor burden while managing toxicity.

🎯 Two Operating Modes

  1. Standalone Mode: Uses a mathematical tumor model (Python only)
  2. COMSOL Integration Mode: Uses your existing COMSOL tumor model (recommended for research)

Overview

The Challenge

Traditional cancer treatment strategies include:

  • MTD (Maximum Tolerated Dose): High doses given infrequently
  • LDC (Low Dose Continuous): Low doses given frequently
  • CS (Combination Strategy): Moderate doses at moderate intervals

However, finding the truly optimal dosing schedule across multiple drugs is a complex optimization problem with:

  • High-dimensional parameter space (doses × timing × drug interactions)
  • Expensive evaluations (requires simulation or experiments)
  • Complex objectives (efficacy vs. toxicity trade-offs)

Bayesian Optimization is ideal for this because it:

  1. Efficiently explores the parameter space
  2. Balances exploration vs. exploitation
  3. Works well with expensive black-box functions
  4. Can handle multiple continuous parameters

How It Works

1. Tumor Dynamics Simulator (tumor_response_simulator.py)

Since we don't have access to the COMSOL model from the original paper, we created a biologically-informed mathematical model:

  • Tumor Growth: Gompertz model (realistic tumor growth kinetics)

    dN/dt = r·N·ln(K/N) - kill_rate·N
    
  • Drug Pharmacokinetics: First-order elimination

    dC/dt = -clearance·C + dose(t)
    
  • Drug Effects: Hill equation (dose-response relationship)

    Effect = Emax · C^n / (EC50^n + C^n)
    
  • Drug Interactions: Synergy/antagonism matrix modeling how drugs work together

  • Resistance Development: Exposure-dependent resistance buildup

This serves as our "simulator" that BO queries to evaluate different treatment strategies.

2. Bayesian Optimizer (bayesian_optimizer.py)

Uses Gryffin algorithm (or falls back to intelligent random search if Gryffin not available) to:

  • Search Space:

    • Dose amounts for 3 drugs at each administration
    • Time intervals between doses
    • Example: 5 doses = 15 dose parameters + 4 interval parameters = 19D optimization
  • Objective Function: Minimize

    • Final tumor burden
    • Average tumor burden over time
    • Toxicity (total drug used)
  • Optimization Process:

    1. Gryffin suggests promising parameter combinations
    2. Simulator evaluates tumor response
    3. BO updates its internal model
    4. Repeat until convergence

Installation

# Install dependencies
pip install -r requirements.txt

# If Gryffin installation fails, the code will fall back to an alternative method

Usage

Mode 1: Standalone (No COMSOL Required)

For testing and demonstration:

# Run with mathematical model
python bayesian_optimizer.py

This will:

  1. Run 30 iterations of Bayesian Optimization
  2. Compare BO-optimized strategy with MTD, LDC, and CS baselines
  3. Generate visualization plots

Mode 2: With Your COMSOL Model (For Real Research)

# Run with COMSOL integration
python run_optimization_with_comsol.py

First-time setup required! See COMSOL_SETUP_GUIDE.md for detailed instructions.

Output Files

  • tumor_survival_with_BO.png: Survival curves comparing all strategies
  • optimization_history.png: BO convergence plot showing improvement over iterations

Customization

You can modify parameters in the code:

# In bayesian_optimizer.py, adjust:
num_doses = 5           # Number of dosing events
num_iterations = 30     # BO iterations (more = better results but slower)
max_dose_per_drug = 50  # Maximum dose per administration

# In tumor_response_simulator.py, adjust:
initial_cells = 1e9     # Initial tumor size
total_days = 75         # Simulation duration

Understanding the Results

Survival Curves Plot

  • Y-axis: Tumor cell survival rate (% of initial)
  • X-axis: Time (days)
  • Lower curves = better efficacy

Optimization History Plot

  • Top panel: Shows all evaluated points and best-found solution over time
  • Bottom panel: Shows improvement rate (should converge to 0 as optimum is approached)

Interpreting the Optimized Schedule

The BO-optimized schedule often discovers non-obvious patterns:

  • May use high initial doses followed by maintenance
  • May identify synergistic drug combinations
  • May space doses to minimize resistance development
  • May balance immediate efficacy with long-term control

Answering Your Key Question

Q: "Is this really possible to write such codes without any dataset?"

A: You're absolutely right to question this!

You cannot do Bayesian Optimization without some way to evaluate treatment strategies. You need one of:

  1. A mathematical model (what we built) ← This is what we're using

    • Pros: Fast, interpretable, parameter control
    • Cons: Simplified reality, needs validation
  2. A physics-based simulator (like COMSOL) ← What the original paper used

    • Pros: More realistic, captures spatial effects
    • Cons: Slow, requires domain expertise to build
  3. Real experimental data ← Gold standard

    • Pros: Most realistic, captures true biology
    • Cons: Expensive, time-consuming, ethical constraints

Our approach uses a surrogate model - a simplified mathematical representation of tumor dynamics based on established pharmacological principles. This is a common approach in computational biology when detailed simulators or experimental data aren't available.

Validation Strategy

To use this in real research, you would:

  1. Calibrate model parameters using existing literature data
  2. Validate predictions against known experimental results
  3. Use BO to suggest promising new strategies
  4. Test top candidates experimentally
  5. Refine model based on experimental outcomes
  6. Iterate

Technical Details

Model Parameters

The simulator includes realistic parameters for:

  • Tumor growth rate: 0.05/day
  • Drug efficacy: 0.6-0.8 (60-80% max kill rate)
  • Drug clearance: 0.08-0.15/day (half-life ~5-9 days)
  • EC50 values: 10-15 mg/L
  • Synergy factors: 1.1-1.2 (10-20% enhanced effect)

These are based on typical values for cancer chemotherapy agents.

Computational Cost

  • Each simulation: ~0.1-1 seconds
  • 30 BO iterations: ~1-2 minutes on a laptop
  • For real applications: May need 100-500 iterations

Extending the Project

Add More Drugs

Modify drug_params dictionary in TumorDynamicsModel.__init__() and update interaction_matrix.

Add Constraints

Modify calculate_objective() to add:

  • Maximum single dose constraints
  • Maximum cumulative dose constraints
  • Minimum effective concentration requirements

Add Patient Variability

Create multiple models with varied parameters to find robust strategies.

Multi-Objective Optimization

Modify to return multiple objectives (efficacy, toxicity, cost) and use Pareto optimization.

References

This project demonstrates:

  • Bayesian Optimization for drug scheduling
  • Pharmacokinetic-pharmacodynamic (PK-PD) modeling
  • Multi-drug interaction modeling
  • Treatment strategy comparison

For production use, model parameters should be calibrated to specific cancer types and drugs using clinical/experimental data.

License

This is an educational/research project. Adapt as needed for your research.

About

Undergrad research work supervised by Dr. Mohsen Rezaeian at University of Waterloo on Bayesian Optimization.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages