Skip to content

Commit

Permalink
envelopes frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Jan 18, 2024
1 parent 3c225a0 commit e0689f8
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions src/frontend/envelope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,56 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
$(TYPEDSIGNATURES)
TODO
"""
function objective_production_envelope(
model::A.AbstractFBCModel,
dimensions;
reactions;
breaks = 10,
optimizer,
kwargs...,
settings = [],
workers,
)
#TODO
constraints = flux_balance_constraints(model)
rs = Symbol.(reactions)

envelope_bounds = constraints_variability(
constraints,
(r => constraints.fluxes[r] for r in rs);
optimizer,
settings,
workers,
)

#TODO check for nothings in the bounds

bss = [split_interval(envelope_bounds[r]...; breaks) for r in rs]

return (
breaks = reactions .=> bss,
objective_values = constraints_objective_envelope(
constraints,
(constraints.fluxes[r] => bs for (r, bs) in zip(rs, bss))...;
objective = model.objective.value,
optimizer,
settings,
workers,
),
)

# this converts nicely to a dataframe, but I'm not a total fan.
#=
xss = Iterators.product(bss)
@assert length(result) == length(xss)
xss = reshape(xss, tuple(length(xss)))
return (;
(r => [xs[i] for xs in xss] for (i, r) in enumerate(rs))...,
objective_value_name => reshape(result, tuple(length(result))),
)
# TODO think about it
=#
end

0 comments on commit e0689f8

Please sign in to comment.