Commit 2f461a6b authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

solveLP is now optimizeModel

parent aac41150
......@@ -8,7 +8,7 @@ s.t. S x = b
xₗ ≤ x ≤ xᵤ
```
Returns a solved model from [`solveLP`](@ref).
Returns a solved model from [`optimizeModel`](@ref).
"""
fluxBalanceAnalysis(model::LM, optimizer) where {LM<:AbstractCobraModel} =
solveLP(model, optimizer; sense = MOI.MAX_SENSE)
optimizeModel(model, optimizer; sense = MOI.MAX_SENSE)
......@@ -25,12 +25,12 @@ function makeOptimizationModel(
end
"""
solveLP(model::LM, optimizer; sense = MOI.MIN_SENSE) where {LM<:AbstractCobraModel}
optimizeModel(model::LM, optimizer; sense = MOI.MIN_SENSE) where {LM<:AbstractCobraModel}
Use JuMP to solveLP an instance of LinearModel. Returns a tuple that contains the
new model and a vector of its variables.
Use JuMP to optimize an instance of a COBRA model. Returns a tuple that
contains the new model and a vector of its variables.
"""
function solveLP(model::LM, optimizer; sense = MOI.MIN_SENSE) where {LM<:AbstractCobraModel}
function optimizeModel(model::LM, optimizer; sense = MOI.MIN_SENSE) where {LM<:AbstractCobraModel}
optimization_model, x = makeOptimizationModel(model, optimizer; sense = sense)
JuMP.optimize!(optimization_model)
return (optimization_model, x)
......
......@@ -2,13 +2,13 @@
@testset "Solve LP" begin
cp = test_simpleLP()
optimizer = GLPK.Optimizer
(lp, x) = solveLP(cp, optimizer)
(lp, x) = optimizeModel(cp, optimizer)
@test termination_status(lp) === MOI.OPTIMAL
sol = JuMP.value.(x)
@test sol [1.0, 2.0]
optimizer = Clp.Optimizer
(lp, x) = solveLP(cp, optimizer)
(lp, x) = optimizeModel(cp, optimizer)
@test termination_status(lp) === MOI.OPTIMAL
sol = JuMP.value.(x)
@test sol [1.0, 2.0]
......
Supports Markdown
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