def __init__(self, labels, walk_time_to_target, start_time_dep, end_time_dep):
self.start_time_dep = start_time_dep<EOL>self.end_time_dep = end_time_dep<EOL>all_pareto_optimal_tuples = [pt for pt in labels if<EOL>(start_time_dep < pt.departure_time < end_time_dep)]<EOL>labels_after_dep_time = [label for label in labels if label.departure_time >= self.end_time_dep]<EOL>if labels_after_dep_time:<EOL><INDENT>next_label_after_end_time = min(labels_after_dep_time, key=lambda el: el.arrival_time_target)<EOL>all_pareto_optimal_tuples.append(next_label_after_end_time)<EOL><DEDENT>all_pareto_optimal_tuples = sorted(all_pareto_optimal_tuples, key=lambda ptuple: ptuple.departure_time)<EOL>arrival_time_target_at_end_time = end_time_dep + walk_time_to_target<EOL>previous_trip = None<EOL>for trip_tuple in all_pareto_optimal_tuples:<EOL><INDENT>if previous_trip:<EOL><INDENT>assert(trip_tuple.arrival_time_target > previous_trip.arrival_time_target)<EOL><DEDENT>if trip_tuple.departure_time > self.end_time_depand trip_tuple.arrival_time_target < arrival_time_target_at_end_time:<EOL><INDENT>arrival_time_target_at_end_time = trip_tuple.arrival_time_target<EOL><DEDENT>previous_trip = trip_tuple<EOL><DEDENT>self._walk_time_to_target = walk_time_to_target<EOL>self._profile_blocks = []<EOL>previous_departure_time = start_time_dep<EOL>self.trip_durations = []<EOL>self.trip_departure_times = []<EOL>for trip_pareto_tuple in all_pareto_optimal_tuples:<EOL><INDENT>if trip_pareto_tuple.departure_time > self.end_time_dep:<EOL><INDENT>continue<EOL><DEDENT>if self._walk_time_to_target <= trip_pareto_tuple.duration():<EOL><INDENT>print(self._walk_time_to_target, trip_pareto_tuple.duration())<EOL>assert(self._walk_time_to_target > trip_pareto_tuple.duration())<EOL><DEDENT>effective_trip_previous_departure_time = max(<EOL>previous_departure_time,<EOL>trip_pareto_tuple.departure_time - (self._walk_time_to_target - trip_pareto_tuple.duration())<EOL>)<EOL>if effective_trip_previous_departure_time > previous_departure_time:<EOL><INDENT>walk_block = ProfileBlock(start_time=previous_departure_time,<EOL>end_time=effective_trip_previous_departure_time,<EOL>distance_start=self._walk_time_to_target,<EOL>distance_end=self._walk_time_to_target<EOL>)<EOL>self._profile_blocks.append(walk_block)<EOL><DEDENT>trip_waiting_time = trip_pareto_tuple.departure_time - effective_trip_previous_departure_time<EOL>trip_block = ProfileBlock(end_time=trip_pareto_tuple.departure_time,<EOL>start_time=effective_trip_previous_departure_time,<EOL>distance_start=trip_pareto_tuple.duration() + trip_waiting_time,<EOL>distance_end=trip_pareto_tuple.duration())<EOL>self.trip_durations.append(trip_pareto_tuple.duration())<EOL>self.trip_departure_times.append(trip_pareto_tuple.departure_time)<EOL>self._profile_blocks.append(trip_block)<EOL>previous_departure_time = trip_pareto_tuple.departure_time<EOL><DEDENT>if not self._profile_blocks or self._profile_blocks[-<NUM_LIT:1>].end_time < end_time_dep:<EOL><INDENT>if len(self._profile_blocks) > <NUM_LIT:0>:<EOL><INDENT>dep_previous = self._profile_blocks[-<NUM_LIT:1>].end_time<EOL><DEDENT>else:<EOL><INDENT>dep_previous = start_time_dep<EOL><DEDENT>waiting_time = end_time_dep - dep_previous<EOL>distance_end_trip = arrival_time_target_at_end_time - end_time_dep<EOL>walking_wait_time = min(end_time_dep - dep_previous,<EOL>waiting_time - (self._walk_time_to_target - distance_end_trip))<EOL>walking_wait_time = max(<NUM_LIT:0>, walking_wait_time)<EOL>if walking_wait_time > <NUM_LIT:0>:<EOL><INDENT>walk_block = ProfileBlock(start_time=dep_previous,<EOL>end_time=dep_previous + walking_wait_time,<EOL>distance_start=self._walk_time_to_target,<EOL>distance_end=self._walk_time_to_target<EOL>)<EOL>assert (walk_block.start_time <= walk_block.end_time)<EOL>assert (walk_block.distance_end <= walk_block.distance_start)<EOL>self._profile_blocks.append(walk_block)<EOL><DEDENT>trip_waiting_time = waiting_time - walking_wait_time<EOL>if trip_waiting_time > <NUM_LIT:0>:<EOL><INDENT>try:<EOL><INDENT>trip_block = ProfileBlock(start_time=dep_previous + walking_wait_time,<EOL>end_time=dep_previous + walking_wait_time + trip_waiting_time,<EOL>distance_start=distance_end_trip + trip_waiting_time,<EOL>distance_end=distance_end_trip)<EOL>assert (trip_block.start_time <= trip_block.end_time)<EOL>assert (trip_block.distance_end <= trip_block.distance_start)<EOL>self._profile_blocks.append(trip_block)<EOL><DEDENT>except AssertionError as e:<EOL><INDENT>assert(trip_waiting_time < <NUM_LIT:10>**-<NUM_LIT:5>)<EOL><DEDENT><DEDENT><DEDENT>self.profile_block_analyzer = ProfileBlockAnalyzer(profile_blocks=self._profile_blocks)<EOL>
Initialize the data structures required by

Parameters
----------
node_profile: NodeProfileSimple