-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFigure_S2.py
30 lines (28 loc) · 1.46 KB
/
Figure_S2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from optimization import perform_variable_maximization
from model_class import Model
from toronto_set_up_uncert import optmdfpathway_base_milp_with_osmolarity, optmdfpathway_base_variables, biomass_reaction_id
# You need to set up optmdfpathway_uncert line 207 for minus or plus
analysis_num_phi = "max_growth,phi_val,MDF\n"
MIN_MMDF = 0.01
optmdfpathway_base_variables["var_B"].bounds(MIN_MMDF, 1000)
optmdfpathway_base_variables["ATPM"].bounds(6.86,1000)
initial_phi = 0.1900
current_phi = initial_phi
theta = -0.01
while current_phi <= 0.21:
print(f"phi is {current_phi}")
optmdfpathway_base_variables["Phi_high_osm"].bounds(current_phi,1000)
optmdfpathway_base_variables["osmolarity_sum_var"].bounds(current_phi, current_phi-theta)
optmdfpathway_base_variables[biomass_reaction_id].bounds(0, 1000)
growth_optimization_result = perform_variable_maximization(optmdfpathway_base_milp_with_osmolarity, biomass_reaction_id)
print(growth_optimization_result["values"][biomass_reaction_id])
if growth_optimization_result["status"] == "Optimal":
print("Feasible!")
current_maxgrowth = growth_optimization_result["values"][biomass_reaction_id]
analysis_num_phi += f"{current_maxgrowth},{current_phi},{MIN_MMDF}\n"
current_phi = round(current_phi + 0.0001,7)
else:
print("Infeasible!")
current_phi = round(current_phi + 0.0001,7)
with open("./Results/FigureS2_minus.csv", "w") as f:
f.write(analysis_num_k)