Module costs

evaluation

This module implements cost functions of the Commonroad Benchmark. More details can be found here in the cost function documentation https://gitlab.lrz.de/tum-cps/commonroad-cost-functions/-/blob/master/costFunctions_commonRoad.pdf.

class PartialCostFunction(value)[source]

See https://gitlab.lrz.de/tum-cps/commonroad-cost-functions/-/blob/master/costFunctions_commonRoad.pdf for more details.

A: Acceleration, J: Jerk, Jlat: Lateral Jerk, Jlon: Longitudinal Jerk, SA: Steering Angle, SR: Steering Rate, Y: Yaw Rate, LC: Lane Center Offset, V: Velocity Offset, Vlon: Longitudinal Velocity Offset, O: Orientation Offset, D: Distance to Obstacles, L: Path Length, T: Time, ID: Inverse Duration,

A = 'A'
J = 'J'
Jlat = 'Jlat'
Jlon = 'Jlon'
SA = 'SA'
SR = 'SR'
Y = 'Y'
LC = 'LC'
V = 'V'
Vlon = 'Vlon'
O = 'O'
D = 'D'
L = 'L'
T = 'T'
ID = 'ID'
class CostFunctionEvaluator(cost_function_id: commonroad.common.solution.CostFunction, vehicle_type: commonroad.common.solution.VehicleType)[source]
classmethod init_from_solution(solution: commonroad.common.solution.Solution)[source]
property required_properties
evaluate_pp_solution(cr_scenario: commonroad.scenario.scenario.Scenario, cr_pproblem: commonroad.planning.planning_problem.PlanningProblem, trajectory: commonroad.scenario.trajectory.Trajectory, draw_lanelet_path=False, debug_plot=False)[source]

Computes costs of one solution for cr_pproblem.

Parameters
  • cr_scenario – scenario

  • cr_pproblem – planning problem that is solved by trajectory

  • trajectory – solution trajectory

  • draw_lanelet_path – optionally visualize the detected lanelet path with respect to whose some parameters for the cost computation are determined (only useful for development).

  • debug_plot – show plot in case a trajectory cannot be transformed to curvilinear coordinates.

Returns

result of evaluation

evaluate_solution(scenario: commonroad.scenario.scenario.Scenario, cr_pproblems: commonroad.planning.planning_problem.PlanningProblemSet, solution: commonroad.common.solution.Solution) commonroad_dc.costs.evaluation.SolutionResult[source]

Computes costs for all solutions of a planning problem set.

Parameters
  • scenario – scenario that was solved

  • cr_pproblems – planning problem set that was solved

  • solution – Solution object that contains trajectories

Returns

SolutionResult object that contains partial and total costs

class PlanningProblemCostResult(cost_function_id: commonroad.common.solution.CostFunction, solution_id: int)[source]
property total_costs: float
add_partial_costs(pcf: commonroad_dc.costs.evaluation.PartialCostFunction, cost: float, weight)[source]
class SolutionResult(benchmark_id: str, pp_results: List[commonroad_dc.costs.evaluation.PlanningProblemCostResult] = ())[source]
add_results(pp_result: commonroad_dc.costs.evaluation.PlanningProblemCostResult)[source]