Main interface#

Methods and classes for end-user.

smart_cruise.smart_cruise.BACKOFF = 9#

Default backoff for changing speed.

class smart_cruise.smart_cruise.Cruise(model=None, parameters=None)[source]#
Parameters:

Examples

>>> from smart_cruise import CostRandom
>>> model = CostRandom(n_d=100, seed=42)
>>> cruise = Cruise(model)
>>> cruise.parameters.pareto_max = 5
>>> cruise.compute()
>>> w, t = cruise.trajectories.get_front()

Weight optimal values:

>>> f"Weight: {w[0]:.2f}, time: {t[0]:.2f}"
'Weight: 23160.79, time: 21102.36'

Time optimal values: >>> f”Weight: {w[-1]:.2f}, time: {t[-1]:.2f}” ‘Weight: 20938.41, time: 22734.91’

class smart_cruise.smart_cruise.CruiseParameters(backoff: int = 9, pareto_max: int = 30)[source]#
backoff#

Timer to change speed.

Type:

int, default=BACKOFF

pareto_max#

Max number of pareto-optimal points per state.

Type:

int, default=PARETO_MAX

smart_cruise.smart_cruise.PARETO_MAX = 30#

Default discretization of the Pareto front of individual states.

smart_cruise.smart_cruise.T0 = 26000.0#

Default time budget.

class smart_cruise.smart_cruise.Trajectories(trajs, n_h, n_s)[source]#

Handler class for optimal trajectories.

Parameters:
  • trajs (ndarray) – \(n_t \times n_d\) array of \((h, s, w, t)\) states.

  • n_h (int) – Number of heights (for normalization).

  • n_s (int) – Number of speeds (for normalization).

get_front()[source]#

Get Pareto front.

Returns:

get_traj(i)[source]#

Get trajectory profile.

Parameters:

i (int) – Index of trajectory.

Returns:

plot_front()[source]#

Display Pareto front.

Return type:

None

plot_traj(i)[source]#

Display trajectory profile.

Parameters:

i (int) – Index of trajectory.

Return type:

None

smart_cruise.smart_cruise.W0 = 26000.0#

Default weight budget.