简 介: 本文给出了第十七届全国大学生智能车竞赛信标比赛路径设计。路径参数: 亮灯个数为18盏灯; 路径难易程度定位 5975 ~ 5990;待选的路径总共6888条,本文给出了其中50条路径的。
关键词
: 智能车竞赛,信标组,路径
§01 信标路径
在 第十七届全国大学生智能车竞赛 中的信标组比赛中,要求每次发车都使用不同的路径。下面给出了 十七届智能车竞赛线上赛道设计 中关于信标组赛道规格,在此基础上,设计出八条信标比赛路径。
▲ 图1.1 平衡信标组比赛场地
一、比赛路径设计
下图给出了信标组中四个信标以及发车区的位置坐标。
▲ 图1.1.1 信标组中的信标与发车区的坐标位置
1、搜索所有可能路径
设计一条合理的比赛路径,遵循以下几条原则:
- 从给定的区域出发,到指定的信标灯结束,比如从发车区出发,到 4号灯结束;
- 给定亮灯的个数,比如12个;
- 去除路径中相连比较近的灯序,比如 1-2, 2-3;
下面是通过程序获得的从发车区出发,到 4号灯结束,点亮5个信标灯的所有的25条灯序。
[-1, 1, 3, 1, 3, 4]
[-1, 1, 3, 4, 1, 4]
[-1, 1, 3, 4, 2, 4]
[-1, 1, 3, 4, 3, 4]
[-1, 1, 4, 1, 3, 4]
[-1, 1, 4, 3, 1, 4]
[-1, 2, 4, 1, 3, 4]
[-1, 2, 4, 3, 1, 4]
[-1, 3, 1, 3, 1, 4]
[-1, 3, 1, 4, 1, 4]
[-1, 3, 1, 4, 2, 4]
[-1, 3, 1, 4, 3, 4]
[-1, 3, 4, 1, 3, 4]
[-1, 3, 4, 3, 1, 4]
[-1, 4, 1, 3, 1, 4]
[-1, 4, 1, 4, 1, 4]
[-1, 4, 1, 4, 2, 4]
[-1, 4, 1, 4, 3, 4]
[-1, 4, 2, 4, 1, 4]
[-1, 4, 2, 4, 2, 4]
[-1, 4, 2, 4, 3, 4]
[-1, 4, 3, 1, 3, 4]
[-1, 4, 3, 4, 1, 4]
[-1, 4, 3, 4, 2, 4]
[-1, 4, 3, 4, 3, 4]
随着点亮灯的个数增加,灯序的总数呈现指数增加趋势。下面表格给出了灯序长度与个数的关系。
亮灯个数 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
灯序总数 | 25 | 59 | 121 | 273 | 577 | 1275 | 2733 | 5981 | 12905 | 28115 | 60849 | 132289 | 286721 | 622739 | 1350613 | 2932109 |
2、度量路径难易程度
在所有可能路径中,车模运行的难易程度主要由两个因素决定:
- 路径的长度(L):它决定了车模运行时间和信标定位的难易程度;
- 车模转向角度(A):它影响了车模转向时间以及对信标搜索的难易程度;
- 平均点亮次数(N):要求每个灯点亮次数不少于N个,比如对于点亮18次等,要求每个灯点亮的次数不少于3次。
综合以上因素,将路径中的长度(单位:厘米)和角度(单位 度)以 4:1 的比例加权在一起,即路径的难易程度(H)表示为: H = L + 0.25 A H = L + 0.25A H=L+0.25A
下图是对 622739 个 18盏灯的难易程度进行统计的直方图。可以看到其中存在着大量的低分值的路径,还有一些路径的难易程度在 5000 以上。
▲ 点亮18盏的得分统计
得分平均值为6506, 标准方差为:251。
为了增加路径的随机性,将路径得分在5975 至 5990 之间的 2422 条路径挑选出来作为比赛路径候选者。它们的得分分布如下:
▲ 赛道难度在5975至5990之间的分布
这些路径中前 50 个路径如下所示:
[1 3 1 3 1 3 1 3 1 3 1 4 3 4 1 4 2 4]
[1 3 1 3 1 3 1 4 1 3 1 3 1 4 1 4 3 4]
[1 3 1 3 1 3 4 2 4 1 4 3 1 3 1 3 1 4]
[1 3 1 3 1 4 3 4 3 1 3 1 3 4 1 3 1 4]
[1 3 1 3 4 3 1 3 1 3 4 1 4 3 1 3 1 4]
[1 3 1 4 3 4 1 4 1 3 1 3 1 3 1 3 1 4]
[1 3 4 2 4 1 3 1 3 1 3 1 3 1 3 4 1 4]
[1 4 1 3 1 3 1 3 1 4 3 1 3 1 3 4 2 4]
[1 4 3 1 3 1 3 1 3 4 1 4 1 3 1 3 1 4]
[1 4 3 1 4 1 4 1 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4 2 4 3 1 4 1 3 1 3 4]
[4 1 3 1 3 4 3 4 1 3 1 3 1 3 1 4 2 4]
[4 1 3 4 3 1 3 4 3 1 3 1 3 1 4 1 3 4]
[4 1 4 2 4 3 1 3 1 3 1 3 1 3 4 3 1 4]
[4 2 4 1 3 4 3 1 3 1 3 1 3 1 4 1 3 4]
[4 2 4 3 1 3 1 4 1 3 1 3 4 3 1 3 1 4]
[4 3 1 3 1 3 1 3 4 1 3 4 3 1 3 4 1 4]
[4 3 1 3 1 3 4 1 3 4 3 1 3 1 3 4 1 4]
[4 3 1 3 1 4 3 4 3 1 3 1 3 1 4 3 1 4]
[4 3 1 3 4 3 1 4 3 4 1 3 1 3 1 3 1 4]
[4 3 4 1 3 1 3 1 3 1 3 4 1 3 4 3 1 4]
[4 3 4 1 3 1 4 3 1 3 4 1 3 1 3 1 3 4]
[4 3 4 3 1 3 1 3 4 1 3 1 3 1 4 3 1 4]
※ 总 结 ※
本文给出了第十七届全国大学生智能车竞赛信标比赛路径设计。路径参数:
- 亮灯个数为18盏灯;
- 路径难易程度定位 5975 ~ 5990;
待选的路径总共2422条,本文给出了其中50条路径的。
补充说明
为了更好地利用每一个信标灯,需要在已有的18盏亮灯可行性路径中选择出每个灯亮灯次数不少于3个的路径。将上面622739个路径,挑选出满足要求的灯序,最终可以得到 72954满足要求的路径。
from headm import *
r = tspload('route18', 'r')
printf(len(r))
printf(shape(r))
rleft = []
n = 3
for id,rr in enumerate(r):
if id % 10000 == 0: printf(id)
lrr = list(rr)
if lrr.count(1) < n: continue
if lrr.count(2) < n: continue
if lrr.count(3) < n: continue
if lrr.count(4) < n: continue
rleft.append(rr)
printf(len(rleft))
tspsave('ragular', rleft =rleft)
▲ 满足要求得分分布
from headm import *
rleft, rscore = tspload('left', 'rleft', 'rscore')
c = where((rscore > 6670) & (rscore < 6680))
r = rleft[c[0],:]
rs = rscore[c[0]]
printf(len(r))
for rrr in r[::30]:
printf(rrr)
plt.hist(rs, 100)
plt.xlabel("score")
plt.ylabel("frequency")
plt.grid(True)
plt.tight_layout()
plt.show()
▲ 路径分布
给出的合理路径如下,它满足所有路径中,每个灯点亮的次数不少于3次, 难易程度在: 6670 ~ 6680 之间。
[-1 1 3 1 3 1 4 2 4 2 4 3 4 2 4 3 4 3 4]
[-1 1 3 1 3 4 3 4 2 4 2 4 1 3 4 3 4 2 4]
[-1 1 3 4 2 4 3 4 2 4 2 4 1 3 1 3 4 3 4]
[-1 1 4 2 4 3 1 4 2 4 3 1 4 3 4 1 4 2 4]
[-1 2 4 1 3 4 1 3 4 1 4 1 4 2 4 3 4 2 4]
[-1 2 4 1 3 4 1 4 2 4 2 4 1 3 4 2 4 3 4]
[-1 2 4 1 3 4 2 4 1 4 1 4 2 4 3 4 1 3 4]
[-1 2 4 1 3 4 2 4 3 1 4 2 4 1 4 1 4 3 4]
[-1 2 4 1 3 4 3 1 4 3 4 1 4 2 4 2 4 2 4]
[-1 2 4 1 4 1 3 4 1 4 2 4 3 4 2 4 1 3 4]
[-1 2 4 1 4 1 4 2 4 3 4 1 3 4 2 4 3 1 4]
[-1 2 4 1 4 2 4 1 3 4 2 4 3 4 2 4 3 1 4]
[-1 2 4 1 4 2 4 2 4 1 3 4 3 1 4 3 4 1 4]
[-1 2 4 1 4 2 4 3 1 4 2 4 3 4 3 1 4 3 4]
[-1 2 4 1 4 2 4 3 4 3 1 4 3 1 4 2 4 3 4]
[-1 2 4 1 4 3 1 4 3 4 3 1 4 1 4 2 4 2 4]
[-1 2 4 1 4 3 4 3 1 4 2 4 1 4 1 3 4 2 4]
[-1 2 4 2 4 1 3 4 1 4 2 4 3 4 2 4 3 1 4]
[-1 2 4 2 4 1 3 4 3 4 2 4 1 4 3 1 4 2 4]
[-1 2 4 2 4 1 4 2 4 2 4 3 4 1 3 4 1 3 4]
[-1 2 4 2 4 1 4 3 1 4 3 4 3 1 4 1 4 2 4]
[-1 2 4 2 4 2 4 1 4 3 1 4 2 4 3 4 1 3 4]
[-1 2 4 2 4 3 1 4 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]
[2 4 2 4 2 4 3 1 3 1 3 4 1 3 1 4 2 4]
[2 4 2 4 2 4 3 1 3 4 1 3 1 3 1 4 2 4]
[2 4 2 4 3 1 3 1 3 1 4 2 4 1 3 4 2 4]
[2 4 2 4 3 1 3 1 3 4 1 3 1 4 2 4 2 4]
[2 4 2 4 3 1 3 1 4 2 4 2 4 3 1 3 1 4]
[2 4 2 4 3 1 3 4 2 4 2 4 1 3 1 3 1 4]
[2 4 2 4 3 1 4 3 1 3 1 3 1 4 2 4 2 4]
[2 4 3 1 3 1 3 1 4 2 4 2 4 3 1 4 2 4]
[2 4 3 1 3 1 3 4 2 4 2 4 1 3 1 4 2 4]
[2 4 3 1 3 1 4 2 4 2 4 2 4 3 1 3 1 4]
[2 4 3 1 3 4 2 4 1 3 1 3 1 4 2 4 2 4]
[2 4 3 1 4 2 4 2 4 2 4 1 3 1 3 1 3 4]
[3 1 3 1 3 1 3 4 1 4 2 4 2 4 2 4 2 4]
[3 1 3 1 3 1 4 1 3 4 2 4 2 4 2 4 2 4]
[3 4 1 3 1 3 1 3 1 4 2 4 2 4 2 4 2 4]
[4 1 3 1 3 1 3 1 3 4 2 4 2 4 2 4 2 4]
[4 2 4 2 4 2 4 2 4 3 1 3 1 3 1 3 1 4]
一、处理程序
1、路径生成与得分计算
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# TEST1.PY -- by Dr. ZhuoQing 2022-07-19
#
# Note:
#============================================================
from headm import *
import math
#------------------------------------------------------------
posdim = [(100,325), (75, 200), (75,75), (425,200)]
start1 = (250, 22.5)
def routearg(r, s):
global posdim
lenall = 0
angleall = 0
lastangle = 0
lastr = s
for id,rr in enumerate(r):
rrr = posdim[rr-1]
deltax = rrr[0] - lastr[0]
deltay = rrr[1] - lastr[1]
lenall += sqrt(deltax**2 + deltay**2)
angle = math.atan2(deltay, deltax)
lastr = rrr
if id > 0:
deltaangle = angle - lastangle
while deltaangle < -pi:
deltaangle += pi
while deltaangle > pi:
deltaangle -= pi
angleall += abs(deltaangle)
lastangle = angle
return lenall + angleall * 180/pi/4
#------------------------------------------------------------
'''
r = tspload('route18', 'r')
rscore = []
for id,rr in enumerate(r):
rscore.append(routearg(rr[1:], start1))
if id % 10000 == 0:
printf(id)
tspsave('score', rscore=rscore)
'''
#------------------------------------------------------------
rscore = tspload('score', 'rscore')
plt.hist(rscore, 100)
plt.xlabel("路径难易")
plt.ylabel("出现频次")
plt.grid(True)
plt.tight_layout()
plt.show()
exit()
#------------------------------------------------------------
def routerandall(r, endp, num):
global routeall
# printff(r, endp, num)
if len(r) >= num - 1:
rc = r.copy()
rc.append(endp)
routeall.append(rc)
return
rr = list(range(1,5))
if r[-1] in rr:
rr.remove(r[-1])
if r[-1] == 1:
if 2 in rr: rr.remove(2)
if r[-1] == 2:
if 1 in rr: rr.remove(1)
if 3 in rr: rr.remove(3)
if r[-1] == 3:
if 2 in rr: rr.remove(2)
if len(r) >= num - 2:
if endp in rr:
rr.remove(endp)
for rrr in rr:
rc = r.copy()
rc.append(rrr)
routerandall(rc, endp, num)
#------------------------------------------------------------
routeall = []
r = [-1]
routerandall(r, 4, 19)
tspsave('route18', r = routeall)
#------------------------------------------------------------
printf(len(routeall))
#for r in routeall:
# printf(r)
#------------------------------------------------------------
# END OF FILE : TEST1.PY
#============================================================
2、路径统计
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# TEST2.PY -- by Dr. ZhuoQing 2022-07-19
#
# Note:
#============================================================
from headm import *
r = tspload('route18', 'r')
rscore = tspload('score', 'rscore')
printf(shape(r))
printf(mean(rscore), std(rscore))
c = where((rscore > 5975) & (rscore < 5990))
rhigh = rscore[c]
route = r[c[0],1:]
printf(len(route), len(route))
printf(shape(route))
#------------------------------------------------------------
rsel = route[::50][:50]
for rr in rsel:
printf(rr)
#------------------------------------------------------------
#for r in route:
# printf(r)
#------------------------------------------------------------
printf(mean(rhigh), std(rhigh))
plt.hist(rhigh, 500)
plt.xlabel("路径难易")
plt.ylabel("出现频次")
plt.grid(True)
plt.tight_layout()
plt.show()
#------------------------------------------------------------
# END OF FILE : TEST2.PY
#============================================================
■ 相关文献链接:
● 相关图表链接: