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.
- Standalone Mode: Uses a mathematical tumor model (Python only)
- COMSOL Integration Mode: Uses your existing COMSOL tumor model (recommended for research)
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:
- Efficiently explores the parameter space
- Balances exploration vs. exploitation
- Works well with expensive black-box functions
- Can handle multiple continuous parameters
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.
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:
- Gryffin suggests promising parameter combinations
- Simulator evaluates tumor response
- BO updates its internal model
- Repeat until convergence
# Install dependencies
pip install -r requirements.txt
# If Gryffin installation fails, the code will fall back to an alternative methodFor testing and demonstration:
# Run with mathematical model
python bayesian_optimizer.pyThis will:
- Run 30 iterations of Bayesian Optimization
- Compare BO-optimized strategy with MTD, LDC, and CS baselines
- Generate visualization plots
# Run with COMSOL integration
python run_optimization_with_comsol.pyFirst-time setup required! See COMSOL_SETUP_GUIDE.md for detailed instructions.
tumor_survival_with_BO.png: Survival curves comparing all strategiesoptimization_history.png: BO convergence plot showing improvement over iterations
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- Y-axis: Tumor cell survival rate (% of initial)
- X-axis: Time (days)
- Lower curves = better efficacy
- 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)
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
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:
-
A mathematical model (what we built) ← This is what we're using
- Pros: Fast, interpretable, parameter control
- Cons: Simplified reality, needs validation
-
A physics-based simulator (like COMSOL) ← What the original paper used
- Pros: More realistic, captures spatial effects
- Cons: Slow, requires domain expertise to build
-
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.
To use this in real research, you would:
- Calibrate model parameters using existing literature data
- Validate predictions against known experimental results
- Use BO to suggest promising new strategies
- Test top candidates experimentally
- Refine model based on experimental outcomes
- Iterate
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.
- Each simulation: ~0.1-1 seconds
- 30 BO iterations: ~1-2 minutes on a laptop
- For real applications: May need 100-500 iterations
Modify drug_params dictionary in TumorDynamicsModel.__init__() and update interaction_matrix.
Modify calculate_objective() to add:
- Maximum single dose constraints
- Maximum cumulative dose constraints
- Minimum effective concentration requirements
Create multiple models with varied parameters to find robust strategies.
Modify to return multiple objectives (efficacy, toxicity, cost) and use Pareto optimization.
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.
This is an educational/research project. Adapt as needed for your research.