Exemple #1
0
void ArcSnapshot::Execute (void)
{
	//---- read the network ----

	Data_Service::Execute ();

	//---- set the subarea flag ----

	if (select_subarea) {
		Set_Subarea ();
	}

	//---- process vehicle type data ----

	Set_Veh_Types ();

	//---- create the cell grid ----

	if (method == TOTAL || method == MAXIMUM) {
		Create_Cells ();

		Sum_Snapshot ();

	} else {

		//---- process the snapshot file ----

		Read_Snapshot ();
	}
	Exit_Stat (DONE);
}
void Message_Service::Show_Error (char *format, ...) 
{
	if (format == NULL) {
		format = "Show_Error is NULL";
	}
	if (Quiet () && warnings == 0) {
		Quiet (false);
		Show_Banner ();
	}
	char text [STRING_BUFFER];

	va_list  args;
 	va_start (args, format);
	str_args (text, sizeof (text), format, args);
	va_end (args);

	if (Program_Status () == FATAL) {
		printf ("\n\t%s", text);
		fflush (stdout);
	} else {
		printf ("\n\n\tError: %s", text);
		fflush (stdout);

		Pause (true);

		Exit_Stat (FATAL);
	}
}
Exemple #3
0
void RandomSelect::Execute (void)
{
	int last_hhold, last_part, part;
	double share, total, prob;
	Select_Map_Itr map_itr;
	Trip_Index trip_index;
	Int_Itr int_itr;

	//---- read the network data ----

	Data_Service::Execute ();

	//---- select a partition ----

	last_hhold = last_part = 0;
	share = 1.0 / num_parts;

	for (map_itr = select_map.begin (); map_itr != select_map.end (); map_itr++) {
		trip_index = map_itr->first;

		if (last_hhold != trip_index.Household ()) {
			last_hhold = trip_index.Household ();

			prob = random.Probability ();
			total = share;

			for (part=0; part < num_parts; part++, total += share) {
				if (total > prob) break;
			}
			last_part = part;
		}
		map_itr->second.Partition (last_part);
		part_count [last_part]++;
	}

	//---- write the selection file ----

	Write_Selections ();

	//---- report the records per partition ----

	total = select_map.size () / 100.0;
	if (total == 0.0) total = 1.0;

	Break_Check (num_parts + 3);
	Write (2, "Partition Distribution");

	for (part=0, int_itr = part_count.begin (); int_itr != part_count.end (); int_itr++, part++) {
		Write (1, String ("%5d %10d (%5.1lf%%)") % part % *int_itr % (*int_itr / total) % FINISH);
	}
	Write (1, String ("Total %10d") % (int) select_map.size ());

	//---- end the program ----

	Exit_Stat (DONE);
}
Exemple #4
0
void LinkData::Execute (void)
{
	Link_Nodes link_node_rec;

	//---- read the data service ----

	Data_Service::Execute ();

	//---- allocate link node data ----

	link_node_rec.link = 0;
	link_node_rec.nodes.clear ();

	link_node_array.assign (link_array.size (), link_node_rec);

	//---- generate a node map ----

	if (node_map_flag) {
		Read_Node_Map ();
	}
	if (input_flag) {
		Read_Node_File ();
	}

	//---- read the link node list file ----

	if (link_node_flag) {
		Read_Link_Nodes ();
	}

	//--- create link data structures ----

	Create_Link_Map ();

	//---- read the directional data file ----

	Read_Dir_Data ();

	//---- write the link data file ----

	if (data_flag) {
		Write_Dir_Data ();
	}
	if (new_map_flag) {
		Write_Node_Map ();
	}
	if (new_link_node_flag) {
		Write_Link_Nodes ();
	}
	Print (2, "Number of Link Node Equivalence Records = ") << nequiv;
	Print (1, "Number of From-To Link Combinations = ") << nab;
	Print (1, "Number of Directional Data Records = ") << ndir;
	Print (1, "Number of Link Data Records Written = ") << nlink;

	Exit_Stat (DONE);
}
Exemple #5
0
void ArcRider::Execute (void)
{

	//---- read the network ----

	Data_Service::Execute ();

	//---- write the line demands ----

	if (line_flag) {
		Write_Route ();
	}

	//---- write the line groups ----

	if (sum_flag) {
		Write_Sum ();
	}

	//---- allocate transit memory ----

	if (rider_flag || on_off_flag) {
		Setup_Riders ();
		Sum_Riders ();
	}

	//---- write ridership shapes ----

	if (rider_flag) {
		Write_Riders ();
	}

	//---- write transit stops file ----

	if (on_off_flag) {
		if (demand_flag) Write_Stops ();
		if (group_flag) Write_Group ();
	}

	//---- write run capacity file ----

	if (cap_flag) {
		Write_Capacity ();
	}

	Write (1);
	if (line_flag) Write (1, "Number of Line Demand Shape Records = ") << num_line;
	if (sum_flag) Write (1, "Number of Line Group Shape Records = ") << num_sum;
	if (rider_flag) Write (1, "Number of Ridership Shape Records = ") << num_rider;
	if (demand_flag) Write (1, "Number of Stop Demand Shape Records = ") << num_stop;
	if (group_flag) Write (1, "Number of Stop Group Shape Records = ") << num_group;
	if (cap_flag) Write (1, "Number of Run Capacity Shape Records = ") << num_cap;

	Exit_Stat (DONE);
}
Exemple #6
0
void NewLandUse::Execute (void)
{
	int field;
	Str_Itr str_itr;
	Zone_Field_Itr field_itr;
	Processing_Itr process_itr;

	//---- read/open the system zone files ----

	Data_Service::Execute ();

	//---- read zone and target files ----

	Read_Files ();

	//---- coverage type density ----

	Apply_Density ();

	//---- process each data field ----

	for (field=0, str_itr = data_names.begin (); str_itr != data_names.end (); str_itr++, field++) {
		Print (1);
		Write (1, "Processing Data Field ") << *str_itr;
		Show_Message (1);

		if (field >= function.Num_Functions ()) {
			best_function = function.Num_Functions ();
		} else {
			best_function = field + 1;
		}
		for (process_itr = processing_steps.begin (); process_itr != processing_steps.end (); process_itr++) {
			Processing (field, *process_itr);
		}
	}

	//---- output the results ----

	Write_Data ();

	//---- print reports ----

	for (int i=First_Report (); i != 0; i=Next_Report ()) {
		switch (i) {
			case GROUP_REPORT:		//---- Group Report ----
				Group_Report ((int) Report_Data ());
				break;
			default:
				break;
		}
	}

	Exit_Stat (DONE);
}
Exemple #7
0
void DynusTPlan::Execute (void)
{
	int nfile;

	//---- read the network ----

	Demand_Service::Execute ();

	Set_Zone ();

	//---- write a temporary header record ----

	fprintf (veh_file.File (), "0000000000 1 # of vehicles, max # of stops, start_time=%s\n", time_range.Format_Step (start_time));
	fprintf (veh_file.File (), "      #   usec   dsec   stime usrcls vehtype ioc #ONode #IntDe info ribf   comp    OZ\n");

	//---- read the plan file ----

	for (nfile=0; ; nfile++) {
		if (!plan_file.Open (nfile)) break;

		//---- process the plan files ----

		Read_Plan ();
	}
	if (nfile == 0) {
		File_Error ("No Plan Files were Found", plan_file.Filename ());
	}

	//---- write summary statistics ----

	Break_Check (8);

	Write (2, "Number of Plan Files = %d", nfile);
	Write (1, "Number of Input Plans = %d", plan_file.Num_Plans ());
	Write (1, "Number of Input Records = %d", plan_file.Num_Records ());
	Write (1, "Number of Input Travelers = %d", plan_file.Num_Travelers ());
	Write (1, "Number of Input Trips = %d", plan_file.Num_Trips ());

	Write (2, "Number of Output Trips = %d", num_out);

	//---- update the header ----

	veh_file.Rewind ();

	fprintf (veh_file.File (), "%10d", num_out);

	veh_file.Close ();
	path_file.Close ();

	//---- end the program ----

	Exit_Stat (DONE);
}
Exemple #8
0
void TPPlusRoute::Execute (void)
{
	int old_routes, old_nodes;

	//---- read the network ----

	Network_Service::Execute ();

	//---- check the input route numbers ----

	if (input_flag) {
		Route_Data *route_ptr = route_data.Last_Key ();

		if (route_ptr != NULL) {
			if (route_id <= route_ptr->Route ()) {
				route_id = ((route_ptr->Route () / 100) + 1) * 100;
			}
		}
		old_routes = route_data.Num_Records ();
		old_nodes = route_data.Num_Nodes ();
	} else {
		old_routes = old_nodes = 0;
	}

	//---- read the tpplus node map file ----

	if (map_flag) {
		Read_Node_Map ();
	}

	//---- read the tpplus line files ----

	Read_Line ();

	//---- write the route header and nodes ----

	Write_Route ();

	//---- print the results ----

	Break_Check (4);
	Write (2, "Number of Route Header Records = %d", nroute);
	if (old_routes > 0) Write (0, " (%d new)", (nroute - old_routes));

	Write (1, "Number of Route Nodes Records = %d", nnodes);
	if (old_nodes > 0) Write (0, " (%d new)", (nnodes - old_nodes));

	if (num_match > 0) Write (1, "Number of Matched Routes = %d", num_match);

	Exit_Stat (DONE);
}
Exemple #9
0
void PlanTrips::Execute (void)
{
	//---- read the network ----

	Data_Service::Execute ();

	//---- process plan files ----

	Read_Plan ();

	//---- write the trip file ----

	Write_Trips ();

	Exit_Stat (DONE);
}
Exemple #10
0
void VehGen::Execute (void)
{
	//---- read the files ----

	Demand_Service::Execute ();

	//---- end the program ----

	Write (2, "Number of Households = %d", num_hhold);
	Write (1, "Number of Vehicles = %d", num_vehicle);

	if (num_problem) {
		Write (2, "Number of Vehicles that could not be Located = %d", num_problem);
	}
	Exit_Stat (DONE);
}
Exemple #11
0
void ExportTransit::Execute (void)
{

	//---- read the network ----

	Network_Service::Execute ();

	//---- write the transit routes ----

	Write_Route ();

	//---- print the results ----

	Break_Check (3);
	Write (2, "Number of Route Header Records = %d", nroute);
	Write (1, "Number of Route Nodes Records = %d", nnodes);

	Exit_Stat (DONE);
}
Exemple #12
0
void LinkDelay::Execute (void)
{
	//---- read the link file ----

	Demand_Service::Execute ();

	if (link_flag) {
		Read_Previous_Link ();
	}

	//---- combine previous records ----

	if (previous_flag) {
		Combine_Delay ();
	}
	Output_Delay ();

	Exit_Stat (DONE);
}
Exemple #13
0
void GISNet::Execute (void)
{

	//---- read the conversion script ----

	if (convert_flag) {
		if (Report_Flag (SCRIPT_REPORT)) {
			Header_Number (SCRIPT_REPORT);

			if (!Break_Check (10)) {
				Print (1);
				Page_Header ();
			}
		}
		convert.Set_Files (2, &gis_file, Network_Db_Base (NEW_LINK));

		if (!convert.Compile (&script_file, Report_Flag (SCRIPT_REPORT))) {
			Error ("Compiling Conversion Script");
		}
		if (Report_Flag (STACK_REPORT)) {
			Header_Number (STACK_REPORT);

			convert.Print_Commands (false);
		}
		Header_Number (0);
	}

	//---- gis node file ----

	if (node_flag) {
		Read_Node ();
	}

	//---- gis link file ----

	Read_Link ();

	//---- end the program ----

	Exit_Stat (DONE);
}
Exemple #14
0
void CoordMatch::Execute (void)
{
	//---- read the network ----

	Network_Service::Execute ();

	//---- read the reference node file ----

	if (ref_node_flag) {
		Read_Reference ();
	}

	//---- read the node map file ----

	if (node_map_flag) {
		Read_Node_Map ();
	} else {
		Make_Node_Map ();
	}

	//---- match other reference nodes ----

	if (new_map_flag || replace_flag) {
		Expand_Node_Map ();
	}

	//---- convert the nodes ----

	Adjust_Nodes ();

	//---- print the results ----

	Break_Check (4);
	Write (2, "Number of New Node Records = %d", num_new_nodes);
	Write (1, "Number of New Node Map Records = %d", num_new_maps);

	Exit_Stat (DONE);
}
Exemple #15
0
void TcadImport::Execute (void)
{
	int i, z, size;

	//---- allocate matrix memory ----

	size = (int) (num_zones * sizeof (float));

	trips = new float ** [tables];

	for (i=0; i < tables; i++) {
		trips [i] = new float * [num_zones];

		for (z=0; z < num_zones; z++) {
			trips [i] [z] = new float [num_zones];
			memset (trips [i] [z], '\0', size);
		}
	}

	Process ();

	Exit_Stat (DONE);
}
Exemple #16
0
void SmoothData::Execute (void)
{
	int n = 0;

	//---- process each group ----

	for (group_ptr = file_group.First (); group_ptr; group_ptr = file_group.Next ()) {

		if (n++) {
			Write (1);
			diurnal_data.Reset ();
		}
		Show_Message ("Processing Smooth Group %d -- Record", n);
		Set_Progress ();

		num_group = num_ini = num_in = num_out = 0;

		Read_Input ();

		End_Progress ();

		group_ptr->Input_File ()->Close ();
		group_ptr->Output_File ()->Close ();

		if (group_ptr->Initial_File () != NULL) {
			Write (1, "Number of %s Records = %d", group_ptr->Initial_File ()->File_Type (), num_ini);
			group_ptr->Initial_File ()->Close ();
		}
		Write (1, "Number of %s Records = %d", group_ptr->Input_File ()->File_Type (), num_in);
		Write (1, "Number of %s Records = %d", group_ptr->Output_File ()->File_Type (), num_out);

		if (num_group > 1) {
			Write (1, "Number of Smooth Groups within File #%d = %d", n, num_group);
		}
	}
	Exit_Stat (DONE);
}
Exemple #17
0
void ConvertTours::Execute (void)
{
	int hhold1, vehicle1;

	File_Group *group;

	//---- compile the tour group script ----

	if (script_flag) {
		Show_Message (1);

		script_base.File_ID ("GROUP");
		script_base.Dbase_Format (BINARY);
		script_base.File_Access (MODIFY);

		script_base.Add_Field ("GROUP_OUT", INTEGER, 2, 0, -1, true);
		script_base.Add_Field ("GROUP_IN", INTEGER, 2, 0, -1, true);
		script_base.Add_Field ("DIURNAL_OUT", INTEGER, 2, 0, -1, true);
		script_base.Add_Field ("DIURNAL_IN", INTEGER, 2, 0, -1, true);
		script_base.Add_Field ("MODE_OUT", INTEGER, 2, 0, -1, true);
		script_base.Add_Field ("MODE_IN", INTEGER, 2, 0, -1, true);
		script_base.Add_Field ("WORK_CODE", INTEGER, 2, 0, -1, true);

		if (!group_script.Set_Files (2, &tour_file_db, &script_base)) {
			Error ("Initializing Tour Group Script Files");
		}
		group_script.Random_Seed (random_org.Seed () + 4);

		if (Report_Flag (SCRIPT_REPORT)) {
			Header_Number (SCRIPT_REPORT);

			if (!Break_Check (10)) {
				Print (1);
				Page_Header ();
			}
		}
		if (!group_script.Compile (&script_file, Report_Flag (SCRIPT_REPORT))) {
			Error ("Compiling Tour Group Script");
		}
		if (Report_Flag (STACK_REPORT)) {
			Header_Number (STACK_REPORT);

			group_script.Print_Commands (Report_Flag (STACK_REPORT));
		}
		Header_Number (0);
	}
	Show_Message (1);

	for (group = file_group.First (); group != NULL; group = file_group.Next ()) {
		Time_Processing (group);
	}

	//---- read the network ----

	Demand_Service::Execute ();

	//---- generate the zone map ----

	Zone_Location ();

	//---- check the parking lots ----

	Parking_Check ();

	//---- check the vehicle types ----

	if (Demand_File_Flag (VEHICLE_TYPE)) {
		for (group = file_group.First (); group != NULL; group = file_group.Next ()) {
			if (veh_type_data.Get (group->Type (), group->SubType ()) == NULL) {
				Error ("Vehicle Type %d-%d was Not Found in the Vehicle Type Flle", group->Type (), group->SubType ());
			}
		}
	}

	//---- read the household list ----

	if (hhlist_flag) {
		Read_HHList ();
	}

	//---- process each trip table -----

	if (hhold_id <= max_hh_in) hhold_id = 100 * ((max_hh_in / 100) + 1);
	if (vehicle_id <= max_veh_in) vehicle_id = 100 * ((max_veh_in / 100) + 1);

	hhold1 = hhold_id;
	vehicle1 = vehicle_id;

	//---- travel time skim ----

	if (skim_flag) {
		Skim_Processing ();
	}

	//---- read the tour file ----

	Tour_Processing ();

	//---- diurnal allocation file ----

	if (diurnal_flag) {
		Diurnal_Results ();
	}

	//---- summarize the results ----

	if (trip_copy > 0 || hhold_copy > 0 || pop_copy > 0 || veh_copy > 0) {
		Break_Check (5);

		Write (2, "Number of Trip Records Copied      = %d", trip_copy);
		Write (1, "Number of Household Records Copied = %d", hhold_copy);
		Write (1, "Number of Person Records Copied    = %d", pop_copy);
		Write (1, "Number of Vehicle Records Copied   = %d", veh_copy);
	}

	Break_Check (10);

	Write (2, "Total Number of Tours Read     = %d", tot_trips);
	Write (1, "Total Number of Trips Written  = %d", num_trip);
	if (tot_add > 0.5) {
		Write (1, "Total Number of Trips Added    = %.0lf", tot_add);
	}
	if (tot_del > 0.5) {
		Write (1, "Total Number of Trips Deleted  = %.0lf", tot_del);
	}
	Write (1, "Number of Trips Not Allocated  = %d", tot_errors);

	Write (2, "Number of Households Generated = %d", nhhold);
	Write (1, "Number of Persons Generated    = %d", nperson);
	Write (1, "Number of Vehicles Generated   = %d", (vehicle_id - vehicle1));

	Exit_Stat (DONE);
}
Exemple #18
0
void EventSum::Execute (void)
{

	//---- read the network and demand files ----

	Demand_Service::Execute ();

	max_hhold = MAX_INTEGER / Traveler_Scale ();

	//---- read the household list ----

	if (hhlist_flag) {
		Read_HHList ();
	}

	//---- read input travel times ----

	if (time_in_flag) {
		Read_Times ();
	}

	//---- read activity file ----

	if (activity_flag) {
		Read_Activity ();
	}

	//---- read trip file ----

	if (trip_file_flag) {
		Read_Trips ();
	}

	//---- read the event file ----

	if (combine_flag) {
		Combine_Events ();
	} else {
		Read_Events ();
	}

	//---- select travelers ----

	if (select_flag) {
		Select_Travelers ();
	}

	//---- write travel time file ----

	if (time_file_flag) {
		Write_Events ();
	}

	//---- write time summary file ----

	if (time_sum_flag) {
		Write_Times ();
	}

	//---- write the link events file ----

	if (link_flag) {
		Write_Links ();
	}

	//---- write the time distribution file ----

	if (distrib_flag) {
		time_diff.Write_Distribution ();
	}

	//---- update plans ----

	if (update_flag) {
		Update_Plans ();
	}

	//---- write new household list ----

	if (new_hhold_flag) {
		Write_HHList ();
	}

	//---- print the comparison summary ----

	time_diff.Total_Summary ();

	//---- print reports ----

	Show_Message ("Writing Summary Reports");	

	for (int i=First_Report (); i != 0; i=Next_Report ()) {
		switch (i) {
			case TOP_100_TTIME:		//---- top 100 travel time differences ----
				Top_100_TTime_Report ();
				break;
			case TOTAL_DISTRIB:		//---- total difference distribution ----
			case TTIME_DISTRIB:		//---- time difference distributions ----
				time_diff.Time_Distribution (i);
				break;
			case PERIOD_SUM:		//---- time period summary ----
				time_diff.Period_Summary ();
				break;
			case TOP_100_LINK:
				Top_100_Link_Report ();
				break;
			case TOP_100_PERIOD:	//---- top 100 period events ----
				Top_100_Period_Report ();
				break;
			case LINK_EVENT:		//---- link event report -----
				Link_Event_Report ((int) Report_Data ());
				break;
			case GROUP_EVENT:		//---- group event report ----
				Group_Event_Report ((int) Report_Data ());
				break;
			case TRAVELER_SUM:		//---- traveler summary report ----
				Traveler_Sum_Report ();
				break;
			case EVENT_SUM:			//---- event summary report ----
				Event_Sum_Report ();
				break;
			default:
				break;
		}
	}
	Exit_Stat (DONE);
}
Exemple #19
0
void CheckSurvey::Execute (void)
{
	
	//---- read the household type script ----

	if (survey_type_flag) {
		Type_Script ();
		Flush ();
	}

	//---- read the household list ----

	if (hhlist_flag) {
		Household_List ();
	}	

	//---- read the survey files ----

	Survey_Households ();

	if (weight_flag) {
		Survey_Weights ();
	}
	Survey_Population ();

	Survey_Activity ();

	//---- print reports ----

	for (int i=First_Report (); i != 0; i=Next_Report ()) {
		switch (i) {
			case SURVEY_TYPE:		//---- Survey Type Summary ----
				Type_Report ();
				break;
			case TRIP_LENGTH:
				trip_length.Report (TRIP_LENGTH, "Trip Length Summary", "Purpose");
				break;
			case TOUR_LENGTH:
				tour_length.Report (TOUR_LENGTH, "Tour Length Summary", "Purpose");
				break;
			case TRIP_PURPOSE:
				trip_purpose.Report (TRIP_PURPOSE, "Trip Purpose Summary", " ", "Purpose");
				break;
			case TOUR_PURPOSE:	
				tour_purpose.Report (TOUR_PURPOSE, "Tour Purpose Summary", "Purpose", "-Stops");
				break;
			case MODE_LENGTH:
				mode_length.Report (MODE_LENGTH, "Mode Length Summary", " Mode");
				break;
			case MODE_PURPOSE:	
				mode_purpose.Report (MODE_PURPOSE, "Mode Purpose Summary", " Mode-", "Purpose");
				break;
			default:
				break;
		}
	}

	//---- end the program ----

	Print (2, "Number of Households = %d", nhhold);
	Print (1, "Number of Persons = %d", nperson);
	Print (1, "Number of Workers = %d", nwork);

	if (nhhold == 0) nhhold = 1;

	Print (2, "Persons per Household = %.2lf", (double) nperson / nhhold);
	Print (1, "Workers per Household = %.2lf", (double) nwork / nhhold);

	if (nperson == 0) nperson = 1;

	if (num_problem > 0 || num_act_gen != num_activity) {
		Print (2, "Number of Activities Generated = %d", num_act_gen);

		if (num_problem > 0) {
			Print (1, "Number of Activities with Problems = %d (%.1lf%%)", num_problem,
				(100.0 * num_problem / num_act_gen));
		}
		Print (1, "Number of Activities Written = %d (%.1lf%%)", num_activity,
			(100.0 * num_activity / num_act_gen));
	} else {
		Print (2, "Number of Activities = %d", num_activity);
	}
	Print (2, "Activities per Household = %.2lf", (double) num_activity / nhhold);
	Print (1, "Activities per Person = %.2lf", (double) num_activity / nperson);

	if (nproblem) {
		Write (2, "Number of Households with Problems = %d (%.1lf%%)", nproblem,
			(100.0 * nproblem / survey_hh_data.Num_Records ()));
	}
	Report_Problems ();

	Exit_Stat (DONE);
}
Exemple #20
0
void PlanSum::Execute (void)
{
	int nfile, i, j, num;

	//---- read the network ----

	Demand_Service::Execute ();

	//---- prepare data ----

	Data_Preparation ();

	//---- read the household list ----

	if (hhlist_flag) {
		Read_HHList ();
	}

	//---- read the household person count ----

	if (count_flag) {
		Read_Count ();
	}

	//---- read the plan file ----

	for (nfile=0; ; nfile++) {
		if (!plan_file.Open (nfile)) break;

		if (update_flag) {
			if (!new_plan_file.Open (nfile)) {
				Error ("Opening %s", new_plan_file.File_Type ());
			}
		}

		//---- process the plan files ----

		Read_Plans ();
	}

	if (nfile == 0) {
		File_Error ("No Plan Files were Found", plan_file.Filename ());
	}

	//---- write summary statistics ----

	Break_Check (6);

	Write (2, "Number of Plan Files = %d", nfile);
	Write (1, "Number of Input Plans = %d", plan_file.Num_Plans ());
	Write (1, "Number of Input Records = %d", plan_file.Num_Records ());
	Write (1, "Number of Input Travelers = %d", plan_file.Num_Travelers ());
	Write (1, "Number of Input Trips = %d", plan_file.Num_Trips ());

	if (update_flag) {
		Break_Check (5);

		Write (2, "Number of Output Plans = %d", new_plan_file.Num_Plans ());
		Write (1, "Number of Output Records = %d", new_plan_file.Num_Records ());
		Write (1, "Number of Output Travelers = %d", new_plan_file.Num_Travelers ());
		Write (1, "Number of Output Trips = %d", new_plan_file.Num_Trips ());
	}
	Write (1);

	//---- write the volume file ----

	if (volume_flag) {
		Write_Volume ();
	}

	//---- write the trip time file ----

	if (time_flag) {
		Diurnal_Distribution ();
	}

	//---- write the link delay file ----

	if (delay_out) {
		Link_Delay ();
	}

	//---- transit ridership output ----

	if (transit_flag) {
		if (Demand_File_Flag (NEW_RIDERSHIP)) {
			Write_Riders ();
		}
	}

	//---- write the skim file ----

	if (skim_flag) {
		if (time_skim_flag) {
			if (length_flag) {
				Write_Time_Length ();
			} else {
				Write_Time ();
			}
		} else {
			Write_Skim ();
		}
	}

	//---- write the trip table ----

	if (trip_flag) {
		Write_Trips ();
	}

	//---- write the turn movements ----

	if (turn_flag) {
		Write_Turns ();
	}

	//---- print reports ----

	Show_Message ("Writing Performance Reports");	

	for (i=First_Report (); i != 0; i=Next_Report ()) {
		switch (i) {
			case TOP_100:			//---- Top 100 V/C Ratio Report ----
				Top_100_Report ();
				break;
			case VC_RATIO:			//---- All V/C Ratios Greater Than x.xx ---
				VC_Ratio (Report_Data ());
				break;
			case LINK_GROUP:		//---- Link Group Report -----
				Link_Group (Report_Data ());
				break;
			case SUM_RIDERS:		//---- Transit Ridership Report ----
				Transit_Report ();
				break;
			case SUM_STOPS:			//---- Transit Stop Report ----
				Stop_Report ();
				break;
			case SUM_TRANSFERS:		//---- Transit Transfer Report ----
				Transfer_Report (0);
				break;
			case XFER_DETAILS:		//---- Transit Transfer Details ----
				num = time_periods.Num_Ranges () * 2 + 1;

				for (j=1; j < num; j++) {
					Transfer_Report (j);
				}
				break;
			case STOP_GROUP:		//---- Transit Stop Group Report ----
				Stop_Group_Report ();
				break;
			case SUM_PASSENGERS:	//---- Transit Passenger Summary ----
				Passenger_Report ();
				break;
			case RIDER_GROUP:		//---- Transit Link Group Summary ----
				Rider_Group ();
				break;
			case TRIP_TIME:			//---- Trip Time Report ----
				Trip_Time ();
				break;
			case SUM_TRAVEL:		//---- Travel Summary Report ----
				Travel_Report ();
				break;
			default:
				break;
		}
	}
	Exit_Stat (DONE);
}
Exemple #21
0
void PlanCompare::MPI_Close (void)
{
#ifdef MPI_EXE
	int i, lvalue [6], rank;

	if (Master ()) {
		if (new_plan_flag) {
			Show_Message (1);

			for (i=1; i < MPI_Size (); i++) {

				rank = Show_MPI_Message ();

				//---- retrieve the new plan statistics

				Get_MPI_Array (lvalue, 6, rank);

				new_plan_file->Add_Files (lvalue [0]);
				new_plan_file->Add_Records (lvalue [1]);
				new_plan_file->Add_Households (lvalue [2]);
				new_plan_file->Add_Persons (lvalue [3]);
				new_plan_file->Add_Tours (lvalue [4]);
				new_plan_file->Add_Trips (lvalue [5]);
			}
			new_plan_file->Close ();
		}

		//---- write the new selection file ----

		if (select_parts) {
			Show_Message (1);

			select_map.swap (selected);
			Write_Selections ();

			for (i=1; i < MPI_Size (); i++) {
				Show_MPI_Message ();
			}
		}
		Show_Message (1);

	} else {	//---- slave ----

		if (new_plan_flag) {
			if (Partition_Range ()) {
				Send_MPI_Message (String ("Slave %d Wrote %ss %d..%d") % MPI_Rank () % new_plan_file->File_Type () % First_Partition () % Last_Partition ());
			} else {
				Send_MPI_Message (String ("Slave %d Wrote %s %d") % MPI_Rank () % new_plan_file->File_Type () % First_Partition ());
			}

			//---- send new plan statistics ----

			lvalue [0] = new_plan_file->Num_Files ();
			lvalue [1] = new_plan_file->Num_Records ();
			lvalue [2] = new_plan_file->Num_Households ();
			lvalue [3] = new_plan_file->Num_Persons ();
			lvalue [4] = new_plan_file->Num_Tours ();
			lvalue [5] = new_plan_file->Num_Trips ();
			new_plan_file->Close ();

			Send_MPI_Array (lvalue, 6);
		}

		//---- write the new selection file ----

		if (select_parts) {
			select_map.swap (selected);
			Write_Selections ();

			Selection_File *file = System_Selection_File (true);

			if (Partition_Range ()) {
				Send_MPI_Message (String ("Slave %d Wrote %ss %d..%d") % MPI_Rank () % file->File_Type () % First_Partition () % Last_Partition ());
			} else {
				Send_MPI_Message (String ("Slave %d Wrote %s %d") % MPI_Rank () % file->File_Type () % First_Partition ());
			}
		}
		Exit_Stat (DONE);
	}
#endif
}
Exemple #22
0
void ConvertTrips::Execute (void)
{
	ConvertTrip_Itr group;

	//---- compile user scripts ----

	Compile_Scripts ();

	//---- read the network ----

	Data_Service::Execute ();

	//---- generate the zone map ----

	Zone_Location ();

	//---- zone summary data ----

	if (zone_sum_flag) {
		org_in.assign (zone_map.size (), 0);
		des_in.assign (zone_map.size (), 0);
		org_out.assign (zone_map.size (), 0);
		des_out.assign (zone_map.size (), 0);
	}

	//---- check the parking lots ----

	if (parking_array.size () > 0) {
		Parking_Check ();
	}

	//---- process group data ----

	Show_Message (1);

	for (group = convert_group.begin (); group != convert_group.end (); group++) {
		group->Read_Diurnal ();
		if (group->Factor_Flag ()) group->Read_Factors (zone_equiv);

		if (group->Mode () == TRANSIT_MODE || group->Mode () == RIDE_MODE || 
			group->Mode () == WALK_MODE || group->Mode () == BIKE_MODE) continue;

		if (veh_type_map.find (group->Veh_Type ()) == veh_type_map.end ()) {
			Error (String ("Vehicle Type %d was Not Found in the Vehicle Type Flle") % group->Veh_Type ());
		}
	}
	if (hhold_id <= max_hh_in) hhold_id = 100 * ((max_hh_in / 100) + 1);

	//---- process the tour file ----

	if (tour_flag) {
		Tour_Processing ();
	}
	if (hhold_id <= max_hh_in) hhold_id = 100 * ((max_hh_in / 100) + 1);

	//---- process trip files ----

	for (group = convert_group.begin (); group != convert_group.end (); group++) {
		if (group->Trip_Flag ()) {
			if (group->Mode () >= 0 && group->Mode () < MAX_MODE && !select_mode [group->Mode ()]) continue;
			if (select_purposes && !purpose_range.In_Range (group->Purpose ())) continue;

			Read_Trip_Table (group);
		}
	}

	//---- new diurnal file ----

	if (diurnal_flag) {
		Diurnal_Results ();
	}

	//---- summarize the results ----

	if (trip_copy > 0 || hhold_copy > 0 || veh_copy > 0) {
		Break_Check (5);

		Write (2, "Number of Trip Records Copied      = ") << trip_copy;
		Write (1, "Number of Household Records Copied = ") << hhold_copy;
		Write (1, "Number of Vehicle Records Copied   = ") << veh_copy;
	}

	Break_Check (10);

	Write (2, "Total Number of Tours Read     = ") << tot_tours;
	Write (1, "Total Number of Trips Read     = ") << tot_trips;
	Write (1, "Total Number of Trips Written  = ") << new_trips;
	if (tot_add > 0.5) {
		Write (1, String ("Total Number of Trips Added    = %.0lf") % tot_add);
	}
	if (tot_del > 0.5) {
		Write (1, String ("Total Number of Trips Deleted  = %.0lf") % tot_del);
	}
	Write (1, "Number of Trips Not Allocated  = ") << tot_errors;

	Write (2, "Number of Households Generated = ") << new_hholds;
	Write (1, "Number of Persons Generated    = ") << new_persons;
	Write (1, "Number of Vehicles Generated   = ") << new_vehicles;

	if (problem_flag) {
		if (problem_file->Num_Trips () > 0) {
			problem_file->Print_Summary ();
		}
	}

	if (zone_sum_flag) {
		Zone_Sum_Report ();
	}

	//---- end the program ----

	Report_Problems (tot_trips);
	Exit_Stat (DONE);
}
Exemple #23
0
void TPPlusNet::Execute (void)
{
	//---- read the conversion script ----

	if (convert_flag) {
		int num;
		Db_Base *files [3];

		if (Report_Flag (SCRIPT_REPORT)) {
			Header_Number (SCRIPT_REPORT);

			if (!Break_Check (10)) {
				Print (1);
				Page_Header ();
			}
		}
		if (link_shape_flag) {
			files [0] = &link_shape_file;
		} else {
			files [0] = &link_file;
		}
		files [1] = Network_Db_Base (NEW_LINK);
		if (detail_flag) {
			files [2] = &detail_file;
			num = 3;
		} else {
			num = 2;
		}
		convert.Set_Files (num, files);

		if (!convert.Compile (&script_file, Report_Flag (SCRIPT_REPORT))) {
			Error ("Compiling Conversion Script");
		}
		if (Report_Flag (STACK_REPORT)) {
			Header_Number (STACK_REPORT);

			convert.Print_Commands (false);
		}
		Header_Number (0);
	}

	//---- setup network data ----

	Network_Service::Execute ();

	//---- read the speed capacity file ----

	if (spdcap_flag) {
		Read_SpdCap ();
	}

	//---- read the node file ----

	Read_Node ();

	//---- read the link file ----

	Read_Link ();

	//---- write the link file ----

	Write_Link ();

	//---- end the program ----

	Exit_Stat (DONE);
}
Exemple #24
0
void PlanPrep::Execute (void)
{
	int i;

	//---- read household lists ----

	if (hhlist_flag) {
		Read_HHList ();
	}

	//---- read the delete household lists ----

	if (delete_flag) {
		Read_Deletes ();
	}

	//---- read fix plan file ----

	if (fix_flag) {
		Read_Fix_Plans ();
	}

	//---- read the plan files ----

	if (sort_flag || merge_flag || subarea_flag || (!combine_flag && output_flag)) {

		size_flag = (max_size_flag && !(combine_flag && combine == FILE_COMBINE));

		for (nfile=0; ; nfile++) {
			first_out = true;

			//---- open the input plans ----

			if (!input_plans.Open (nfile)) break;

			//---- open the merge plans ----

			if (merge_flag) {
				if (!merge_plans.Open (nfile)) {
					File_Error ("Opening Merge Plan File", merge_plans.Filename ());
				}
			} else if (subarea_flag) {
				if (subpart_flag) {
					i = nfile;
				} else {
					i = 0;
					subarea_plans.Reset_Counters ();
				}
				if (!subarea_plans.Open (i)) {
					File_Error ("Opening Subarea Plan File", subarea_plans.Filename ());
				}
			}

			//---- process the plan files ----

			if (combine_flag && combine == MEMORY_COMBINE) {

				//---- sort the input plans ----

				Sort_Plans ();

			} else if (sort_flag) {

				//---- sort the input plans ----

				Sort_Plans ();

				//---- merge and/or write plans ----

				if (merge_flag) {
					Sort_Merge ();
				} else {
					Write_Plans ();
				}
				plan_list.Reset ();

			} else if (hhlist_flag) {

				Partition_Plans ();

			} else {

				//---- merge sorted files or copy to output file ----

				if (merge_flag) {
					File_Merge ();
				} else if (subarea_flag) {
					Subarea_Merge ();
				} else {
					Copy_Plans ();
				}
			}
		}
		if (nfile == 0) {
			File_Error ("No Plan Files were Found", input_plans.Filename ());
		}
	}

	//---- create combined output file ----

	if (combine_flag) {
		nout = 0;
		first_out = true;
		size_flag = max_size_flag;
		input_sort_flag = (sort_flag || input_sort_flag);

		output_plans.Filename (output_name);
		output_plans.Extend (extend);
		output_plans.Reset_Counters ();
		output_plans.File_Format ((binary_flag) ? BINARY : UNFORMATED);

		if (combine == MEMORY_COMBINE) {
			Write_Plans ();
			plan_list.Clear ();
		} else {
			File_Combine ();
		}

	} else if (hhlist_flag) {

		//---- close the files and clear the memory -----

		output_plans.Close ();

		for (i=0; i < nout; i++) {
			plan_file [i]->Close ();

			output_plans.Reset_Counters (output_plans.Num_Records () + plan_file [i]->Num_Records (),
										output_plans.Num_Plans () + plan_file [i]->Num_Plans (),
										output_plans.Num_Travelers () + plan_file [i]->Num_Travelers (),
										output_plans.Num_Trips () + plan_file [i]->Num_Trips ());
			delete plan_file [i];
		}
		delete [] plan_file;
	}

	//---- write summary statistics ----

	Break_Check (6);

	Write (2, "Number of Input Files = %d", nfile);
	Write (1, "Number of Input Plans = %d", input_plans.Num_Plans ());
	Write (1, "Number of Input Records = %d", input_plans.Num_Records ());
	Write (1, "Number of Input Travelers = %d", input_plans.Num_Travelers ());
	Write (1, "Number of Input Trips = %d", input_plans.Num_Trips ());

	if (one_leg_flag) {
		Write (2, "Number of One Leg Plans Deleted = %d", num_one_leg);
	}
	if (merge_flag) {
		Break_Check (7);

		Write (2, "Number of Merge Plans = %d", merge_plans.Num_Plans ());
        Write (1, "Number of Merge Records = %d", merge_plans.Num_Records ());
		Write (1, "Number of Merge Travelers = %d", merge_plans.Num_Travelers ());
		Write (1, "Number of Merge Trips = %d", merge_plans.Num_Trips ());
		Write (2, "Number of Replaced Travelers = %d", replaced);
	} else if (subarea_flag) {
		Break_Check (6);

		Write (2, "Number of Subarea Plans = %d", subarea_plans.Num_Plans ());
        Write (1, "Number of Subarea Records = %d", subarea_plans.Num_Records ());
		Write (1, "Number of Subarea Travelers = %d", subarea_plans.Num_Travelers ());
		Write (1, "Number of Subarea Trips = %d", subarea_plans.Num_Trips ());
		Write (1, "Number of Updated Travelers = %d", updated);
	}
	if (output_flag) {
		Break_Check (6);

		Write (2, "Number of Output Files = %d", nout);
		Write (1, "Number of Output Plans = %d", output_plans.Num_Plans ());
		Write (1, "Number of Output Records = %d", output_plans.Num_Records ());
		Write (1, "Number of Output Travelers = %d", output_plans.Num_Travelers ());
		Write (1, "Number of Output Trips = %d", output_plans.Num_Trips ());
	}
	
	//---- print reports ----

	for (i=First_Report (); i != 0; i=Next_Report ()) {
		switch (i) {
			case PATH_CHANGE:		//---- percent path change ----
				Path_Change ();
				break;
			case TIME_CHANGE:		//---- percent travel time change ---
				Travel_Time_Change ();
				break;
			case FIX_PLAN:			//---- fix plan list ----
				Fix_Plan_Report ();
				break;
			default:
				break;
		}
	}
	Exit_Stat (DONE);
}
Exemple #25
0
void SubareaNet::Execute (void)
{

	//---- read the network ----

	Network_Service::Execute ();

	//---- save the node file ----

	Write_Node ();

	//---- save the shape file ----

	if (Network_File_Flag (NEW_SHAPE)) {
		Write_Shape ();
	}

	//---- save the timing plan file ----

	if (Network_File_Flag (NEW_TIMING_PLAN)) {
		Write_Timing ();
	}

	//---- save the signal coordinator file ----

	if (Network_File_Flag (NEW_SIGNAL_COORDINATOR)) {
		Write_Coordinator ();
	}

	//---- write the boundary records ----

	Write_Boundary ();

	//---- save the transit files ----

	if (transit_flag) {
		Write_Route ();
	}

	//---- summary statistics ----

	Break_Check (8);
	Print (1);
	Write (1, "Number of Subarea Node Records = %d", nnode);
	Write (1, "Number of Subarea Link Records = %d", nlink);
	Write (1, "Number of Subarea Pocket Lane Records = %d", npocket);
	Write (1, "Number of Subarea Lane Connectivity Records = %d", nconnect);
	Write (1, "Number of Subarea Activity Locations = %d", nlocation);
	Write (1, "Number of Subarea Parking Lots = %d", nparking);
	Write (1, "Number of Subarea Process Links = %d", naccess);

	Break_Check (11);
	if (Network_File_Flag (NEW_ZONE)) {
		Write (1, "Number of Subarea Zone Records = %d", nzone);
	}
	if (Network_File_Flag (NEW_SHAPE)) {
		Write (1, "Number of Subarea Shape Records = %d", nshape);
	}
	if (Network_File_Flag (NEW_LANE_USE)) {
		Write (1, "Number of Subarea Lane Use Records = %d", nlane_use);
	}
	if (Network_File_Flag (NEW_TURN_PROHIBITION)) {
		Write (1, "Number of Subarea Turn Prohibition Records = %d", nturn);
	}
	if (Network_File_Flag (NEW_TOLL)) {
		Write (1, "Number of Subarea Toll Records = %d", ntoll);
	}
	if (Network_File_Flag (NEW_UNSIGNALIZED_NODE)) {
		Write (1, "Number of Subarea Unsignalized Node Records = %d", nsign);
	}
	if (Network_File_Flag (NEW_SIGNALIZED_NODE)) {
		Write (1, "Number of Subarea Signalized Node Records = %d", nsignal);
	}
	if (Network_File_Flag (NEW_TIMING_PLAN)) {
		Write (1, "Number of Subarea Timing Plan Records = %d", ntiming);
	}
	if (Network_File_Flag (NEW_PHASING_PLAN)) {
		Write (1, "Number of Subarea Phasing Plan Records = %d", nphasing);
	}
	if (Network_File_Flag (NEW_DETECTOR)) {
		Write (1, "Number of Subarea Detector Records = %d", ndetector);
	}
	if (Network_File_Flag (NEW_SIGNAL_COORDINATOR)) {
		Write (1, "Number of Subarea Signal Coordinator Records = %d", ncoord);
	}
	if (transit_flag) {
		Write (1, "Number of Subarea Transit Stop Records = %d", nstop);
		Write (1, "Number of Subarea Transit Route Records = %d", nroute);
		Write (1, "Number of Subarea Transit Schedule Records = %d", nschedule);
		Write (1, "Number of Subarea Transit Driver Records = %d", ndriver);
	}

	Break_Check (7);
	Write (2, "Number of Boundary Links = %d", nboundary);
	Write (1, "Number of Short Links Skipped = %d", nshort);
	Write (1, "Number of New Activity Locations = %d", new_location);
	Write (1, "Number of New Parking Lots = %d", new_parking);
	Write (1, "Number of New Process Links = %d", new_access);
	if (transit_flag) {
		Write (1, "Number of New Transit Stops = %d", new_stop);
		Write (1, "Number of New Transit Routes = %d", new_route);
	}
	Show_Message (1);

	Exit_Stat (DONE);
}
Exemple #26
0
void AdjustPlans::Execute (void)
{
	int i, nfile, error, count;
	double percent;

	Count_Data *count_ptr;

	//---- read vehicle file later ----

	Demand_File_False (VEHICLE);

	//---- read the network ----

	Demand_Service::Execute ();

	//---- read the count file ----

	Read_Counts ();

	//---- read the plan file ----

	for (nfile=0; ; nfile++) {
		if (!plan_file.Open (nfile)) break;

		//---- process the plan files ----

		Read_Plans ();
	}
	if (nfile == 0) {
		File_Error ("No Plan Files were Found", plan_file.Filename ());
	}

	//---- write summary statistics ----

	Break_Check (8);

	Write (2, "Number of Plan Files = %d", nfile);
	Write (1, "Number of Input Plans = %d", plan_file.Num_Plans ());
	Write (1, "Number of Input Records = %d", plan_file.Num_Records ());
	Write (1, "Number of Input Travelers = %d", plan_file.Num_Travelers ());
	Write (1, "Number of Input Trips = %d", plan_file.Num_Trips ());

	count = travel_data.Num_Records ();

	if (count == 0) {
		Error ("No Plans are using the Count Links");
	} else {
		Print (2, "Number of Plans using Count Links = %d", count);
	}

	//---- iterate to minimize error ----

	for (i=1; i <= max_iter; i++) {

		//---- calculate the error ---

		error = count = 0;

		for (count_ptr = count_data.First (); count_ptr; count_ptr = count_data.Next ()) {
			error += abs (count_ptr->Difference ()); 
			count += count_ptr->Count ();
		}
		if (count == 0) break;

		percent = 100.0 * error / count;

		Write (2, "Iteration %d: Percent Error = %.2lf", i, percent);

		if (percent <= max_error) break;

		//---- make adjustments ----

		if (!Adjust_Weights ()) break;
	}

	//---- convergence file ----

	if (converge_flag) {
		Write_Results ();
	}

	//---- output the results ----

	if (output_flag) {
		max_household = max_traveler / Traveler_Scale ();

		//---- copy plan records ----

		Show_Message (1);

		for (nfile=0; ; nfile++) {
			if (!plan_file.Open (nfile)) break;

			if (!new_plan_file.Open (nfile)) {
				Error ("Creating %s", new_plan_file.File_Type ());
			}
			if (hhold_flag) {
				if (!hhold_file.Open (nfile)) {
					Error ("Creating New Household List");
				}
			}
			Copy_Plans ();
		}

		//---- write summary statistics ----

		Break_Check (8);

		Write (2, "Number of New Plan Files = %d", nfile);
		Write (1, "Number of Output Plans = %d", new_plan_file.Num_Plans ());
		Write (1, "Number of Output Records = %d", new_plan_file.Num_Records ());
		Write (1, "Number of Output Travelers = %d", new_plan_file.Num_Travelers ());
		Write (1, "Number of Output Trips = %d", new_plan_file.Num_Trips ());

		Break_Check (4);

		Write (2, "Number of Plans Deleted = %d", num_deleted);
		Write (1, "Number of Plans Replicated = %d", num_replicated);
		Write (1, "Number of Replicated Plans = %d", num_added);

		//---- update the vehicle file ----

		Copy_Vehicles ();
	}
	Exit_Stat (DONE);
}
Exemple #27
0
void TransimsNet::Execute (void)
{
	Int_Map_Itr map_itr;

	//---- read the update and delete files ----

	if (update_link_flag || update_node_flag || delete_link_flag || delete_node_flag) {
		//Read_Files ();
	}

	//---- read the network ----

	Data_Service::Execute ();

	//---- set the record numbers ----

	location_base = (int) location_array.size ();
	if (location_base > 0) {
		map_itr = --location_map.end ();
		location_id = ((map_itr->first / 100) + 1) * 100 - 1;
	}
	parking_base = (int) parking_array.size ();
	if (parking_base > 0) {
		map_itr = --parking_map.end ();
		parking_id = ((map_itr->first / 100) + 1) * 100 - 1;
	}
	
	//---- read the link detail file ----

	if (link_detail_flag) {
		Read_Details ();
	}

	//---- read the zone boundary file ----

	if (boundary_flag) {
		Read_Boundary ();
	}

	//---- add link access points ----

	Link_Access ();

	Write_Locations ();
	Write_Parking_Lots ();

	//---- build the link connection list ----

	Connections ();

	//---- create traffic controls ----

	Traffic_Controls ();

	Write_Signs ();
	Write_Signals ();

	//---- create pocket lanes ----

	Pocket_Lanes ();

	Write_Pockets ();

	//---- create lane ranges ----

	Lane_Ranges ();

	Write_Connections ();

	//---- write the network ----

	nnode = (int) node_array.size ();
	nlink = (int) link_array.size ();
	nshapes = (int) shape_array.size ();

	Write_Nodes ();

	if (zout_flag) {
		nzout = (int) zone_array.size ();
		Write_Zones ();
	}
	if (shape_flag) {
		nshape = Write_Shapes ();
	}
	Write_Links ();

	//---- link detail lane use ----

	if (link_detail_flag && System_File_Flag (NEW_LANE_USE)) {
		Lane_Use ();
		nuse = (int) lane_use_array.size ();

		Write_Lane_Uses ();
	}

	//---- write the turn penalties ----

	if (turn_flag && Network_File_Flag (NEW_TURN_PENALTY)) {
		Write_Turn_Pens ();
	}

	//---- write summary statistics ----

	Break_Check (6);
	Write (2, "Number of Input Node Records = ") << node_array.size ();
	Write (1, "Number of Input Link Records = ") << link_array.size ();
	Write (1, "Number of Input Zone Records = ") << zone_array.size ();

	Write (2, "Highest Zone Number = ") << Max_Zone_Number ();

	if (update_flag || delete_flag) {
		Break_Check (10);
		Write (1);
		if (xlink) Write (1, "Number of Deleted Link Records = ") << xlink;
		if (xnode) Write (1, "Number of Deleted Node Records = ") << xnode;
		if (xactivity) Write (1, "Number of Deleted Location Records = ") << xactivity;
		if (xparking) Write (1, "Number of Deleted Parking Lot Records = ") << xparking;
		if (xprocess) Write (1, "Number of Deleted Access Link Records = ") << xprocess;
		if (xpocket) Write (1, "Number of Deleted Pocket Lane Records = ") << xpocket;
		if (xconnect) Write (1, "Number of Deleted Connection Records = ") << xconnect;
		if (xuse) Write (1, " Number of Deleted Lane Use Records = ") << xuse;
		if (xsign) Write (1, "Number of Deleted Sign Records = ") << xsign;
		if (xsignal) Write (1, "Number of Deleted Signal Records = ") << xsignal;	
	}

	Break_Check (15);
	Write (2, "Number of New Node Records = ") << nnode;
	if (zout_flag) {
		Write (1, "Number of New Zone Records = ") << nzout;
	}
	Write (1, "Number of New Link Records = ") << nlink;

	if (shape_flag) {
		Write (1, "Number of New Link Shapes = ") << nshapes;
		Write (1, "Number of New Shape_Records = ") << nshape;
	}
	Write (1, "Number of New Location Records = ") << ((int) location_array.size () - location_base);
	Write (1, "Number of New Parking Lot Records = ") << ((int) parking_array.size () - parking_base);
	Write (1, "Number of New Access Link Records = ") << nprocess;
	Write (1, "Number of New Pocket Lane Records = ") << npocket;
	Write (1, "Number of New Connection Records = ") << nconnect;
	if (nturn > 0) Write (1, "Number of New Turn Penalty Records = ") << nturn;
	if (nuse > 0) Write (1, "Number of New Lane Use Records = ") << nuse;
	Write (1, "Number of New Sign Records = ") << nsign;
	Write (1, "Number of New Signal Records = ") << nsignal;

	if (nexternal) {
		Write (2, "Number of External Connections = ") << nexternal;
	}
	if (nshort) {
		Print (2, "Number of Short Links Increased in Length = ") << nshort;
	}
	if (nlength) {
		Print (2, "Number of Coordinate-Based Length Adjustments = ") << nlength;
	}
	if (nsign > 0) {
		Break_Check (2);
		Print (1);
		if (nstop > 0) {
			Print (1, "Number of Stop Signs = ") << nstop;
		}
		if (nyield > 0) {
			Print (1, "Number of Yield Signs = ") << nyield;
		}
	}
	if (nsignal > 0) {
		Break_Check (5);
		Print (1);
		if (nfixed1 > 0) {
			Print (1, "Number of Fixed Timed Single Ring Signals = ") << nfixed1;
		}
		if (nfixed2 > 0) {
			Print (1, "Number of Fixed Timed Dual Ring Signals = ") << nfixed2;
		}
		if (nfixed3 > 0) {
			Print (1, "Number of Fixed Timed Triple Ring Signals = ") << nfixed3;
		}
		if (nactuated1 > 0) {
			Print (1, "Number of Demand Actuated Single Ring Signals = ") << nactuated1;
		}
		if (nactuated2 > 0) {
			Print (1, "Number of Demand Actuated Dual Ring Signals = ") << nactuated2;
		}
		if (nactuated3 > 0) {
			Print (1, "Number of Demand Actuated Triple Ring Signals = ") << nactuated3;
		}
	}
	Exit_Stat (DONE);
}
Exemple #28
0
void IntControl::Execute (void)
{
	if (delete_flag) {
		Read_Deletes ();
	}

	//---- read the network files ----

	Network_Service::Execute ();

	//---- read the turn volumes ----

	if (turn_flag) {
		Read_Turn ();
	} else if (delay_flag) {
		Read_Delay ();
	}

	//---- read the sign file ----

	if (input_sign_flag) {
		Read_Signs ();
	}

	//---- read the signal file ----

	if (input_signal_flag) {
		Read_Signals ();
	}

	//---- prepare the data ----

	Data_Setup ();

	//---- process the sign data ----

	if (sign_flag) {
		Write_Signs ();
	}

	//---- process the signal data ----

	if (signal_flag) {
		if (!regen_flag && (delete_flag || !update_flag)) {
			Copy_Signals ();
		}
		if (update_flag) {
			if (input_signal_flag) {
				Pocket_Lanes ();

				Update_Signals ();
			}
		} else {
			Pocket_Lanes ();

			Connection_List ();

			Write_Signals ();
		}
	}

	//---- processing results ----

	if (sign_flag) {
		Write (2, "Number of Unsignalized Node Changes = %d", nsign);
	}
	if (signal_flag) {
 		if (update_flag && !delete_flag) {
			Write (2, "Number of Timing Plan Changes = %d", ntiming);
		} else {
			Break_Check (6);
			Write (2, "Number of Signalized Node Changes = %d", nsignal);
			Write (1, "Number of Timing Plan Changes = %d", ntiming);
			Write (1, "Number of Phasing Plan Changes = %d", nphasing);
			Write (1, "Number of Detector Changes = %d", ndetector);
			Write (1, "Number of Signal Coordinator Changes = %d", ncoord);
		}
	}

	//---- end the program ----

	Exit_Stat (DONE);
}
Exemple #29
0
void ArcPlan::Execute (void)
{
	int nfile;

	//---- read the network ----

	Demand_Service::Execute ();

	//---- allocate bandwidth memory ----

	if (width_flag) {
		int ndir = dir_data.Num_Records () + 1;

		width_data = new int [ndir];

		if (width_data == NULL) {
			Error ("Insufficient Memory for Bandwidth Data");
		}
		memset (width_data, '\0', ndir * sizeof (int));
	}

	//---- allocate contour memory ----

	if (time_flag || distance_flag) {
		int ndir = dir_data.Num_Records () + 1;

		link_flag = new bool [ndir];

		if (link_flag == NULL) {
			Error ("Insufficient Memory for Contour Data");
		}
		memset (link_flag, '\0', ndir * sizeof (bool));
	}

	//---- allocate transit memory ----

	if (rider_flag || on_off_flag) {
		Setup_Riders ();
	}

	//---- allocate parking memory ----

	if (parking_flag) {
		int nlots = parking_offset.Num_Records () + 1;

		parking_out = new int [nlots];
		parking_in = new int [nlots];

		if (parking_out == NULL || parking_in == NULL) {
			Error ("Insufficient Memory for Parking Demand Data");
		}
		memset (parking_out, '\0', nlots * sizeof (int));
		memset (parking_in, '\0', nlots * sizeof (int));
	}

	//---- read the household list ----

	if (hhlist_flag) {
		Read_HHList ();
	}

	//---- read the problem file ----

	if (problem_flag) {
		Read_Problem ();
	}

	//---- read the plan file ----

	for (nfile=0; ; nfile++) {
		if (!plan_file.Open (nfile)) break;

		//---- process the plan files ----

		Read_Plan ();
	}

	if (nfile == 0) {
		File_Error ("No Plan Files were Found", plan_file.Filename ());
	}
	if (plan_flag) {
		arcview_plan.Close ();
	}
	if (time_flag) {
		arcview_time.Close ();
	}
	if (distance_flag) {
		arcview_distance.Close ();
	}
	if (access_flag) {
		arcview_access.Close ();
	}

	//---- write bandwidth shapes ----

	if (width_flag) {
		Write_Bandwidth ();
	}

	//---- write ridership shapes ----

	if (rider_flag) {
		Write_Riders ();
	}

	//---- write transit stops file ----

	if (on_off_flag) {
		if (demand_flag) Write_Stops ();
		if (group_flag) Write_Group ();
	}

	//---- write parking lots file ----

	if (parking_flag) {
		Write_Parking ();
	}

	//---- write summary statistics ----

	Break_Check (9);
	Write (2, "Number of Plan Files = %d", nfile);
	Write (1, "Number of Input Plans = %d", plan_file.Num_Plans ());
	Write (1, "Number of Input Records = %d", plan_file.Num_Records ());
	Write (1, "Number of Input Travelers = %d", plan_file.Num_Travelers ());
	Write (1, "Number of Input Trips = %d", plan_file.Num_Trips ());

	Write (1);
	if (plan_flag) Write (1, "Number of ArcView Plan Shape Records = %d", num_out);
	if (problem_flag) Write (1, "Number of ArcView Problem Shape Records = %d", num_problem);
	if (width_flag) Write (1, "Number of ArcView Bandwidth Shape Records = %d", num_width);
	if (time_flag) Write (1, "Number of ArcView Time Contour Shape Records = %d", num_time);
	if (distance_flag) Write (1, "Number of ArcView Distance Contour Shape Records = %d", num_distance);
	if (access_flag) Write (1, "Number of ArcView Accessibility Shape Records = %d", num_access);
	if (rider_flag) Write (1, "Number of ArcView Ridership Shape Records = %d", num_rider);
	if (demand_flag) Write (1, "Number of ArcView Stop Demand Shape Records = %d", num_stop);
	if (group_flag) Write (1, "Number of ArcView Stop Group Shape Records = %d", num_group);
	if (parking_flag) Write (1, "Number of ArcView Parking Demand Shape Records = %d", num_parking);

	Exit_Stat (DONE);
}
Exemple #30
0
void PlanCompare::MPI_Processing (void)
{
#ifdef MPI_EXE
	int i, lvalue [7], rank;

	if (Master ()) {
		Write (1);

		for (i=1; i < MPI_Size (); i++) {

			rank = Show_MPI_Message ();

			//---- retrieve the data buffer ----

			Get_MPI_Buffer (rank);
			
			if (mpi_buffer.Size () == 0) continue;

			//---- retrieve the plan statistics

			mpi_buffer.Get_Data (lvalue, sizeof (lvalue));

			plan_file->Add_Files (lvalue [0]);
			plan_file->Add_Records (lvalue [1]);
			plan_file->Add_Households (lvalue [2]);
			plan_file->Add_Persons (lvalue [3]);
			plan_file->Add_Tours (lvalue [4]);
			plan_file->Add_Trips (lvalue [5]);
			num_trips += lvalue [6];

			//---- retrieve the compare statistics

			mpi_buffer.Get_Data (lvalue, sizeof (lvalue));

			compare_file.Add_Files (lvalue [0]);
			compare_file.Add_Records (lvalue [1]);
			compare_file.Add_Households (lvalue [2]);
			compare_file.Add_Persons (lvalue [3]);
			compare_file.Add_Tours (lvalue [4]);
			compare_file.Add_Trips (lvalue [5]);
			num_compare += lvalue [6];

			//---- selection map data ----

			selected.UnPack (mpi_buffer);

			//---- time difference data ----

			if (time_diff.Active_Flag ()) {
				Difference_Data temp;
				temp.Replicate (time_diff);

				temp.UnPack (mpi_buffer);
				time_diff.Merge_Data (temp);
			}

			//---- cost difference data ----

			if (cost_diff.Active_Flag ()) {
				Difference_Data temp;
				temp.Replicate (cost_diff);

				temp.UnPack (mpi_buffer);
				cost_diff.Merge_Data (temp);
			}

			//---- time gap data ----

			if (time_gap.Active_Flag ()) {
				Trip_Gap_Data temp;
				temp.Replicate (time_gap);

				temp.UnPack (mpi_buffer);
				time_gap.Merge_Data (temp);
			}

			//---- cost gap data ----

			if (cost_gap.Active_Flag ()) {
				Trip_Gap_Data temp;
				temp.Replicate (cost_gap);

				temp.UnPack (mpi_buffer);
				cost_gap.Merge_Data (temp);
			}

		}
		Show_Message (1);

		plan_file->Close ();
		compare_file.Close ();

	} else {	//---- slave ----

		if (Partition_Range ()) {
			Send_MPI_Message (String ("Slave %d Read %ss %d..%d") % MPI_Rank () % plan_file->File_Type () % First_Partition () % Last_Partition ());
		} else {
			Send_MPI_Message (String ("Slave %d Read %s %d") % MPI_Rank () % plan_file->File_Type () % First_Partition ());
		}

		//---- send plan statistics ----

		lvalue [0] = plan_file->Num_Files ();
		lvalue [1] = plan_file->Num_Records ();
		lvalue [2] = plan_file->Num_Households ();
		lvalue [3] = plan_file->Num_Persons ();
		lvalue [4] = plan_file->Num_Tours ();
		lvalue [5] = plan_file->Num_Trips ();
		lvalue [6] = num_trips;
		plan_file->Close ();

		mpi_buffer.Data (lvalue, sizeof (lvalue));

		//---- send compare statistics ----

		lvalue [0] = compare_file.Num_Files ();
		lvalue [1] = compare_file.Num_Records ();
		lvalue [2] = compare_file.Num_Households ();
		lvalue [3] = compare_file.Num_Persons ();
		lvalue [4] = compare_file.Num_Tours ();
		lvalue [5] = compare_file.Num_Trips ();
		lvalue [6] = num_compare;
		compare_file.Close ();

		mpi_buffer.Add_Data (lvalue, sizeof (lvalue));

		//---- selection map data ----

		selected.Pack (mpi_buffer);

		//---- time difference data ----

		if (time_diff.Active_Flag ()) {
			time_diff.Pack (mpi_buffer);
		}

		//---- cost difference data ----

		if (cost_diff.Active_Flag ()) {
			cost_diff.Pack (mpi_buffer);
		}

		//---- time gap data ----

		if (time_gap.Active_Flag ()) {
			time_gap.Pack (mpi_buffer);
		}

		//---- cost gap data ----

		if (cost_gap.Active_Flag ()) {
			cost_gap.Pack (mpi_buffer);
		}

		//---- send the data buffer ----

		Send_MPI_Buffer ();

		if (!new_plan_flag && !select_parts) Exit_Stat (DONE);
	}
#endif
}