Skip to content
Snippets Groups Projects
Unverified Commit f7ee5063 authored by St. Elmo's avatar St. Elmo
Browse files

added warmup test - which fails :/

parent 78d81acd
No related branches found
No related tags found
No related merge requests found
......@@ -16,17 +16,22 @@ function warmup(
modifications = [],
workerids = [myid()],
)
# create optimization problem, apply constraints, load on all workers
# create optimization problem, apply constraints
save_model = :(
begin
optmodel = $COBREXA.make_optimization_model($model, $optimizer)
for mod in $modifications
mod($model, optmodel)
end
optmodel
end
)
# load on all workers
map(fetch, save_at.(workerids, :cobrexa_sampling_warmup_optmodel, Ref(save_model)))
ret = m -> value.(m[:x]) # get all the fluxes
# generate warm up points, like FVA
ret = m -> value.(m[:x]) # get all the fluxes, not just max/min like FVA
fluxes = dpmap(
rid -> :($COBREXA._FVA_optimize_reaction(
cobrexa_sampling_warmup_optmodel,
......
@testset "Warm up point generation" begin
model_path = download_data_file(
"http://bigg.ucsd.edu/static/models/e_coli_core.json",
joinpath("data", "e_coli_core.json"),
"7bedec10576cfe935b19218dc881f3fb14f890a1871448fc19a9b4ee15b448d8",
)
model = load_model(StandardModel, model_path)
using Distributed
nps = 4 - nprocs()
# load extra processes, have at least 4 available
if 1 <= nps <= 3
addprocs(nps)
end
@everywhere using COBREXA, Tulip
# Serial test
ws, lbs, ubs = warmup(
model,
Tulip.Optimizer;
modifications = [change_constraint("EX_glc__D_e", -4, 4)],
warmup_points = collect(1:n_reactions(model)),
workerids = [myid()],
)
ind = first(indexin(["EX_glc__D_e"], reactions(model)))
@test size(ws) == (95, 2)
@test size(ws[1,1]) == (95,)
@test lbs[ind] -4
@test ubs[ind] 4
# Parallel test
ws, lbs, ubs = warmup(
model,
Tulip.Optimizer;
modifications = [change_constraint("EX_glc__D_e", -4, 4)],
warmup_points = collect(1:n_reactions(model)),
workerids = [workers()],
)
ind = first(indexin(["EX_glc__D_e"], reactions(model)))
@test size(ws) == (95, 2)
@test size(ws[1,1]) == (95,)
@test lbs[ind] -4
@test ubs[ind] 4
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment