Пример #1
0
 def test_EcoliCore_cplex(self):
     solved_fluxes = minspan(self.model,
                             cores=4,
                             timelimit=30,
                             verbose=False,
                             solver_name="cplex")
     test_ecoli_core_model(self, solved_fluxes)
Пример #2
0
 def test_EcoliCore_gurobi_ipcluster(self):
     client, view = setup_cluster.start_engines()
     hotstart = null(self.S.todense())
     solved_fluxes = minspan(self.model, starting_fluxes=hotstart,
         mapper=view.map_sync, verbose=False, solver_name="cplex")
     test_ecoli_core_model(self, solved_fluxes)
     setup_cluster.stop_engines()
Пример #3
0
 def test_EcoliCore_cplex_multiprocessing(self):
     pool = Pool()
     solved_fluxes = minspan(self.model,
                             cores=2,
                             timelimit=45,
                             verbose=False,
                             solver_name="cplex",
                             mapper=pool.map)
     test_ecoli_core_model(self, solved_fluxes)
Пример #4
0
 def test_EcoliCore_gurobi_multiprocessing(self):
     pool = Pool()
     solved_fluxes = minspan(self.model,
                             cores=1,
                             timelimit=30,
                             verbose=False,
                             solver_name="gurobi",
                             mapper=pool.map)
     test_ecoli_core_model(self, solved_fluxes)
Пример #5
0
 def test_EcoliCore_gurobi_ipcluster(self):
     client, view = setup_cluster.start_engines()
     hotstart = null(self.S.todense())
     solved_fluxes = minspan(self.model,
                             starting_fluxes=hotstart,
                             mapper=view.map_sync,
                             verbose=False,
                             solver_name="cplex")
     test_ecoli_core_model(self, solved_fluxes)
     setup_cluster.stop_engines()
Пример #6
0
            v = c.direct_view()
        except Exception, e:
            print e
            sleep(5)
    return c, v


def stop_engines(mpi=False, verbose=False):
    profile = profile_minspan_mpi_dir if mpi else profile_minspan_dir
    silence = "" if verbose else "2>/dev/null"
    os.system('ipcluster stop --profile-dir="%s" %s' % (profile, silence))

if __name__ == "__main__":
    stop_engines()
    c, v = start_engines()
    print "%d engines connected" % (len(c.ids))
    from minspan import *
    from cobra.io import load_matlab_model
    from time import time
    model = load_matlab_model("testing_models.mat", "inj661")
    S = model.to_array_based_model().S
    start = time()
    solved_fluxes = minspan(model, cores=1, verbose=True, mapper=v.map_sync, starting_fluxes="auto")
    print "solved in %.2f seconds" % (time() - start)
    print "nnz", nnz(solved_fluxes)
    print "rank", matrix_rank(solved_fluxes)
    print "max(S * v) =", abs(S * solved_fluxes).max()
    
    #from IPython import embed; embed()
    stop_engines()
Пример #7
0
 def test_EcoliCore_cplex_multiprocessing(self):
     pool = Pool()
     solved_fluxes = minspan(self.model, cores=2, timelimit=45,
         verbose=False, solver_name="cplex", mapper=pool.map)
     test_ecoli_core_model(self, solved_fluxes)
Пример #8
0
 def test_EcoliCore_gurobi_multiprocessing(self):
     pool = Pool()
     solved_fluxes = minspan(self.model, cores=1, timelimit=30,
         verbose=False, solver_name="gurobi", mapper=pool.map)
     test_ecoli_core_model(self, solved_fluxes)
Пример #9
0
 def test_EcoliCore_cplex(self):
     solved_fluxes = minspan(self.model, cores=4, timelimit=30,
         verbose=False, solver_name="cplex")
     test_ecoli_core_model(self, solved_fluxes)
Пример #10
0

def stop_engines(mpi=False, verbose=False):
    profile = profile_minspan_mpi_dir if mpi else profile_minspan_dir
    silence = "" if verbose else "2>/dev/null"
    os.system('ipcluster stop --profile-dir="%s" %s' % (profile, silence))


if __name__ == "__main__":
    stop_engines()
    c, v = start_engines()
    print "%d engines connected" % (len(c.ids))
    from minspan import *
    from cobra.io import load_matlab_model
    from time import time
    model = load_matlab_model("testing_models.mat", "inj661")
    S = model.to_array_based_model().S
    start = time()
    solved_fluxes = minspan(model,
                            cores=1,
                            verbose=True,
                            mapper=v.map_sync,
                            starting_fluxes="auto")
    print "solved in %.2f seconds" % (time() - start)
    print "nnz", nnz(solved_fluxes)
    print "rank", matrix_rank(solved_fluxes)
    print "max(S * v) =", abs(S * solved_fluxes).max()

    #from IPython import embed; embed()
    stop_engines()