画家难题-估计 [英] Painter puzzle - estimation

查看:81
本文介绍了画家难题-估计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题是基于 Joel Spolsky的难题从2001年开始。



一个人找到了一份街头画家的工作,在路中间画了虚线。 在第一天,他完成了300码,在第二天完成了150码,在第三天则更少。老板很生气,要求解释。



我无能为力, 那家伙说。 每天我与油漆罐的距离越来越远!



我的问题是,你能估计他在油漆中覆盖的距离吗?第三天?



链接线程中的注释中的一个确实得出了精确的解决方案,但是我的问题是关于足够精确的估计(例如10%),这很容易

解决方案

这里有很多未知数-他的行走速度,绘画速度以及如何

但是显然这里有两个过程。一个是平方的-是在油漆罐和油漆点之间来回走动。另一个是线性的-这是绘画的过程本身。



考虑第10天甚至第100天,很明显线性分量可以忽略不计,并且过程几乎变成二次方-几乎所有时间都在步行。相反,在第一天的前几分钟,它接近线性。



因此,我们可以说时间 t 作为距离 s 的函数,遵循幂定律 t〜s ^ a ,变化系数 a = 1.0 .. 2.0 。这也意味着 s〜t ^ b,b = 1 / a



应用 增长分析的经验顺序



第1天到第2天之间的 b 系数近似为

  b (1,2)=对数(450/300)/对数2 = 0.585 a(1,2)= 1 / 0.585 = 1.71 

正如预期的那样,该系数低于2。对于第2天到第3天之间的时间段,我们可以将其大约设置为 1.71 2.0

  a(2,3)= 1.85 b(2,3)= 0.54 450 * (3/2)** 0.54 = 560码

因此,第三天的距离可以是估计为 560-450 = 110 码。



如果 a 系数具有最大可能值 2.0 阿迪(这是不可能的)?然后, 450 *(3/2)** 0.5 = 551 码。对于另一个极端,如果它是相同的 1.71 (显然也不是),则 450 *(3/2)** 0.585 = 570



这意味着110码的估计值是合理的,而两侧的误差均小于10码。


This problem is based on a puzzle by Joel Spolsky from 2001.

A guy "gets a job as a street painter, painting the dotted lines down the middle of the road." On the first day he finishes up 300 yards, on the second - 150, and on the 3rd even less so. The boss is furious and demands an explanation.

"I can't help it," says the guy. "Every day I get farther and farther away from the paint can!"

My question is, can you estimate the distance he covered in the 3rd day?

One of the comments in the linked thread does derive a precise solution, but my question is about a precise enough estimation - say, 10% - that is easy to make from the general principles.

解决方案

There are a lot of unknowns here - his walking speed, his painting speed, for how long does the paint in the brush last...

But clearly there are two processes going on here. One is quadratic - it's the walking to and fro between the paint can and the painting point. The other is linear - it's the process of painting, itself.

Thinking about the 10th or even the 100th day, it is clear that the linear component becomes negligible, and the process becomes very nearly quadratic - the walking takes almost all the time. During the first few minutes of the first day, on the contrary, it is close to being linear.

We can thus say that the time t as a function of the distance s follows a power law t ~ s^a with a changing coefficient a = 1.0 ... 2.0. This also means that s ~ t^b, b = 1/a.

Applying the empirical orders of growth analysis:

The b coefficient between day 1 and day 2 is approximated as

b(1,2) = log (450/300) / log 2 = 0.585        a(1,2) = 1/0.585 = 1.71

Just as expected, the coefficient is below 2. Going for the time period between day 2 and day 3, we can set it approximately to the middle value between 1.71 and 2.0,

a(2,3) = 1.85        b(2,3) = 0.54          450*(3/2)**0.54 = 560 yards

Thus the distance covered in the third day can be estimated as 560 - 450 = 110 yards.

What if the a coefficient had the maximum possible value, 2.0, already (which is impossible)? Then, 450*(3/2)**0.5 = 551 yards. And for the other extreme, if it were the same 1.71 (which it clearly can't be, either), 450*(3/2)**0.585 = 570.

This means that the estimate of 110 yards is plausible, with an error of less than 10 yards on either side.

这篇关于画家难题-估计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆