...
while keeping velocity and time within given constraints
User input data
elev_profile
, distance
, dist_step
, time
, min_velocity
, max_stop_velocity
...
stop_profile
:
generated from map_data
elev_profile
:
generated from map_data
max_velocity
Code Breakdown
...
Parameters: The maximum allowable time to cover a distance in seconds (time), the distance to be covered in meters (distance), the list of pitches map of elevations that the car must travel (e_profile), the minimum allowable velocity (min_velocity), and the list of indices where the car must stop (stop_profile)
Returns:
initial_profile
: A map of the same dimensions as the map of elevations with each element representing the average velocity required for the car to move at each point on the map of elevations (initial_profile).Ex.
initial_profile
[2] = 10 means that according to the initial profile, the car should be moving 10 m/s at point 3 (Index 2) on the map of elevations.This function basically generates the naive/initial solution that will be improved upon through the optimization function later in the program.
...
Parameters: The velocity profile (v_profile)
Returns: The negative sum of how much the car’s velocity in v_profile is greater than the maximum velocity at each point in the map of elevations (error)
If the velocity in v_profile isn’t greater than the maximum velocity at a certain point, the error variable will not be incremented