更改

跳到导航 跳到搜索
添加1字节 、 2020年9月12日 (六) 09:04
第305行: 第305行:  
Assuming the execution time follows power rule, , the coefficient a can be found  by taking empirical measurements of run time <math>\{t_1, t_2\}</math> at some problem-size points <math>\{n_1, n_2\}</math>, and calculating <math>t_2/t_1 = (n_2/n_1)^a</math> so that <math>a = \log(t_2/t_1) / \log(n_2/n_1)</math>. In other words, this measures the slope of the empirical line on the log–log plot of execution time vs. problem size, at some size point. If the order of growth indeed follows the power rule (and so the line on log–log plot is indeed a straight line), the empirical value of a will  stay constant at different ranges, and if not, it will change (and the line is a curved line) - but still could serve for comparison of any two given algorithms as to their empirical local orders of growth behaviour. Applied to the above table:
 
Assuming the execution time follows power rule, , the coefficient a can be found  by taking empirical measurements of run time <math>\{t_1, t_2\}</math> at some problem-size points <math>\{n_1, n_2\}</math>, and calculating <math>t_2/t_1 = (n_2/n_1)^a</math> so that <math>a = \log(t_2/t_1) / \log(n_2/n_1)</math>. In other words, this measures the slope of the empirical line on the log–log plot of execution time vs. problem size, at some size point. If the order of growth indeed follows the power rule (and so the line on log–log plot is indeed a straight line), the empirical value of a will  stay constant at different ranges, and if not, it will change (and the line is a curved line) - but still could serve for comparison of any two given algorithms as to their empirical local orders of growth behaviour. Applied to the above table:
   −
假设执行时间服从幂规则,系数 a 可以通过对运行时数学 t1,t2 / math 在某些问题大小点上的数学 n1,n2 / math 进行经验测量,然后计算数学 t2 / t1(n2 / n1) ^ a / math,从而得到数学 a / log (t2 / t1) / log (n2 / n1) / math。换句话说,在某个尺寸点上,这可以度量执行时间与问题大小的对数-对数图上经验曲线的斜率。如果增长的次序确实遵循幂次规则(因此对数曲线确实是一条直线) ,那么 a 的经验值将在不同的范围内保持不变,如果不是,它将发生变化(而且这条直线是一条曲线)——但仍然可以用于比较任何两个给定算法的经验局部增长行为次序。应用于上表:
+
假设执行时间遵循幂律,通过对一些问题规模点<math>\{n_1, n_2\}</math>的运行时间<math>\{t_1, t_2\}</math>进行经验测量,并计算出𝑡<math>t_2/t_1 = (n_2/n_1)^a</math>,从而得到系数<math>a = \log(t_2/t_1) / \log(n_2/n_1)</math>。
 
+
换言之,这衡量了在某个规模点上,执行时间与问题大小的双对数曲线 log-log plot上经验线的斜率。如果增长顺序确实遵循幂律(因此双对数曲线图上的直线确实是一条直线),那么a的经验值将在不同的范围内将保持不变,如果不是,它将发生改变(而且这条线是一条曲线),但仍然可以用来比较任何两种给定算法的经验局部增长顺序。应用于上表:
 
      
{| class="wikitable"
 
{| class="wikitable"
第438行: 第437行:     
可以清楚地看到,第一个算法展示了一个线性增长序列,确实遵循幂规则。第二个经验值正在迅速递减,这表明它遵循了另一条增长规律,而且无论如何,从经验上看,当地的增长订单(以及进一步的增长)远低于第一个。
 
可以清楚地看到,第一个算法展示了一个线性增长序列,确实遵循幂规则。第二个经验值正在迅速递减,这表明它遵循了另一条增长规律,而且无论如何,从经验上看,当地的增长订单(以及进一步的增长)远低于第一个。
  −
      
=== 运行时复杂性度量 Evaluating run-time complexity ===
 
=== 运行时复杂性度量 Evaluating run-time complexity ===
463

个编辑

导航菜单