behavior planning——13. implement a cost function in C++
In the previous quizzes, you designed a cost function to choose a lane when trying to reach a goal in highway driving:
Here, Δ was the lateral distance between the goal lane and the final chosen lane, and Δ was the longitudinal distance from the vehicle to the goal.
In this quiz, we'd like you to implement the cost function in C++, but with one important change. The finite state machine we use for vehicle behavior also includes states for planning a lane change right or left (PLCR or PLCL), and the cost function should incorporate this information. We will provide the following four inputs to the function:
- Intended lane: the intended lane for the given behavior. For PLCR, PLCL, LCR, and LCL, this would be the one lane over from the current lane.
- Final lane: the immediate resulting lane of the given behavior. For LCR and LCL, this would be one lane over.
- The Δs distance to the goal.
- The goal lane.
Your task in the implementation will be to modify Δd in the equation above so that it satisifes:
- Δd is smaller as both intended lane and final lane are closer to the goal lane.
- The cost function provides different costs for each possible behavior: KL, PLCR/PLCL, LCR/LCL.
- The values produced by the cost function are in the range 0 to 1.
You can implement your solution in cost.cpp
below.
cost.cpp
- float goal_distance_cost(int goal_lane, int intended_lane, int final_lane, float distance_to_goal) {
- /*
- The cost increases with both the distance of intended lane from the goal
- and the distance of the final lane from the goal. The cost of being out of the
- goal lane also becomes larger as vehicle approaches the goal.
- */
- int delta_d = 2.0*goal_lane - intended_lane - final_lane;
- float cost = - exp(-(abs(delta_d) / distance_to_goal));
- return cost;
- }
behavior planning——13. implement a cost function in C++的更多相关文章
- behavior planning——14.implement a cost function in C++
n most situations, a single cost function will not be sufficient to produce complex vehicle behavior ...
- behavior planning——11 create a cost function speed penalty
A key part of getting transitions to happen when we want them to is the design of reasonable cost ...
- behavior planning——15.cost function design weightTweaking
Designing cost functions is difficult and getting them all to cooperate to produce reasionable vehic ...
- behavior planning——12.example cost funtion -lane change penalty
In the image above, the blue self driving car (bottom left) is trying to get to the goal (gold sta ...
- machine learning(11) -- classification: advanced optimization 去求cost function最小值的方法
其它的比gradient descent快, 在某些场合得到广泛应用的求cost function的最小值的方法 when have a large machine learning problem, ...
- behavior planning——10 behaior planning pseudocode
One way to implement a transition function is by generating rough trajectories for each accessible & ...
- loss function与cost function
实际上,代价函数(cost function)和损失函数(loss function 亦称为 error function)是同义的.它们都是事先定义一个假设函数(hypothesis),通过训练集由 ...
- 【caffe】loss function、cost function和error
@tags: caffe 机器学习 在机器学习(暂时限定有监督学习)中,常见的算法大都可以划分为两个部分来理解它 一个是它的Hypothesis function,也就是你用一个函数f,来拟合任意一个 ...
- 逻辑回归损失函数(cost function)
逻辑回归模型预估的是样本属于某个分类的概率,其损失函数(Cost Function)可以像线型回归那样,以均方差来表示:也可以用对数.概率等方法.损失函数本质上是衡量”模型预估值“到“实际值”的距离, ...
随机推荐
- POJ 3628 Bookshelf 2【背包型DFS/选or不选】
Bookshelf 2 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11105 Accepted: 4928 Desc ...
- 问题解决:在js中绑定onclick事件为什么不加括号,在html代码中必须要加?(转载)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 对于MD5加密处理方式
来源:http://blog.51cto.com/xqtesting/1924977 但有时候我们请求的参数可能需要加密,比如登录接口中的密码可能需要经过md5加密这时候怎么处理呢? 这种方法比较简单 ...
- Winform实现调用asp.net数据接口实例
本文实例讲述了Winform实现调用asp.net数据接口的方法,分享给大家供大家参考.具体实现方法如下: 一.问题: 最近一个WPF项目需要改写成android项目,思路是在asp.net项目中编写 ...
- MyEclipse编写ExtJS卡死问题解决方法
MyEclipse 8.6 在 jsp 中编写 ExtJS时,会出现卡死现象,让人甚是头疼.网上找了很多方法,折腾半天,还是不管用. 什么MyEclipse 优化,Validation 取消,MyE ...
- django的admin后台管理
Admin后台管理 要进入admin后台管理首先要创建管理员账户 createsuperuser 其中密码要大于8位 使用之前要到应用下的admin.py中注册要管理的模型表 from django. ...
- vue移动端项目
用vue mint-ui jquery-weui写了一个移动端demo 技术栈 vue2.0 vue-router axios mint-ui jquery-weui webpack 页面截图 最后 ...
- golang中特殊的标识符
你会发现在 Go 代码中的几乎所有东西都有一个名称或标识符.另外,Go 语言也是区分大小写的,这与 C 家族中的其它语言相同.有效的标识符必须以字符(可以使用任何 UTF-8 编码的字符或 _)开头, ...
- 春蔚专访--MaxCompute 与 Calcite 的技术和故事
摘要:2019大数据技术公开课第一季<技术人生专访>,来自阿里云计算平台事业部高级开发工程师雷春蔚向大家讲述了MaxCompute 与 Calcite 的技术和故事. 具体内容包括: 1) ...
- JavaScript-- 函数既是函数又是对象
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...