def flux_variability(model, reactions, fixed, tfba, solver):
fba = _get_fba_problem(model, tfba, solver)<EOL>for reaction_id, value in iteritems(fixed):<EOL><INDENT>flux = fba.get_flux_var(reaction_id)<EOL>fba.prob.add_linear_constraints(flux >= value)<EOL><DEDENT>def min_max_solve(reaction_id):<EOL><INDENT>for direction in (-<NUM_LIT:1>, <NUM_LIT:1>):<EOL><INDENT>yield fba.flux_bound(reaction_id, direction)<EOL><DEDENT><DEDENT>for reaction_id in reactions:<EOL><INDENT>yield reaction_id, tuple(min_max_solve(reaction_id))<EOL><DEDENT>
Find the variability of each reaction while fixing certain fluxes.

    Yields the reaction id, and a tuple of minimum and maximum value for each
    of the given reactions. The fixed reactions are given in a dictionary as
    a reaction id to value mapping.

    This is an implementation of flux variability analysis (FVA) as described
    in [Mahadevan03]_.

    Args:
        model: MetabolicModel to solve.
        reactions: Reactions on which to report variablity.
        fixed: dict of additional lower bounds on reaction fluxes.
        tfba: If True enable thermodynamic constraints.
        solver: LP solver instance to use.

    Returns:
        Iterator over pairs of reaction ID and bounds. Bounds are returned as
        pairs of lower and upper values.