yapf/yapf_base.hpp
changeset 4563 f25cb91c5f14
parent 4549 60410aa1aa88
child 5083 6da97b6fbbd6
equal deleted inserted replaced
4562:b22bb637406f 4563:f25cb91c5f14
    74 public:
    74 public:
    75 	/// default constructor
    75 	/// default constructor
    76 	FORCEINLINE CYapfBaseT()
    76 	FORCEINLINE CYapfBaseT()
    77 		: m_pBestDestNode(NULL)
    77 		: m_pBestDestNode(NULL)
    78 		, m_pBestIntermediateNode(NULL)
    78 		, m_pBestIntermediateNode(NULL)
    79 #if defined(UNITTEST)
       
    80 		, m_settings(NULL)
       
    81 		, m_max_search_nodes(100000)
       
    82 #else
       
    83 		, m_settings(&_patches.yapf)
    79 		, m_settings(&_patches.yapf)
    84 		, m_max_search_nodes(PfGetSettings().max_search_nodes)
    80 		, m_max_search_nodes(PfGetSettings().max_search_nodes)
    85 #endif
       
    86 		, m_veh(NULL)
    81 		, m_veh(NULL)
    87 		, m_stats_cost_calcs(0)
    82 		, m_stats_cost_calcs(0)
    88 		, m_stats_cache_hits(0)
    83 		, m_stats_cache_hits(0)
    89 		, m_num_steps(0)
    84 		, m_num_steps(0)
    90 	{
    85 	{
   149 		_total_pf_time_us += t;
   144 		_total_pf_time_us += t;
   150 		char ttc = Yapf().TransportTypeChar();
   145 		char ttc = Yapf().TransportTypeChar();
   151 		float cache_hit_ratio = (float)m_stats_cache_hits / (float)(m_stats_cache_hits + m_stats_cost_calcs) * 100.0f;
   146 		float cache_hit_ratio = (float)m_stats_cache_hits / (float)(m_stats_cache_hits + m_stats_cost_calcs) * 100.0f;
   152 		int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
   147 		int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
   153 		int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
   148 		int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
   154 #ifdef UNITTEST
       
   155 		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));
       
   156 #else
       
   157 		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));
   149 		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));
   158 #endif
       
   159 		return bDestFound;
   150 		return bDestFound;
   160 	}
   151 	}
   161 
   152 
   162 	/** If path was found return the best node that has reached the destination. Otherwise
   153 	/** If path was found return the best node that has reached the destination. Otherwise
   163 	 *  return the best visited node (which was nearest to the destination).
   154 	 *  return the best visited node (which was nearest to the destination).