Пример #1
0
def test_io():
    from pytfa.io.dict import model_to_dict, model_from_dict
    from pytfa.optim.utils import copy_solver_configuration

    dictmodel = model_to_dict(tmodel)
    new = model_from_dict(dictmodel)

    copy_solver_configuration(tmodel, new)
Пример #2
0
    def copy(self):

        from ..io.dict import model_from_dict, model_to_dict
        dictmodel = model_to_dict(self)
        new = model_from_dict(dictmodel)

        copy_solver_configuration(self, new)

        return new
Пример #3
0
def test_io():
    from pytfa.io.dict import model_to_dict, model_from_dict
    from pytfa.optim.utils import copy_solver_configuration

    dictmodel = model_to_dict(small_tmodel)
    new = model_from_dict(dictmodel)

    copy_solver_configuration(small_tmodel, new)

    sol_orig = small_tmodel.slim_optimize()
    sol_new = new.slim_optimize()

    epsilon = new.solver.configuration.tolerances.optimality

    assert (abs(sol_new - sol_orig) < epsilon)
Пример #4
0
def test_io():
    from pytfa.io.dict import model_to_dict, model_from_dict
    from pytfa.optim.utils import copy_solver_configuration

    dictmodel = model_to_dict(small_tmodel)
    new = model_from_dict(dictmodel)

    copy_solver_configuration(small_tmodel, new)

    sol_orig = small_tmodel.slim_optimize()
    sol_new = new.slim_optimize()

    epsilon = 1e-5  # new.solver.configuration.tolerances.optimality is deprecated in GLPK now, see opencobra/optlang/issues/223

    assert (abs(sol_new - sol_orig) < epsilon)