GithubHelp home page GithubHelp logo

Comments (7)

laurentheirendt avatar laurentheirendt commented on September 22, 2024 1

closing

from cobrexa.jl.

laurentheirendt avatar laurentheirendt commented on September 22, 2024

Do you have an example? I am missing somehow the context here :/

from cobrexa.jl.

stelmo avatar stelmo commented on September 22, 2024

Yes! So I think it is pretty important to allow users to modify analysis functions in a uniform way. Currently fba, pfba and fva have the following keyword arguments: objective_func, weights, solver_attributes, constraints. These keyword arguments are then used inside the functions to modify the problems, e.g. the user can specify (a) new objective function(s) with optional weights (if there are multiple fluxes that need to be summed), etc. The issue is that this leads to lots of duplicate code, e.g. lines 44-90 in fba are basically duplicated in pfba and fva since the modifications one would typically make are usually similar in form.

@exaexa suggested that we use callbacks to streamline all of this and gave me the following example:

function fba(...; model_mod = (m, om) -> nothing)
    om = makeOptimizationModel(...)
    model_mod(m, om) 
    optimize(om)
    return(...(om))
end

modify_weights(r::Reaction) =
    (m, om) -> begin
        ...
        @objective(om, sense, sum(opt_weights[i] * v[i] for i in objective_indices))
    end

fba(model, model_mod = [[modify_weight("ATPw"), remove_reaction("asasd")]] )

Or something similar to this?

from cobrexa.jl.

laurentheirendt avatar laurentheirendt commented on September 22, 2024

I like the idea 👍🏼 Do you think this has any effect on performance?

from cobrexa.jl.

exaexa avatar exaexa commented on September 22, 2024

effect on performance

negligible, except perhaps for the first-time compile

from cobrexa.jl.

laurentheirendt avatar laurentheirendt commented on September 22, 2024

okay cool, then go ahead 😄

from cobrexa.jl.

stelmo avatar stelmo commented on September 22, 2024

Is being addressed by #53

from cobrexa.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.