Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #2

Open
IamJimiaomiao opened this issue Dec 14, 2022 · 1 comment
Open

IndexError: list index out of range #2

IamJimiaomiao opened this issue Dec 14, 2022 · 1 comment

Comments

@IamJimiaomiao
Copy link

# test on different driver number
driver_coefficients = [0.1, 0.25, 0.5]

for d in driver_coefficients:
    city = City(g_line, call_generator, driver_initializer, total_driver_number_per_time=total_driver_number_per_time, 
            speed_info = speed_info, name='real_city_with_speed', driver_coefficient=d, consider_speed = True)
    
    test_all_for_city(city, "real_city_with_driver_%.2f" % d)

When I run the last part of the code, I get an error. I don't know if it's a code problem or a data problem. This question has been bothering me for a long time. I am looking forward to your answer. Thank you very much. The error message is as follows:

E:\try-delete\TaxiSimulatorOnGraph-master -aa\TaxiSimulatorOnGraph-master\call_generator.py in generate_call(self, city, is_initialize, seed)
72
73 def generate_call(self, city: City, is_initialize=False, seed=None):
---> 74 call_at_t = self.day_orders[city.city_time]
75 # generate call objects to each road of the city.
76 for call in call_at_t:

IndexError: list index out of range

@juhyeonkim95
Copy link
Owner

Hi, first thank you for showing interest in my code.

The length of self.day_orders is self.total_time_step which should be always larger than city.city_time.

Please check total_time_step (I used 1 minute as a unit step so 60 min x 24 hours = 1440) is always larger than city.city_time during the simulation.

If you are simulating multiple days, you have to explicitly renew city.city_time to zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants