コード例 #1
0
 def test_finalize(self):
     node_profile = NodeProfileMultiObjective(label_class=LabelTimeWithBoardingsCount, dep_times=[10])
     own_label = LabelTimeWithBoardingsCount(departure_time=10, arrival_time_target=20, n_boardings=0, first_leg_is_walk=False)
     self.assertTrue(node_profile.update([own_label]))
     neighbor_label = LabelTimeWithBoardingsCount(departure_time=15, arrival_time_target=18, n_boardings=2, first_leg_is_walk=False)
     assert(len(node_profile.get_labels_for_real_connections()) == 1)
     node_profile.finalize([[neighbor_label]], [3])
     assert (len(node_profile.get_final_optimal_labels()) == 2)
     self.assertTrue(any(map(lambda el: el.departure_time == 12, node_profile.get_final_optimal_labels())))
コード例 #2
0
 def test_pareto_optimality_with_transfers_only(self):
     LabelClass = LabelVehLegCount
     node_profile = NodeProfileMultiObjective(dep_times=[5, 6, 7], label_class=LabelClass)
     pt3 = LabelClass(departure_time=5, n_vehicle_legs=0, last_leg_is_walk=False)
     pt2 = LabelClass(departure_time=6, n_vehicle_legs=1, last_leg_is_walk=False)
     pt1 = LabelClass(departure_time=7, n_vehicle_legs=2, last_leg_is_walk=False)
     self.assertTrue(node_profile.update([pt1]))
     self.assertTrue(node_profile.update([pt2]))
     self.assertTrue(node_profile.update([pt3]))
     node_profile.finalize()
     self.assertEqual(1, len(node_profile.get_final_optimal_labels()))