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)
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()
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)
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)
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()
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()