コード例 #1
0
ファイル: Solution.cpp プロジェクト: cocoto/SBRP
void Solution::print_file_format_students(const char* f_p) {
	FILE *file; /*File*/
	/* Assignment calculated by the assignment maker */
	//StopAssignment* assignment = assignments;

	/* Check that it was possible to make an assignment */
	assert(assignments != NULL);

	/* Open the file to store the solution*/
	file = fopen(f_p, "w");

	/* Check if the file could be opened or not.*/
	if (file == NULL) {
		printf("   ERROR! The file in which a solution is going to be stored"
				" could not be opened (Class Solution).\n");
		return;
	}

	/* Print the total number of paths that need to be drawn*/
	fprintf(file, "%d\n", instance->get_num_students());
	/* Print the total distance*/
	fprintf(file, "%lf\n", get_total_distance());
	/* Print the total time*/
	fprintf(file, "%lf\n", get_total_time());

	/* Print paths of the students to the stops they are assigned to*/
	assignments->print_file_format(file);

	fclose(file);
}
コード例 #2
0
ファイル: Solution.cpp プロジェクト: cocoto/SBRP
void Solution::print_file_format_buses(const char* f_p) {
	FILE *file; /*File*/

	/* Check that it was possible to make an assignment */
	assert(is_assignment_feasible());

	/* Open the file to store the solution*/
	file = fopen(f_p, "w");

	/* Check if the file could be opened or not.*/
	if (file == NULL) {
		printf("   ERROR! The file in which a solution is going to be stored"
				"could not be opened (Class Solution).\n");
		return;
	}

	/* Print the total number of paths that need to be drawn*/
	fprintf(file, "%d\n", routes->get_num_routes());
	/* Print the total distance*/
	fprintf(file, "%lf\n", get_total_distance());
	/* Print the total time*/
	fprintf(file, "%lf\n", get_total_time());

	/* Print the routes traversed by the buses*/
	routes->print_file_format(file);

	fclose(file);
}
コード例 #3
0
ファイル: job.c プロジェクト: junyk/jobs_scheduling
float get_late_per_total(solution_t *soln) {
    
    float late, total;
    
    late = get_total_time(soln);
    total = get_total_lateness(soln);

    return late/total;
}
コード例 #4
0
ファイル: Set_routes.cpp プロジェクト: cocoto/SBRP
void Set_routes::print() {

	/* Code to be executed only if the flag _DEBUG is set*/
	#ifdef _DEBUG
	/* Check the integrity of the route (distance and travel time)*/
	assert_routes_structure();
	#endif

	printf("  - Total distance traversed: %.2lf\n", get_total_distance());
	printf("  - Total time: %.2lf\n", get_total_time());

	printf("  - Set of routes traversed by the buses: \n");
	for (int i = 0; i < get_num_routes(); i++) {
		route[i]->print();
	}
}
コード例 #5
0
ファイル: omit_gc_timer.c プロジェクト: fenghaitao/Harpoon
void print_timer_output()
{
  printf("Time without gc is %f seconds.\n", get_total_time());
}