Unverified Commit ee133cb8 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

this might reveal some truth about julia namespace resolution

Thanks @htpusa for reporting the problem!
parent 8ca41feb
...@@ -44,8 +44,8 @@ function flux_variability_analysis( ...@@ -44,8 +44,8 @@ function flux_variability_analysis(
# store a JuMP optimization model at all workers # store a JuMP optimization model at all workers
save_model = :( save_model = :(
begin begin
optmodel = COBREXA.make_optimization_model($model, $optimizer) optmodel = $COBREXA.make_optimization_model($model, $optimizer)
COBREXA._FVA_add_constraint( $COBREXA._FVA_add_constraint(
optmodel, optmodel,
$(objective(model)), $(objective(model)),
optmodel[:x], optmodel[:x],
...@@ -60,7 +60,7 @@ function flux_variability_analysis( ...@@ -60,7 +60,7 @@ function flux_variability_analysis(
# schedule FVA parts parallely using pmap # schedule FVA parts parallely using pmap
fluxes = dpmap( fluxes = dpmap(
rid -> :(COBREXA._FVA_optimize_reaction(cobrexa_parfva_model, $rid)), rid -> :($COBREXA._FVA_optimize_reaction(cobrexa_parfva_model, $rid)),
CachingPool(workers), CachingPool(workers),
[-reactions reactions], [-reactions reactions],
) )
...@@ -97,7 +97,7 @@ Internal helper function for adding constraints to a model. Exists mainly ...@@ -97,7 +97,7 @@ Internal helper function for adding constraints to a model. Exists mainly
because for avoiding namespace problems on remote workers. because for avoiding namespace problems on remote workers.
""" """
function _FVA_add_constraint(model, c, x, Z0, gamma) function _FVA_add_constraint(model, c, x, Z0, gamma)
COBREXA.JuMP.@constraint(model, c' * x gamma * Z0) @constraint(model, c' * x gamma * Z0)
end end
""" """
...@@ -108,11 +108,11 @@ namespace problems. ...@@ -108,11 +108,11 @@ namespace problems.
""" """
function _FVA_optimize_reaction(model, rid) function _FVA_optimize_reaction(model, rid)
sense = rid > 0 ? MOI.MAX_SENSE : MOI.MIN_SENSE sense = rid > 0 ? MOI.MAX_SENSE : MOI.MIN_SENSE
var = COBREXA.JuMP.all_variables(model)[abs(rid)] var = all_variables(model)[abs(rid)]
COBREXA.JuMP.@objective(model, sense, var) @objective(model, sense, var)
COBREXA.JuMP.optimize!(model) optimize!(model)
return COBREXA.JuMP.objective_value(model) return objective_value(model)
end end
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment