예제 #1
0
 def __init__(self, rng=None):
     super(Wheel, self).__init__()
     self.bins = tuple(bin.Bin() for _ in range(38))
     if rng is None:
         self.rng = random.Random()
     else:
         self.rng = rng
예제 #2
0
    def __init__(self, area_id, service_frequency, threshold, bins, bin_volume,
                 lorry, route_map):
        self.area_id = area_id
        self.service_frequency = 1.0 / service_frequency
        self.lorry = lorry
        self.bins = {}
        for i in range(1, int(bins + 1)):
            a_bin = bin.Bin(bin_volume, self.area_id, i, threshold)
            self.bins[i] = a_bin
        self.distance_map = convert_road_matrix_to_distance_dict(route_map)

        self.overflown_bins = 0
        # self.full_bins = 0
        self.empty_bins = 0
예제 #3
0
 def setUp(self):
     self.outcome = outcome.Outcome('odd', 1)
     self.outcome2 = outcome.Outcome('even', 2)
     self.bin = bin.Bin(self.outcome)
     self.bin2 = bin.Bin(self.outcome2)
     self.wheel = Wheel(random.Random())