Esempio n. 1
0
void solution::show_data(){
	// printf("\np: %d\tr: %d\n", this->p, this->r);
	printf("Allocated Hubs: ");
	for(set< unsigned >::iterator h = alloc_hubs.begin(); h != alloc_hubs.end(); h++)
		printf("%d\t", (*h + 1));

	/*printf("\n\nAssigned Hubs:\n");
	for(int i = 0; i < instance.get_n(); i++){
		if(is_hub(i)) continue;
		printf("H[%d]: ", i);
		for(int j = 0; j < r; j++)
			printf("%d\t", assigned_hubs[i][j]);
		printf("\n");
	}

	printf("\n\nTraffics Routes:\n");
	for(int i = 0; i < instance.get_n(); i++){
		if(is_hub(i)) continue;
		printf("i[%d]: ", i);
		for(int j = 0; j < instance.get_n(); j++){
			if(is_hub(j)) continue;
			printf("%.2lf\t", cost[i][j]);
		}
		printf("\n");
	}

	printf("\n\nH1:\n");
	for(int i = 0; i < instance.get_n(); i++){
		if(is_hub(i)) continue;
		printf("i[%d]: ", i);
		for(int j = 0; j < instance.get_n(); j++){
			if(is_hub(j)) continue;
			printf("%d\t", f_chosen[i][j]);
		}
		printf("\n");
	}
	printf("\n\nH2:\n");
	for(int i = 0; i < instance.get_n(); i++){
		if(is_hub(i)) continue;
		printf("i[%d]: ", i);
		for(int j = 0; j < instance.get_n(); j++){
			if(is_hub(j)) continue;
			printf("%d\t", s_chosen[i][j]);
		}
		printf("\n");
	}*/

	/*printf("\n\nHUBS COST:\t");
	for(int i = 0; i < p; i++)
		printf("%.2lf\t", hubs_cost[i]);*/

	printf("\nTOTAL COST: %.2lf\n", get_total_cost());
}
Esempio n. 2
0
 void instruction::collect_statistics(statistics& st) const {
     costs c;
     get_total_cost(c);
     st.update("instruction", c.instructions);
     st.update("instruction-time", c.milliseconds);
 }
Esempio n. 3
0
void print_path(Graph<T,C>* graph, vector<T>* path){
    for (int i = 0; i < path->size(); i++){
        cout << path->at(i) << " ";
    }
    cout << get_total_cost(graph, path) << endl;
}