|
@@ -133,49 +133,49 @@ public:
|
|
|
if (m_max_search_nodes == 0 || m_nodes.ClosedCount() < m_max_search_nodes) {
|
|
|
m_nodes.PopOpenNode(n.GetKey());
|
|
|
m_nodes.InsertClosedNode(n);
|
|
|
} else {
|
|
|
m_pBestDestNode = m_pBestIntermediateNode;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
bool bDestFound = (m_pBestDestNode != NULL);
|
|
|
|
|
|
int16 veh_idx = (m_veh != NULL) ? m_veh->unitnumber : 0;
|
|
|
|
|
|
// if (veh_idx != 433) return bDestFound;
|
|
|
|
|
|
perf.Stop();
|
|
|
int t = perf.Get(1000000);
|
|
|
_total_pf_time_us += t;
|
|
|
char ttc = Yapf().TransportTypeChar();
|
|
|
float cache_hit_ratio = (float)m_stats_cache_hits / (float)(m_stats_cache_hits + m_stats_cost_calcs) * 100.0f;
|
|
|
int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
|
|
|
int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
|
|
|
#ifdef UNITTEST
|
|
|
printf("%c%c%4d-%6d us -%5d rounds -%4d open -%5d closed - CHR %4.1f%% - c/d(%d, %d) - c%d(sc%d, ts%d, o%d) -- \n", bDestFound ? '-' : '!', ttc, veh_idx, t, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(), cache_hit_ratio, cost, dist, m_perf_cost.Get(1000000), m_perf_slope_cost.Get(1000000), m_perf_ts_cost.Get(1000000), m_perf_other_cost.Get(1000000));
|
|
|
#else
|
|
|
DEBUG(yapf, 1)("[YAPF][YAPF%c]%c%4d- %d us - %d rounds - %d open - %d closed - CHR %4.1f%% - c%d(sc%d, ts%d, o%d) -- ", ttc, bDestFound ? '-' : '!', veh_idx, t, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(), cache_hit_ratio, cost, dist, m_perf_cost.Get(1000000), m_perf_slope_cost.Get(1000000), m_perf_ts_cost.Get(1000000), m_perf_other_cost.Get(1000000));
|
|
|
DEBUG(yapf, 3)("[YAPF][YAPF%c]%c%4d- %d us - %d rounds - %d open - %d closed - CHR %4.1f%% - c%d(sc%d, ts%d, o%d) -- ", ttc, bDestFound ? '-' : '!', veh_idx, t, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(), cache_hit_ratio, cost, dist, m_perf_cost.Get(1000000), m_perf_slope_cost.Get(1000000), m_perf_ts_cost.Get(1000000), m_perf_other_cost.Get(1000000));
|
|
|
#endif
|
|
|
return bDestFound;
|
|
|
}
|
|
|
|
|
|
/** If path was found return the best node that has reached the destination. Otherwise
|
|
|
return the best visited node (which was nearest to the destination).
|
|
|
*/
|
|
|
FORCEINLINE Node& GetBestNode()
|
|
|
{
|
|
|
return (m_pBestDestNode != NULL) ? *m_pBestDestNode : *m_pBestIntermediateNode;
|
|
|
}
|
|
|
|
|
|
/** Calls NodeList::CreateNewNode() - allocates new node that can be filled and used
|
|
|
as argument for AddStartupNode() or AddNewNode()
|
|
|
*/
|
|
|
FORCEINLINE Node& CreateNewNode()
|
|
|
{
|
|
|
Node& node = *m_nodes.CreateNewNode();
|
|
|
return node;
|
|
|
}
|
|
|
|
|
|
/** Add new node (created by CreateNewNode and filled with data) into open list */
|
|
|
FORCEINLINE void AddStartupNode(Node& n)
|
|
|
{
|