Ejemplo n.º 1
0
 def _initialize_problem(self):
     self.problem = glp_create_prob()
     glp_create_index(self.problem)
     glp_scale_prob(self.problem, GLP_SF_AUTO)
     if self.name is not None:
         _glpk_validate_id(self.name)
         glp_set_prob_name(self.problem, str(self.name))
Ejemplo n.º 2
0
def setup_linprog(
    recipes: Dict[str, 'Recipe'],
    min_rates: Optional[Dict[str, float]] = None,
    min_clocks: Optional[Dict[str, int]] = None,
    fixed_clocks: Optional[Dict[str, int]] = None,
) -> SwigPyObject:
    if min_rates is None:
        min_rates = {}
    if min_clocks is None:
        min_clocks = {}
    if fixed_clocks is None:
        fixed_clocks = {}

    resources = sorted({p for r in recipes.values() for p in r.rates.keys()})
    resource_indices: Dict[str,
                           int] = {r: i
                                   for i, r in enumerate(resources, 1)}
    m = len(resources)
    n = len(recipes)

    problem: SwigPyObject = lp.glp_create_prob()
    lp.glp_set_prob_name(problem, 'satisfactory')
    lp.glp_set_obj_name(problem, 'percentage_sum')
    lp.glp_set_obj_dir(problem, lp.GLP_MIN)
    lp.glp_add_rows(problem, m)
    lp.glp_add_cols(problem, n)

    for i, resource in enumerate(resources, 1):
        setup_row(problem, i, resource, min_rates.get(resource, 0))

    for j, recipe in enumerate(recipes.values(), 1):
        setup_col(
            problem,
            j,
            recipe,
            resource_indices,
            min_clocks.get(recipe.name),
            fixed_clocks.get(recipe.name),
        )

    lp.glp_create_index(problem)

    return problem
Ejemplo n.º 3
0
    def _initialize_model_from_problem(self, problem):
        try:
            self.problem = problem
            glp_create_index(self.problem)
        except TypeError:
            raise TypeError("Provided problem is not a valid GLPK model.")
        row_num = glp_get_num_rows(self.problem)
        col_num = glp_get_num_cols(self.problem)
        for i in range(1, col_num + 1):
            var = Variable(
                glp_get_col_name(self.problem, i),
                lb=glp_get_col_lb(self.problem, i),
                ub=glp_get_col_ub(self.problem, i),
                problem=self,
                type=_GLPK_VTYPE_TO_VTYPE[
                    glp_get_col_kind(self.problem, i)]
            )
            # This avoids adding the variable to the glpk problem
            super(Model, self)._add_variables([var])
        variables = self.variables

        for j in range(1, row_num + 1):
            ia = intArray(col_num + 1)
            da = doubleArray(col_num + 1)
            nnz = glp_get_mat_row(self.problem, j, ia, da)
            constraint_variables = [variables[ia[i] - 1] for i in range(1, nnz + 1)]

            # Since constraint expressions are lazily retrieved from the solver they don't have to be built here
            # lhs = _unevaluated_Add(*[da[i] * constraint_variables[i - 1]
            #                         for i in range(1, nnz + 1)])
            lhs = 0

            glpk_row_type = glp_get_row_type(self.problem, j)
            if glpk_row_type == GLP_FX:
                row_lb = glp_get_row_lb(self.problem, j)
                row_ub = row_lb
            elif glpk_row_type == GLP_LO:
                row_lb = glp_get_row_lb(self.problem, j)
                row_ub = None
            elif glpk_row_type == GLP_UP:
                row_lb = None
                row_ub = glp_get_row_ub(self.problem, j)
            elif glpk_row_type == GLP_DB:
                row_lb = glp_get_row_lb(self.problem, j)
                row_ub = glp_get_row_ub(self.problem, j)
            elif glpk_row_type == GLP_FR:
                row_lb = None
                row_ub = None
            else:
                raise Exception(
                    "Currently, optlang does not support glpk row type %s"
                    % str(glpk_row_type)
                )
                log.exception()
            if isinstance(lhs, int):
                lhs = symbolics.Integer(lhs)
            elif isinstance(lhs, float):
                lhs = symbolics.Real(lhs)
            constraint_id = glp_get_row_name(self.problem, j)
            for variable in constraint_variables:
                try:
                    self._variables_to_constraints_mapping[variable.name].add(constraint_id)
                except KeyError:
                    self._variables_to_constraints_mapping[variable.name] = set([constraint_id])

            super(Model, self)._add_constraints(
                [Constraint(lhs, lb=row_lb, ub=row_ub, name=constraint_id, problem=self, sloppy=True)],
                sloppy=True
            )

        term_generator = (
            (glp_get_obj_coef(self.problem, index), variables[index - 1])
            for index in range(1, glp_get_num_cols(problem) + 1)
        )
        self._objective = Objective(
            symbolics.add(
                [symbolics.mul((symbolics.Real(term[0]), term[1])) for term in term_generator if
                 term[0] != 0.]
            ),
            problem=self,
            direction={GLP_MIN: 'min', GLP_MAX: 'max'}[glp_get_obj_dir(self.problem)])
        glp_scale_prob(self.problem, GLP_SF_AUTO)
Ejemplo n.º 4
0
def test_solve_with_glpsol():
    problem = glp_create_prob()
    glp_read_lp(problem, None, TESTMODELPATH)
    glp_create_index(problem)
    result = solve_with_glpsol(problem)
    reference = {'M_13dpg_c': ['5', '0', '-0.0471054946649844'], 'R_ME1': ['2', '0', '-0.00509248590972805'],
                 'R_ME2': ['2', '0', '-0.00381936443229605'], 'R_EX_acald_e': ['2', '0', '-0.0343742798906643'],
                 'R_EX_pi_e': ['1', '-3.21489504768477', '0'], 'R_PTAr': ['1', '0', '0'],
                 'M_g6p_c': ['5', '0', '-0.0980303537622649'], 'R_THD2': ['2', '0', '-0.00127312147743202'],
                 'M_s7p_c': ['5', '0', '-0.113307811491449'], 'M_glu_L_c': ['5', '0', '-0.0700216812587607'],
                 'R_TKT1': ['1', '1.49698375726157', '0'], 'M_glu_L_e': ['5', '0', '-0.0687485597813287'],
                 'R_CO2t': ['1', '-22.809833310205', '0'], 'R_PFL': ['1', '5.31182206840464e-31', '0'],
                 'M_nadp_c': ['5', '0', '0.00891185034202407'], 'R_ICL': ['1', '0', '0'], 'M_h2o_c': ['5', '0', '-0'],
                 'M_amp_c': ['5', '0', '0.0101849718194561'], 'M_f6p_c': ['5', '0', '-0.0980303537622649'],
                 'M_h2o_e': ['5', '0', '-0'], 'M_ac_c': ['5', '0', '-0.0241893080712082'],
                 'M_ac_e': ['5', '0', '-0.0229161865937762'], 'R_NH4t': ['1', '4.76531919319746', '0'],
                 'M_adp_c': ['5', '0', '0.00509248590972805'], 'M_nh4_e': ['5', '0', '-0'],
                 'M_gln_L_c': ['5', '0', '-0.0751141671684887'], 'M_gln_L_e': ['5', '0', '-0.0700216812587607'],
                 'M_succoa_c': ['5', '0', '-0.0547442235295765'], 'M_nh4_c': ['5', '0', '-0'],
                 'R_H2Ot': ['1', '-29.1758271355658', '0'], 'R_EX_glu_L_e': ['2', '0', '-0.0687485597813287'],
                 'M_icit_c': ['5', '0', '-0.0712948027361927'], 'M_q8h2_c': ['1', '-7.105427357601e-15', '0'],
                 'R_FORt2': ['2', '0', '-0.00127312147743201'], 'R_ADK1': ['1', '0', '0'],
                 'M_glx_c': ['5', '0', '-0.0203699436389122'], 'M_glc_D_e': ['5', '0', '-0.0916647463751049'],
                 'M_lac_D_c': ['5', '0', '-0.0420130087552564'], 'M_lac_D_e': ['5', '0', '-0.0407398872778244'],
                 'M_acald_e': ['5', '0', '-0.0343742798906643'], 'M_acald_c': ['5', '0', '-0.0343742798906643'],
                 'R_RPE': ['1', '2.67848185050753', '0'], 'R_EX_for_e': ['2', '0', '-0.00763872886459208'],
                 'M_dhap_c': ['5', '0', '-0.0521979805747125'], 'M_pyr_c': ['5', '0', '-0.0356474013680963'],
                 'M_pyr_e': ['5', '0', '-0.0343742798906643'], 'M_fdp_c': ['5', '0', '-0.104395961149425'],
                 'R_PGM': ['1', '-14.7161395687428', '0'], 'R_PGL': ['1', '4.95998494457466', '0'],
                 'R_PGK': ['1', '-16.0235261431676', '0'], 'M_3pg_c': ['5', '0', '-0.0420130087552564'],
                 'M_coa_c': ['1', '-1.77635683940025e-15', '0'], 'R_FRD7': ['2', '0', '0'],
                 'R_EX_gln_L_e': ['2', '0', '-0.0700216812587607'], 'R_GLCpts': ['1', '10', '0'],
                 'R_SUCCt3': ['1', '0', '0'], 'R_ATPM': ['2', '8.39', '-0.00509248590972805'],
                 'M_succ_e': ['5', '0', '-0.0521979805747125'], 'M_succ_c': ['5', '0', '-0.0509248590972805'],
                 'R_EX_lac_D_e': ['2', '0', '-0.0407398872778244'], 'R_O2t': ['1', '21.7994926559988', '0'],
                 'M_2pg_c': ['5', '0', '-0.0420130087552564'], 'R_CS': ['1', '6.00724957535033', '0'],
                 'R_PDH': ['1', '9.28253259916661', '0'], 'R_CYTBD': ['1', '43.5989853119975', '0'],
                 'R_ETOHt2r': ['1', '-0', '0'], 'R_FBP': ['2', '0', '-0.00509248590972805'], 'R_ACKr': ['1', '0', '0'],
                 'R_GLUSy': ['2', '0', '-0.00509248590972804'], 'M_fru_e': ['5', '0', '-0.0916647463751049'],
                 'R_G6PDH2r': ['1', '4.95998494457466', '0'], 'R_EX_co2_e': ['1', '22.809833310205', '0'],
                 'R_TKT2': ['1', '1.18149809324596', '0'], 'R_GLUDy': ['1', '-4.54185746386563', '0'],
                 'R_EX_fru_e': ['2', '0', '-0.0916647463751049'], 'R_NADTRHD': ['2', '0', '-0.001273121477432'],
                 'R_PYRt2r': ['1', '-0', '0'], 'R_FUMt2_2': ['1', '0', '0'], 'R_SUCDi': ['1', '5.06437566148209', '0'],
                 'R_ALCD2x': ['1', '-5.84859702315521e-30', '0'], 'R_EX_o2_e': ['1', '-21.7994926559988', '0'],
                 'M_g3p_c': ['5', '0', '-0.0521979805747125'], 'R_EX_akg_e':
                     ['2', '0', '-0.0611098309167366'], 'R_GLUt2r': ['1', '-0', '0'],
                 'M_pi_c': ['5', '0', '-0.00127312147743201'],
                 'M_pi_e': ['5', '0', '-0'], 'R_LDH_D': ['1', '0', '0'], 'M_o2_c': ['5', '0', '-0'],
                 'M_atp_c': ['1', '0', '0'], 'M_o2_e': ['5', '0', '-0'], 'R_MALt2_2': ['1', '0', '0'],
                 'R_FBA': ['1', '7.47738196216028', '0'], 'M_for_c': ['5', '0', '-0.00763872886459208'],
                 'R_EX_pyr_e': ['2', '0', '-0.0343742798906643'], 'R_EX_h_e': ['1', '17.5308654297867', '0'],
                 'R_MALS': ['2', '0', '-0.001273121477432'], 'M_h_c': ['5', '0', '0.00127312147743201'],
                 'M_h_e': ['5', '0', '-0'], 'R_TALA': ['1', '1.49698375726157', '0'],
                 'R_SUCOAS': ['1', '-5.06437566148209', '0'], 'M_pep_c': ['5', '0', '-0.0420130087552564'],
                 'R_ICDHyr': ['1', '6.00724957535033', '0'], 'R_RPI': ['1', '-2.28150309406713', '0'],
                 'M_accoa_c': ['5', '0', '-0.0280086725035043'], 'R_EX_ac_e': ['2', '0', '-0.0229161865937762'],
                 'M_6pgl_c': ['5', '0', '-0.0903916248976729'], 'R_PFK': ['1', '7.47738196216028', '0'],
                 'M_oaa_c': ['5', '0', '-0.0420130087552564'], 'R_EX_glc_e': ['2', '-10', '-0.0916647463751049'],
                 'R_EX_h2o_e': ['1', '29.1758271355658', '0'], 'M_mal_L_c': ['5', '0', '-0.0483786161424165'],
                 'R_EX_nh4_e': ['1', '-4.76531919319746', '0'], 'M_acon_C_c': ['5', '0', '-0.0712948027361927'],
                 'R_ACALDt': ['1', '0', '0'], 'R_GLNS': ['1', '0.223461729331828', '0'],
                 'M_r5p_c': ['5', '0', '-0.0827528960330808'], 'R_ACONTb': ['1', '6.00724957535033', '0'],
                 'M_actp_c': ['5', '0', '-0.0292817939809363'], 'M_cit_c': ['5', '0', '-0.0712948027361927'],
                 'M_mal_L_e': ['5', '0', '-0.0458323731875524'], 'M_akg_c': ['5', '0', '-0.0623829523941686'],
                 'M_akg_e': ['5', '0', '-0.0611098309167366'], 'R_D_LACt2': ['1', '-0', '0'],
                 'R_ATPS4r': ['1', '45.5140097745175', '0'], 'M_ru5p_D_c': ['5', '0', '-0.0827528960330808'],
                 'R_TPI': ['1', '7.47738196216028', '0'], 'R_PPCK': ['2', '0', '-0.00509248590972805'],
                 'R_SUCCt2_2': ['2', '0', '-0.00381936443229604'], 'M_e4p_c': ['5', '0', '-0.0674754383038966'],
                 'R_NADH16': ['1', '38.5346096505154', '0'],
                 'R_Biomass_Ecoli_core_w_GAM': ['1', '0.87392150696843', '0'], 'R_GAPD': ['1', '16.0235261431676', '0'],
                 'R_PGI': ['1', '4.86086114649682', '0'], 'R_GLNabc': ['1', '0', '0'],
                 'R_AKGDH': ['1', '5.06437566148209', '0'], 'R_MDH': ['1', '5.06437566148209', '0'],
                 'R_EX_fum_e': ['2', '0', '-0.0458323731875524'], 'R_PYK': ['1', '1.75817744410678', '0'],
                 'M_etoh_c': ['5', '0', '-0.0407398872778244'], 'M_fum_c': ['5', '0', '-0.0483786161424165'],
                 'M_q8_c': ['5', '0', '0.00254624295486403'], 'M_etoh_e': ['5', '0', '-0.0394667658003924'],
                 'M_fum_e': ['5', '0', '-0.0458323731875524'], 'R_FRUpts2': ['1', '0', '0'],
                 'M_nadph_c': ['1', '-8.88178419700125e-16', '0'], 'R_ENO': ['1', '14.7161395687428', '0'],
                 'R_PIt2r': ['1', '3.21489504768477', '0'], 'R_EX_mal_L_e': ['2', '0', '-0.0458323731875524'],
                 'R_ACALD': ['1', '-5.84859702315521e-30', '0'], 'M_for_e': ['5', '0', '-0.00763872886459208'],
                 'M_nad_c': ['5', '0', '0.00763872886459208'], 'M_6pgc_c': ['5', '0', '-0.0916647463751049'],
                 'R_FORti': ['1', '5.31182206840464e-31', '0'], 'M_co2_c': ['5', '0', '-0'],
                 'R_PPS': ['2', '0', '-0.00509248590972805'], 'M_co2_e': ['5', '0', '-0'],
                 'R_EX_succ_e': ['2', '0', '-0.0521979805747125'], 'R_ACONTa': ['1', '6.00724957535033', '0'],
                 'M_nadh_c': ['1', '5.32907051820075e-15', '0'], 'R_FUM': ['1', '5.06437566148209', '0'],
                 'R_GND': ['1', '4.95998494457465', '0'], 'R_ACt2r': ['1', '-0', '0'],
                 'R_PPC': ['1', '2.50430947036873', '0'], 'R_EX_etoh_e': ['2', '0', '-0.0394667658003924'],
                 'R_AKGt2r': ['1', '-0', '0'], 'R_GLUN': ['2', '0', '-0.00509248590972805']}
    for key, val in six.iteritems(result):
        assert val == reference[key]
Ejemplo n.º 5
0
    def __init__(self, problem=None, *args, **kwargs):

        super(Model, self).__init__(*args, **kwargs)

        self.configuration = Configuration()

        if problem is None:
            self.problem = glp_create_prob()
            glp_create_index(self.problem)
            if self.name is not None:
                glp_set_prob_name(self.problem, str(self.name))

        else:
            try:
                self.problem = problem
                glp_create_index(self.problem)
            except TypeError:
                raise TypeError("Provided problem is not a valid GLPK model.")
            row_num = glp_get_num_rows(self.problem)
            col_num = glp_get_num_cols(self.problem)
            for i in range(1, col_num + 1):
                var = Variable(
                    glp_get_col_name(self.problem, i),
                    lb=glp_get_col_lb(self.problem, i),
                    ub=glp_get_col_ub(self.problem, i),
                    problem=self,
                    type=_GLPK_VTYPE_TO_VTYPE[
                        glp_get_col_kind(self.problem, i)]
                )
                # This avoids adding the variable to the glpk problem
                super(Model, self)._add_variables([var])
            variables = self.variables

            for j in range(1, row_num + 1):
                ia = intArray(col_num + 1)
                da = doubleArray(col_num + 1)
                nnz = glp_get_mat_row(self.problem, j, ia, da)
                constraint_variables = [variables[ia[i] - 1] for i in range(1, nnz + 1)]

                # Since constraint expressions are lazily retrieved from the solver they don't have to be built here
                # lhs = _unevaluated_Add(*[da[i] * constraint_variables[i - 1]
                #                         for i in range(1, nnz + 1)])
                lhs = 0

                glpk_row_type = glp_get_row_type(self.problem, j)
                if glpk_row_type == GLP_FX:
                    row_lb = glp_get_row_lb(self.problem, j)
                    row_ub = row_lb
                elif glpk_row_type == GLP_LO:
                    row_lb = glp_get_row_lb(self.problem, j)
                    row_ub = None
                elif glpk_row_type == GLP_UP:
                    row_lb = None
                    row_ub = glp_get_row_ub(self.problem, j)
                elif glpk_row_type == GLP_DB:
                    row_lb = glp_get_row_lb(self.problem, j)
                    row_ub = glp_get_row_ub(self.problem, j)
                elif glpk_row_type == GLP_FR:
                    row_lb = None
                    row_ub = None
                else:
                    raise Exception(
                        "Currently, optlang does not support glpk row type %s"
                        % str(glpk_row_type)
                    )
                    log.exception()
                if isinstance(lhs, int):
                    lhs = sympy.Integer(lhs)
                elif isinstance(lhs, float):
                    lhs = sympy.RealNumber(lhs)
                constraint_id = glp_get_row_name(self.problem, j)
                for variable in constraint_variables:
                    try:
                        self._variables_to_constraints_mapping[variable.name].add(constraint_id)
                    except KeyError:
                        self._variables_to_constraints_mapping[variable.name] = set([constraint_id])

                super(Model, self)._add_constraints(
                    [Constraint(lhs, lb=row_lb, ub=row_ub, name=constraint_id, problem=self, sloppy=True)],
                    sloppy=True
                )

            term_generator = (
                (glp_get_obj_coef(self.problem, index), variables[index - 1])
                for index in range(1, glp_get_num_cols(problem) + 1)
            )
            self._objective = Objective(
                _unevaluated_Add(
                    *[_unevaluated_Mul(sympy.RealNumber(term[0]), term[1]) for term in term_generator if
                      term[0] != 0.]),
                problem=self,
                direction={GLP_MIN: 'min', GLP_MAX: 'max'}[glp_get_obj_dir(self.problem)])
        glp_scale_prob(self.problem, GLP_SF_AUTO)
Ejemplo n.º 6
0
def test_solve_with_glpsol():
    problem = glp_create_prob()
    glp_read_lp(problem, None, TESTMODELPATH)
    glp_create_index(problem)
    result = solve_with_glpsol(problem)
    reference = {
        'M_13dpg_c': ['5', '0', '-0.0471054946649844'],
        'R_ME1': ['2', '0', '-0.00509248590972805'],
        'R_ME2': ['2', '0', '-0.00381936443229605'],
        'R_EX_acald_e': ['2', '0', '-0.0343742798906643'],
        'R_EX_pi_e': ['1', '-3.21489504768477', '0'],
        'R_PTAr': ['1', '0', '0'],
        'M_g6p_c': ['5', '0', '-0.0980303537622649'],
        'R_THD2': ['2', '0', '-0.00127312147743202'],
        'M_s7p_c': ['5', '0', '-0.113307811491449'],
        'M_glu_L_c': ['5', '0', '-0.0700216812587607'],
        'R_TKT1': ['1', '1.49698375726157', '0'],
        'M_glu_L_e': ['5', '0', '-0.0687485597813287'],
        'R_CO2t': ['1', '-22.809833310205', '0'],
        'R_PFL': ['1', '5.31182206840464e-31', '0'],
        'M_nadp_c': ['5', '0', '0.00891185034202407'],
        'R_ICL': ['1', '0', '0'],
        'M_h2o_c': ['5', '0', '-0'],
        'M_amp_c': ['5', '0', '0.0101849718194561'],
        'M_f6p_c': ['5', '0', '-0.0980303537622649'],
        'M_h2o_e': ['5', '0', '-0'],
        'M_ac_c': ['5', '0', '-0.0241893080712082'],
        'M_ac_e': ['5', '0', '-0.0229161865937762'],
        'R_NH4t': ['1', '4.76531919319746', '0'],
        'M_adp_c': ['5', '0', '0.00509248590972805'],
        'M_nh4_e': ['5', '0', '-0'],
        'M_gln_L_c': ['5', '0', '-0.0751141671684887'],
        'M_gln_L_e': ['5', '0', '-0.0700216812587607'],
        'M_succoa_c': ['5', '0', '-0.0547442235295765'],
        'M_nh4_c': ['5', '0', '-0'],
        'R_H2Ot': ['1', '-29.1758271355658', '0'],
        'R_EX_glu_L_e': ['2', '0', '-0.0687485597813287'],
        'M_icit_c': ['5', '0', '-0.0712948027361927'],
        'M_q8h2_c': ['1', '-7.105427357601e-15', '0'],
        'R_FORt2': ['2', '0', '-0.00127312147743201'],
        'R_ADK1': ['1', '0', '0'],
        'M_glx_c': ['5', '0', '-0.0203699436389122'],
        'M_glc_D_e': ['5', '0', '-0.0916647463751049'],
        'M_lac_D_c': ['5', '0', '-0.0420130087552564'],
        'M_lac_D_e': ['5', '0', '-0.0407398872778244'],
        'M_acald_e': ['5', '0', '-0.0343742798906643'],
        'M_acald_c': ['5', '0', '-0.0343742798906643'],
        'R_RPE': ['1', '2.67848185050753', '0'],
        'R_EX_for_e': ['2', '0', '-0.00763872886459208'],
        'M_dhap_c': ['5', '0', '-0.0521979805747125'],
        'M_pyr_c': ['5', '0', '-0.0356474013680963'],
        'M_pyr_e': ['5', '0', '-0.0343742798906643'],
        'M_fdp_c': ['5', '0', '-0.104395961149425'],
        'R_PGM': ['1', '-14.7161395687428', '0'],
        'R_PGL': ['1', '4.95998494457466', '0'],
        'R_PGK': ['1', '-16.0235261431676', '0'],
        'M_3pg_c': ['5', '0', '-0.0420130087552564'],
        'M_coa_c': ['1', '-1.77635683940025e-15', '0'],
        'R_FRD7': ['2', '0', '0'],
        'R_EX_gln_L_e': ['2', '0', '-0.0700216812587607'],
        'R_GLCpts': ['1', '10', '0'],
        'R_SUCCt3': ['1', '0', '0'],
        'R_ATPM': ['2', '8.39', '-0.00509248590972805'],
        'M_succ_e': ['5', '0', '-0.0521979805747125'],
        'M_succ_c': ['5', '0', '-0.0509248590972805'],
        'R_EX_lac_D_e': ['2', '0', '-0.0407398872778244'],
        'R_O2t': ['1', '21.7994926559988', '0'],
        'M_2pg_c': ['5', '0', '-0.0420130087552564'],
        'R_CS': ['1', '6.00724957535033', '0'],
        'R_PDH': ['1', '9.28253259916661', '0'],
        'R_CYTBD': ['1', '43.5989853119975', '0'],
        'R_ETOHt2r': ['1', '-0', '0'],
        'R_FBP': ['2', '0', '-0.00509248590972805'],
        'R_ACKr': ['1', '0', '0'],
        'R_GLUSy': ['2', '0', '-0.00509248590972804'],
        'M_fru_e': ['5', '0', '-0.0916647463751049'],
        'R_G6PDH2r': ['1', '4.95998494457466', '0'],
        'R_EX_co2_e': ['1', '22.809833310205', '0'],
        'R_TKT2': ['1', '1.18149809324596', '0'],
        'R_GLUDy': ['1', '-4.54185746386563', '0'],
        'R_EX_fru_e': ['2', '0', '-0.0916647463751049'],
        'R_NADTRHD': ['2', '0', '-0.001273121477432'],
        'R_PYRt2r': ['1', '-0', '0'],
        'R_FUMt2_2': ['1', '0', '0'],
        'R_SUCDi': ['1', '5.06437566148209', '0'],
        'R_ALCD2x': ['1', '-5.84859702315521e-30', '0'],
        'R_EX_o2_e': ['1', '-21.7994926559988', '0'],
        'M_g3p_c': ['5', '0', '-0.0521979805747125'],
        'R_EX_akg_e': ['2', '0', '-0.0611098309167366'],
        'R_GLUt2r': ['1', '-0', '0'],
        'M_pi_c': ['5', '0', '-0.00127312147743201'],
        'M_pi_e': ['5', '0', '-0'],
        'R_LDH_D': ['1', '0', '0'],
        'M_o2_c': ['5', '0', '-0'],
        'M_atp_c': ['1', '0', '0'],
        'M_o2_e': ['5', '0', '-0'],
        'R_MALt2_2': ['1', '0', '0'],
        'R_FBA': ['1', '7.47738196216028', '0'],
        'M_for_c': ['5', '0', '-0.00763872886459208'],
        'R_EX_pyr_e': ['2', '0', '-0.0343742798906643'],
        'R_EX_h_e': ['1', '17.5308654297867', '0'],
        'R_MALS': ['2', '0', '-0.001273121477432'],
        'M_h_c': ['5', '0', '0.00127312147743201'],
        'M_h_e': ['5', '0', '-0'],
        'R_TALA': ['1', '1.49698375726157', '0'],
        'R_SUCOAS': ['1', '-5.06437566148209', '0'],
        'M_pep_c': ['5', '0', '-0.0420130087552564'],
        'R_ICDHyr': ['1', '6.00724957535033', '0'],
        'R_RPI': ['1', '-2.28150309406713', '0'],
        'M_accoa_c': ['5', '0', '-0.0280086725035043'],
        'R_EX_ac_e': ['2', '0', '-0.0229161865937762'],
        'M_6pgl_c': ['5', '0', '-0.0903916248976729'],
        'R_PFK': ['1', '7.47738196216028', '0'],
        'M_oaa_c': ['5', '0', '-0.0420130087552564'],
        'R_EX_glc_e': ['2', '-10', '-0.0916647463751049'],
        'R_EX_h2o_e': ['1', '29.1758271355658', '0'],
        'M_mal_L_c': ['5', '0', '-0.0483786161424165'],
        'R_EX_nh4_e': ['1', '-4.76531919319746', '0'],
        'M_acon_C_c': ['5', '0', '-0.0712948027361927'],
        'R_ACALDt': ['1', '0', '0'],
        'R_GLNS': ['1', '0.223461729331828', '0'],
        'M_r5p_c': ['5', '0', '-0.0827528960330808'],
        'R_ACONTb': ['1', '6.00724957535033', '0'],
        'M_actp_c': ['5', '0', '-0.0292817939809363'],
        'M_cit_c': ['5', '0', '-0.0712948027361927'],
        'M_mal_L_e': ['5', '0', '-0.0458323731875524'],
        'M_akg_c': ['5', '0', '-0.0623829523941686'],
        'M_akg_e': ['5', '0', '-0.0611098309167366'],
        'R_D_LACt2': ['1', '-0', '0'],
        'R_ATPS4r': ['1', '45.5140097745175', '0'],
        'M_ru5p_D_c': ['5', '0', '-0.0827528960330808'],
        'R_TPI': ['1', '7.47738196216028', '0'],
        'R_PPCK': ['2', '0', '-0.00509248590972805'],
        'R_SUCCt2_2': ['2', '0', '-0.00381936443229604'],
        'M_e4p_c': ['5', '0', '-0.0674754383038966'],
        'R_NADH16': ['1', '38.5346096505154', '0'],
        'R_Biomass_Ecoli_core_w_GAM': ['1', '0.87392150696843', '0'],
        'R_GAPD': ['1', '16.0235261431676', '0'],
        'R_PGI': ['1', '4.86086114649682', '0'],
        'R_GLNabc': ['1', '0', '0'],
        'R_AKGDH': ['1', '5.06437566148209', '0'],
        'R_MDH': ['1', '5.06437566148209', '0'],
        'R_EX_fum_e': ['2', '0', '-0.0458323731875524'],
        'R_PYK': ['1', '1.75817744410678', '0'],
        'M_etoh_c': ['5', '0', '-0.0407398872778244'],
        'M_fum_c': ['5', '0', '-0.0483786161424165'],
        'M_q8_c': ['5', '0', '0.00254624295486403'],
        'M_etoh_e': ['5', '0', '-0.0394667658003924'],
        'M_fum_e': ['5', '0', '-0.0458323731875524'],
        'R_FRUpts2': ['1', '0', '0'],
        'M_nadph_c': ['1', '-8.88178419700125e-16', '0'],
        'R_ENO': ['1', '14.7161395687428', '0'],
        'R_PIt2r': ['1', '3.21489504768477', '0'],
        'R_EX_mal_L_e': ['2', '0', '-0.0458323731875524'],
        'R_ACALD': ['1', '-5.84859702315521e-30', '0'],
        'M_for_e': ['5', '0', '-0.00763872886459208'],
        'M_nad_c': ['5', '0', '0.00763872886459208'],
        'M_6pgc_c': ['5', '0', '-0.0916647463751049'],
        'R_FORti': ['1', '5.31182206840464e-31', '0'],
        'M_co2_c': ['5', '0', '-0'],
        'R_PPS': ['2', '0', '-0.00509248590972805'],
        'M_co2_e': ['5', '0', '-0'],
        'R_EX_succ_e': ['2', '0', '-0.0521979805747125'],
        'R_ACONTa': ['1', '6.00724957535033', '0'],
        'M_nadh_c': ['1', '5.32907051820075e-15', '0'],
        'R_FUM': ['1', '5.06437566148209', '0'],
        'R_GND': ['1', '4.95998494457465', '0'],
        'R_ACt2r': ['1', '-0', '0'],
        'R_PPC': ['1', '2.50430947036873', '0'],
        'R_EX_etoh_e': ['2', '0', '-0.0394667658003924'],
        'R_AKGt2r': ['1', '-0', '0'],
        'R_GLUN': ['2', '0', '-0.00509248590972805']
    }
    for key, val in six.iteritems(result):
        assert val == reference[key]