-
Notifications
You must be signed in to change notification settings - Fork 2
エージェントの歩き方(まとめ版)
Itsuki Noda edited this page Jan 10, 2015
·
12 revisions
- AgentHandler#update(nodes,links,time)
- foreach(links): link.preUpdate()
- Agentの sort と lane への配分。
- foreach(agents): agent.preUpdate()
- next_link_candidate = null
- calc_speed()
- move_set(speed * direction, time, ?)
- STOP なら、speed = 0, next_position = position。return
- next_position =
- next_position_tmp = next_position
- while(next_position_tmp がリンクの範囲内)
- on_node = true
- navigate() [on_node で呼び出される navigate()]
- way_candidates = node_now からの道
- 例外処理
- target = sane_navigate(time, way_candidate)
- return sane_navigate_from_node(time, current_link, next_node)
- キャッシュ処理
- way_candidates = node からの道
- next_target = calcNextTarget(node)
- on_node でサブゴールなら、routePlan.shift()
- routePlan が空でないなら、routePlan.top()
- routePlan.top()がhintになければ、shift
- routePlanが空なら、return gaol
- way_candidates のなかで next_target タグを含むものがあるなら、 routePlanをshiftして、その way を返す。
- way_candidates からコスト最小を選んで返す。
- return sane_navigate_from_node(time, current_link, next_node)
- return target || ランダムな道
- next_link.registerEnter()
- on_node = false
- link = next_link
- node = next_node
- 移動に伴い next_position_tmp 修正。
- routePlan は元に戻す。
- foreach(links): link.update()
- foreach(agents): agent.update()
- goal にたどり着いていれば終わり。
- move_commit()
- position = next_position
- position がリンク外なら
- ノードがゴールなら終わり。
- 進むべき距離を求める。(distance_to_move)
- next_link_candidate = navigate(time, current_link, next_node) [off_node で呼び出される navigate()]
- way_candidates = node_now からの道
- 例外処理
- target = sane_navigate(time, way_candidate)
- return sane_navigate_from_node(time, current_link, next_node)
- キャッシュ処理
- way_candidates = node からの道
- next_target = calcNextTarget(node)
- on_node でサブゴールなら、routePlan.shift()
- routePlan が空でないなら、routePlan.top()
- routePlan.top()がhintになければ、shift
- routePlanが空なら、return gaol
- way_candidates のなかで next_target タグを含むものがあるなら、 routePlanをshiftして、その way を返す。
- way_candidates からコスト最小を選んで返す。
- return sane_navigate_from_node(time, current_link, next_node)
- return target || ランダムな道
- tryToPassNode(time)
- recordTrail(time)
- current_link.exit(agent)
- prev_node = next_node
- previous_link = current_link
- current_link = next_link_candidate
- calcNextTarget(next_node) [off_node で呼び出される calcNextTarget()]
- on_node でサブゴールなら、routePlan.shift()
- routePlan が空でないなら、routePlan.top()
- routePlan.top()がhintになければ、shift
- routePlanが空なら、return gaol
- next_node =
- position =
- direction =
- current_link.agentEnters()
- position=
- foreach(links): link.preUpdate()