Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
10eae1d9
Unverified
Commit
10eae1d9
authored
Aug 04, 2021
by
Miroslav Kratochvil
Committed by
GitHub
Aug 04, 2021
Browse files
Merge pull request #404 from LCSB-BioCore/mo-jump-cobrexa-fix
Fix error with screen and `unregister`
parents
bc215ecf
8c4d50c4
Pipeline
#44938
passed with stages
in 35 minutes and 36 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/analysis/flux_balance_analysis.jl
View file @
10eae1d9
...
...
@@ -80,6 +80,6 @@ function flux_balance_analysis(
mod
(
model
,
opt_model
)
end
COBREXA
.
JuMP
.
optimize!
(
opt_model
)
optimize!
(
opt_model
)
return
opt_model
end
src/analysis/modifications/optimizer.jl
View file @
10eae1d9
...
...
@@ -9,7 +9,7 @@ If you want to change the objective and sense at the same time, use
[`change_objective`](@ref) instead to do both at once.
"""
function
change_sense
(
objective_sense
)
(
model
,
opt_model
)
->
COBREXA
.
JuMP
.
set_objective_sense
(
opt_model
,
objective_sense
)
(
model
,
opt_model
)
->
set_objective_sense
(
opt_model
,
objective_sense
)
end
"""
...
...
@@ -22,7 +22,7 @@ problems that may require different optimizers for different parts, such as the
[`parsimonious_flux_balance_analysis`](@ref).
"""
function
change_optimizer
(
optimizer
)
(
model
,
opt_model
)
->
COBREXA
.
JuMP
.
set_optimizer
(
opt_model
,
optimizer
)
(
model
,
opt_model
)
->
set_optimizer
(
opt_model
,
optimizer
)
end
"""
...
...
@@ -33,8 +33,7 @@ to the JuMP documentation and the documentation of the specific optimizer for
usable keys and values.
"""
function
change_optimizer_attribute
(
attribute_key
,
value
)
(
model
,
opt_model
)
->
COBREXA
.
JuMP
.
set_optimizer_attribute
(
opt_model
,
attribute_key
,
value
)
(
model
,
opt_model
)
->
set_optimizer_attribute
(
opt_model
,
attribute_key
,
value
)
end
"""
...
...
src/analysis/parsimonious_flux_balance_analysis.jl
View file @
10eae1d9
...
...
@@ -65,7 +65,7 @@ function parsimonious_flux_balance_analysis(
# get the objective
Z
=
objective_value
(
opt_model
)
original_objective
=
COBREXA
.
JuMP
.
objective_function
(
opt_model
)
original_objective
=
objective_function
(
opt_model
)
# prepare the model for pFBA
for
mod
in
qp_modifications
...
...
@@ -84,8 +84,8 @@ function parsimonious_flux_balance_analysis(
optimize!
(
opt_model
)
is_solved
(
opt_model
)
&&
break
COBREXA
.
JuMP
.
delete
(
opt_model
,
pfba_constraint
)
COBREXA
.
JuMP
.
unregister
(
opt_model
,
:
pfba_constraint
)
delete
(
opt_model
,
pfba_constraint
)
unregister
(
opt_model
,
:
pfba_constraint
)
end
is_solved
(
opt_model
)
||
return
nothing
# pFBA failed
...
...
src/analysis/sampling/warmup_variability.jl
View file @
10eae1d9
...
...
@@ -72,7 +72,7 @@ function warmup_from_variability(
rid
->
:
(
$
COBREXA
.
_FVA_optimize_reaction
(
cobrexa_sampling_warmup_optmodel
,
$
rid
,
optmodel
->
$
COBREXA
.
JuMP
.
value
.
(
optmodel
[
:
x
]),
optmodel
->
$
JuMP
.
value
.
(
optmodel
[
:
x
]),
)),
CachingPool
(
workers
),
vcat
(
-
min_reactions
,
max_reactions
),
...
...
src/base/constants.jl
View file @
10eae1d9
...
...
@@ -56,5 +56,5 @@ const _constants = (
),
)
const
MAX_SENSE
=
COBREXA
.
MOI
.
MAX_SENSE
const
MIN_SENSE
=
COBREXA
.
MOI
.
MIN_SENSE
const
MAX_SENSE
=
MOI
.
MAX_SENSE
const
MIN_SENSE
=
MOI
.
MIN_SENSE
src/base/solver.jl
View file @
10eae1d9
...
...
@@ -16,7 +16,7 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MOI.M
m
,
n
=
size
(
stoichiometry
(
model
))
xl
,
xu
=
bounds
(
model
)
optimization_model
=
COBREXA
.
JuMP
.
Model
(
optimizer
)
optimization_model
=
Model
(
optimizer
)
@variable
(
optimization_model
,
x
[
i
=
1
:
n
])
@objective
(
optimization_model
,
sense
,
objective
(
model
)
'
*
x
)
@constraint
(
optimization_model
,
mb
,
stoichiometry
(
model
)
*
x
.==
balance
(
model
))
# mass balance
...
...
@@ -42,7 +42,7 @@ Use JuMP to solve an instance of CoreModel
"""
function
optimize_model
(
model
::
MetabolicModel
,
optimizer
;
sense
=
MOI
.
MIN_SENSE
)
optimization_model
=
make_optimization_model
(
model
,
optimizer
;
sense
=
sense
)
COBREXA
.
JuMP
.
optimize!
(
optimization_model
)
optimize!
(
optimization_model
)
return
optimization_model
end
...
...
@@ -55,8 +55,7 @@ optimal). Return `false` if any other termination status is reached.
Termination status is defined in the documentation of `JuMP`.
"""
function
is_solved
(
optmodel
)
COBREXA
.
JuMP
.
termination_status
(
optmodel
)
in
[
MOI
.
OPTIMAL
,
MOI
.
LOCALLY_SOLVED
]
?
true
:
false
termination_status
(
optmodel
)
in
[
MOI
.
OPTIMAL
,
MOI
.
LOCALLY_SOLVED
]
?
true
:
false
end
function
optimize_objective
(
optmodel
)
::
Union
{
Float64
,
Nothing
}
...
...
cylon-x
🤖
@cylon-x
mentioned in commit
7e96d7b5
·
Aug 04, 2021
mentioned in commit
7e96d7b5
mentioned in commit 7e96d7b5ae756723132448e60377d8664fc4f32b
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment