Skip to content

Commit

Permalink
deal with infinities
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Jun 8, 2024
1 parent 0a9268a commit 9db803f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/base/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ function make_optimization_model(model::MetabolicModel, optimizer; sense = MAX_S
C = coupling(model) # empty if no coupling
isempty(C) || begin
cl, cu = coupling_bounds(model)
@constraint(optimization_model, c_lbs, cl .<= C * x) # coupling lower bounds
@constraint(optimization_model, c_ubs, C * x .<= cu) # coupling upper bounds
@constraint(
optimization_model,
c_lbs,
cl[isfinite.(cl)] .<= C[isfinite.(cl), :] * x
) # coupling lower bounds
@constraint(
optimization_model,
c_ubs,
C[isfinite.(cu), :] * x .<= cu[isfinite.(cu)]
) # coupling upper bounds
end

return optimization_model
Expand Down

0 comments on commit 9db803f

Please sign in to comment.