This repository contains the code for the paper A Stochastic Programming Approach to the Antibiotics Time Machine Problem.
- Oğuz Mesüm (@oguzmes)
- Assoc. Prof. Burak Kocuk (@burakkocuk)
- Prof. Ali Rana Atılgan
Requires Python 3.11 and library version requirements can be found in requirements.txt
.
Tool can be used from CLI after installing the necessary dependencies and cloning the repository. The information on how to use the tool is also defined within itself.
python ABR.py -h
usage: StochasticAntibiotic [-h] [--dataset DATASET] [--n [N]] [--initialState [INITIALSTATE]]
[--targetState [TARGETSTATE]] [--plotSolution]
[--solutionMethod {DP,Multistage,Strong2stage,Weak2stage}]
[--matrixSamplingSize MATRIXSAMPLINGSIZE] [--matrixType {epm,cpm}] [--timeLimit TIMELIMIT]
optional arguments:
-h, --help show this help message and exit
--dataset DATASET
--n [N] step size (default: 3)
--initialState [INITIALSTATE]
initial state selection (default: 1011)
--targetState [TARGETSTATE]
target state selection (default: 0000)
--solutionMethod {DP,Multistage,Strong2stage,Weak2stage}
solution method selection (default: DP)
--matrixSamplingSize MATRIXSAMPLINGSIZE
matrix sampling size selection (default: 10000)
--matrixType {epm,cpm}
matrix type selection (default: cpm)
--timeLimit TIMELIMIT
time limit (seconds) for solvers (default: 3600)
Developed by O. Mesum, Assoc. Prof. B. Kocuk
The following code will find best antibiotic treatment plan starting from genotype 1110 to genotype 0001 in 6 steps using Strong2stage method. Solver is time limit is set to 1000 seconds and matrix sampling size is 1000 for both evaluator and optimizer. If successful within time limit it will plot the solution aswell.
python ABR.py --dataset msx255_SuppData2017_GRME_ABR.xlsx --initialState 1110 --n 6 --targetState 0000 --solutionMethod Strong2stage
Matrix_useCase=optimization_type=cpm_s=10000 does not exist, generating from scratch.
Matrix_useCase=evaluator_type=cpm_s=10000 does not exist, generating from scratch.
Saved N6_1110-0000_Strong2stage_cpm_solution.xlsx under ..\data\solutions.
Saved N6_1110-0000_Strong2stage_cpm_plot.png under ..\data\solutions.
Results of each runs can be found under ..\data\solutions
.
- Prior to solving instances the matrix sampling part might take long. So to avoid this for further replicatons and experimentation sampled matrices are saved under
..\data\matrix_files
.
![]() |
|
On left hand side we can see optimal antibiotic treatment plan. On right hand side there are descriptive statistics on problem instance and solver.
OptVal
: Optimal objective value of the problem.EvaVal
: Evaluator objective value given optimal treatment plan.SolutionMethod
: Selected solution method for problem instance.bbNode
: Number of branch and bound node used in optimizer.elapsedTime
: Elapsed time for given problem instance.matrixSamplingSize
: Matrix sampling size defined in the experimentation.
.xlsx file under ..\data\solutions
contains much more detailed statistics on problem instance. Under U_values sheet, you can find state probabilities at each timestep, and under solution you can find used antibiotics in solution.
Also notice node sizes and arc widths are different from each other. This is due to node and edges representing transition and state probabilities at each timestep.
python ABR.py --dataset msx255_SuppData2017_GRME_ABR.xlsx --initialState 1111 --n 5 --targetState 0000 --solutionMethod Multistage
Returning Matrix_useCase=optimization_type=cpm_s=10000 from existing file.
Returning Matrix_useCase=evaluator_type=cpm_s=10000 from existing file.
Saved N5_1111-0000_DP_cpm_solution.xlsx under ..\Data\Solutions.
Saved N5_1110-0000_DP_cpm_plot.png under ..\Data\Solutions.
![]() |
|
If transition probabilities and state probabilities are less than pre-defined threshold (0.01), it will not show on plot.
- The code may not work with versions of dependencies other than those specified in requirements.
- There aren't input checks for most of the cases.
- Strong2Stage, Multistage, Weak2stage requires Gurobi License.
The code in this repository is released under the MIT License.
If you use this code or the results from our paper in your own work, please cite our paper:`
@article{stoch-antibiotic,
title={A stochastic programming approach to the antibiotics time machine problem},
author={Oğuz Mesüm, Ali Rana Atilgan, Burak Kocuk},
journal={Mathematical Biosciences},
volume={},
pages={},
year={2024}
}