Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- class Stop:
- def __init__(self, no_ppl):
- self.no_ppl = no_ppl
- self.pending = []
- class Bus:
- def __init__(self):
- self.passengers = []
- class Passenger:
- def __init__(self, move_time):
- self.move_time = abs(move_time)
- # Parametry
- # - ilosc przystanków
- # - czasy wsiadania
- # Wskaznik jakosci:
- # Czas postoju na przystanku
- stop1 = Stop(int(np.random.normal(5, 3)))
- stop2 = Stop(int(np.random.normal(5, 3)))
- bus1 = Bus()
- # tworzenie pasazerow
- for i in range(stop1.no_ppl):
- stop1.pending.append(abs(np.random.normal(10, 5)))
- # wsiadanie
- bus1.passengers.extend(stop1.pending)
- for i in range(stop2.no_ppl):
- stop2.pending.append(Passenger(np.random.normal(10, 5)))
- print(stop1.pending)
- #print("---------------------")
- #print(stop2.pending)
- #print(bus1.passengers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement