I want to have the objective function of my model (iJO1366 - contains ~2600 reactions) to be minimize the sum of all the fluxes and the sum of 37 slack variables (or artificial fluxes) that are weighted.
so the v's are all the fluxes, beta is a scalar and the alpha's are the slack variables/artificial fluxes. When I try to set this as the objective function it takes a very long time to set up (I gave up after 15 minutes). Is there no faster way to do this than what i'm doing now which is: model.objective = model.problem.Objective( sum(r.flux_expression for r in real_rxns) + beta * sum(r.flux_expression for r in alphas_rxns), direction='min')
Thanks to anyone who helps!
I tried loading a stoichiometric matrix and somehow extract from it the right expression for the objective function (chatgpt's offer). Another thing I wanted to try is to to use set_linear_coefficients but I'm unsure of how to use it.