Ejemplo n.º 1
0
Archivo: test.cpp Proyecto: kgori/pllpy
int main(int argc, char const *argv[])
{
    std::string FILE="/homes/kgori/scratch/basic_pll/GGPS1.phy";
    std::string PART="/homes/kgori/scratch/basic_pll/GGPS1.partitions.txt";
    std::string TREE="/homes/kgori/scratch/basic_pll/GGPS1.tree";

    auto inst = make_unique<pll>(FILE, PART, TREE, 1, 123);
    std::cout << inst->get_likelihood() << std::endl;
    std::cout << inst->get_partition_name(0) << std::endl;
    std::cout << inst->get_model_name(0) << std::endl;
    std::cout << inst->get_epsilon() << std::endl;
    std::cout << inst->get_alpha(0) << std::endl;
    std::cout << inst->get_number_of_partitions() << std::endl;
    std::cout << inst->get_tree() << std::endl;
    std::cout << inst->get_frac_change() << std::endl;
    inst->set_tree("((Ptro:0.00147084048849247711,Ppan:0.00106294370976534763):0.00444598321816729036,(Cjac:0.05157798212603657839,(Csab:0.00440006365327790666,(Mmul:0.00652936575529242547,Panu:0.00101047194512476272):0.00381049900890796569):0.01359968787254225639):0.01375788728353777995,Hsap:0.00674547067186638278):0.0;");
    inst->set_epsilon(0.001);
    inst->set_alpha(2, 0, true);
    auto ef = inst->get_empirical_frequencies();

    inst->optimise(true, true, true, true);
    inst->optimise_tree_search(true);
    std::cout << inst->get_likelihood() << std::endl;
    std::cout << inst->get_tree() << std::endl;
    return 0;
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: mbcastro/tsp
void run_tsp (int nb_threads, int nb_towns, int seed, int nb_clusters, char* machine) {
	int i;

	uint64_t start = get_time();
	
	TRACE(start, -1, -1, STARTING_EXECUTION);

	int nb_partitions = get_number_of_partitions(nb_clusters);
	LOG ("nb_clusters = %3d nb_partitions = %3d nb_threads = %3d nb_towns = %3d seed = %d \n", 
		nb_clusters, nb_partitions, nb_threads, nb_towns, seed);

	min_distance = INT_MAX;
	next_partition = 0;
	running_count = 0;
	tsps = 	(tsp_t_pointer *)(malloc(sizeof(tsp_t_pointer) * nb_clusters));
	assert(tsps != NULL);
	pthread_t **tids = (pthread_t **) malloc (sizeof(pthread_t *) * nb_clusters);
	assert (tids != NULL);	
	for (i = 0; i < nb_clusters; i++)
		tids[i] = spawn(&tsps[i], i, nb_clusters, nb_partitions, nb_threads, nb_towns, seed, machine);
	for (i = 0; i < nb_clusters; i++) {
		pthread_join (*(tids[i]), NULL);
		free(tids[i]);
	}

	free (tids);
	free(tsps);

	uint64_t end = get_time();
    uint64_t exec_time = diff_time(start, end);
    TRACE(end, -1, -1, ENDING_EXECUTION);

	printf ("%" PRIu64 "\t%5d\t%2d\t%2d\t%5d\t%2d\t%8d", 
		exec_time, min_distance,nb_threads, nb_towns, seed, nb_clusters, nb_partitions);
}