| | |
| | | |
| | | private final RedisSupport redis = RedisSupport.defaultRedisSupport; |
| | | |
| | | public static final boolean OPEN_TURN_COST_WEIGHT = Boolean.FALSE; |
| | | public static final boolean OPEN_TURN_COST_WEIGHT = Boolean.TRUE; |
| | | |
| | | public static final int WEIGHT_CALC_FACTOR = 1; |
| | | |
| | |
| | | if (!vehicle.equals(DynamicNodeType.ACCESS.val)) { |
| | | if (!vehicle.equals(agvNo)) { |
| | | |
| | | // 如果存在车辆,则增加权重 2 或者 3,因为拐点会增加权重 1 |
| | | // vehicle已经为当前segment做过了避让,且避让任务已完成,则权重值增加 |
| | | if (null != segment) { |
| | | if (!Cools.isEmpty(jamService.getJamFromSegmentByAvo(segment, vehicle))) { |
| | | weight += WEIGHT_CALC_FACTOR; |
| | | weight += (WEIGHT_CALC_FACTOR * 3); |
| | | } else { |
| | | weight += (WEIGHT_CALC_FACTOR * 2); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // G + H + T (对启发函数增加去拐点方案calcNodeTurnCost) |
| | | int gCost = calcNodeCost(currentNode, node) * (OPEN_TURN_COST_WEIGHT ? calcNodeTurnCost(currentNode, node, end) : 1); |
| | | int gCost = calcNodeCost(currentNode, node); |
| | | |
| | | if (OPEN_TURN_COST_WEIGHT) { |
| | | gCost += calcNodeTurnCost(currentNode, node, end); |
| | | } |
| | | |
| | | //进行计算对 G, F, H 等值 |
| | | node.setWeight(weight); |
| | |
| | | || nextNode.getX() == currNode.getParent().getX() |
| | | || nextNode.getY() == currNode.getParent().getY() |
| | | ) { |
| | | return 1; |
| | | return 0; |
| | | } |
| | | |
| | | // 拐向终点的点 |
| | | if (nextNode.getX() == endNode.getX() || nextNode.getY() == endNode.getY()) { |
| | | return 2; |
| | | return 1; |
| | | } |
| | | |
| | | // 普通拐点 |
| | | /* |
| | | 拐点判断逻辑 |
| | | 拿到父节点和下一节点 |
| | | 通过判断父节点和下一节点的x数据和y数据都不相同时,则表明当前坐标是一个拐点 |
| | | */ |
| | | return 3; |
| | | return 1; |
| | | } |
| | | |
| | | } |