int main(int argc, char **argv)
{
    Matrix *M;
    Polyhedron *C;
    struct barvinok_options *options = barvinok_options_new_with_defaults();

    argc = barvinok_options_parse(options, argc, argv, ISL_ARG_ALL);

    M = Matrix_Read();
    C = Constraints2Polyhedron(M, options->MaxRays);
    Matrix_Free(M);

    M = Cone_Integer_Hull(C, NULL, 0, options);

    Polyhedron_Free(C);

    Matrix_Print(stdout, P_VALUE_FMT, M);
    Matrix_Free(M);

    if (options->print_stats)
	barvinok_stats_print(options->stats, stdout);

    barvinok_options_free(options);
    return 0;
}
Esempio n. 2
0
void count(mpz_t states,int argc, char **argv, int lanes[NLANES][L], int filaments, int noconsts)
{
	
	int i,j;
	//int temp[500];
	int** constraints;
	Value *test;
	char* total;
	unsigned NbRows, NbColumns;
    Value cb;
    Polyhedron *A;
    Matrix *M;
    struct barvinok_options *options = barvinok_options_new_with_defaults();
	NbRows=0;
    argc = barvinok_options_parse(options, argc, argv, ISL_ARG_ALL);
    //printf("length 1st lane: %d\n", lanes[0][1]);
    
	constraints= malloc(noconsts*sizeof(int *));
	//printf("%lu\n",(filaments+2)*(noconsts));
	for (i=0;i<noconsts;i++){
		constraints[i]=(int*)malloc(sizeof(int)*(filaments+2));
		for(j=0;j<filaments+2;j++){
			constraints[i][j]=0;
			//printf("%d %d %d\n",i,j,constraints[i][j]);
		}
	}
	//printf("from count: fils %d noconsts %d\n",filaments,noconsts);
    gen_constraints(constraints,lanes,filaments,noconsts);
    dump_to_file(constraints,filaments,noconsts);

	
	value_init(cb);
	total=malloc(sizeof(char)*500);
	get_popen_data(total);
    //A = Constraints2Polyhedron(M, options->MaxRays);
   
    
    //value_print(stdout, P_VALUE_FMT, cb);
    mpz_set_str(cb,total,10);
    free(total);
    //printf("%s\n%d\n",total,strlen(total));	
	//gmp_printf("%Zd\n",states);
    //printf("%d\n",tot_int);
    if (options->print_stats)
	barvinok_stats_print(options->stats, stdout);
    value_clear(cb);
    //value_clear(test);
   
    barvinok_options_free(options);
    for (i=0;i<noconsts;i++){
		free(constraints[i]);
	}
	free(constraints);
    
    
   
}
Esempio n. 3
0
void count_new(Value* cb, int lanes[NLANES][L],int filaments,int noconsts){
	//clock_t t1 = clock();
	Polyhedron *A;
	int i,j;
    Matrix *M;
    //printf("inside count we have the following lanes for %d filaments and %d noconsts:\n",filaments,noconsts);
    //dump_lanes(lanes);
    M=Matrix_Alloc(noconsts,filaments+2);
    //lock_t t2 = clock();
    int** constraints;
    constraints= malloc(noconsts*sizeof(int *));
    //clock_t t3 = clock();
	//printf("%lu\n",(filaments+2)*(noconsts));
	for (i=0;i<noconsts;i++){
		constraints[i]=(int*)malloc(sizeof(int)*(filaments+2));
		for(j=0;j<filaments+2;j++){
			constraints[i][j]=0;
			//printf("%d %d %d\n",i,j,constraints[i][j]);
		}
	}
	//clock_t t4 = clock();
	//printf("from count: fils %d noconsts %d\n",filaments,noconsts);
    gen_constraints(constraints,lanes,filaments,noconsts);
    //clock_t t5 = clock();
	struct barvinok_options *options = barvinok_options_new_with_defaults();
	Matrix_Init(M,constraints);
	//clock_t t6 = clock();
	A=Constraints2Polyhedron(M,options->MaxRays);
	//clock_t t7 = clock();
	barvinok_count_with_options(A, cb, options);
	//clock_t t8 = clock();
	//printf("timings at count: t2=%f, t3=%f, t4=%f, t5=%f, t6=%f, t7=%f, t8=%f\n",(double)(t2-t1)/CLOCKS_PER_SEC,(double)(t3-t1)/CLOCKS_PER_SEC,(double)(t4-t1)/CLOCKS_PER_SEC,(double)(t5-t1)/CLOCKS_PER_SEC,(double)(t6-t1)/CLOCKS_PER_SEC,(double)(t7-t1)/CLOCKS_PER_SEC,(double)(t8-t1)/CLOCKS_PER_SEC);
	Polyhedron_Free(A);
    barvinok_options_free(options);
    Matrix_Free(M);
    for (i=0;i<noconsts;i++){
		free(constraints[i]);
		}
	free(constraints);
   	

	}	
int main(int argc, char **argv)
{
	int nchamber;
	unsigned nparam;
	Matrix *A;
	Polyhedron *P, *C;
	Param_Polyhedron *PP;
	Param_Domain *PD;
	struct barvinok_options *options = barvinok_options_new_with_defaults();

	argc = barvinok_options_parse(options, argc, argv, ISL_ARG_ALL);

	A = Matrix_Read();
	assert(A);

	nparam = A->NbRows;
	C = Universe_Polyhedron(nparam);
	P = partition2polyhedron(A, options);
	Matrix_Free(A);

	PP = Polyhedron2Param_Polyhedron(P, C, options);
	Polyhedron_Free(P);
	Polyhedron_Free(C);

	nchamber = 0;
	for (PD = PP->D; PD; PD = PD->next)
		nchamber++;

	printf("%d\n", nchamber);
	for (PD = PP->D; PD; PD = PD->next) {
		printf("\n");
		Polyhedron_PrintConstraints(stdout, P_VALUE_FMT, PD->Domain);
	}
	Param_Polyhedron_Free(PP);

	barvinok_options_free(options);
	return 0;
}