Estimate ranges in column view

* lisp/org-colview-xemacs.el (org-columns-compile-map):
(org-columns-number-to-string):
(org-columns-string-to-number): Handle estimate ranges.
(org-estimate-mean-and-var):  New function.
(org-estimate-combine):  New function.
(org-estimate-print):  New function.
(org-string-to-estimate): New function.
This commit is contained in:
Carsten Dominik 2010-07-19 13:56:17 +02:00
parent 55ea8ca071
commit 899e89518b
3 changed files with 28 additions and 31 deletions

View File

@ -4766,21 +4766,21 @@ Be aware that you can only have one summary type for any property you
include. Subsequent columns referencing the same property will all display the include. Subsequent columns referencing the same property will all display the
same summary information. same summary information.
The 'est+' summary type requires further explanation. It is used for The @code{est+} summary type requires further explanation. It is used for
combining task estimates, expressed as low-high ranges. For example, instead combining estimates, expressed as low-high ranges. For example, instead
of estimating a particular task will take 5 days, you might estimate it as of estimating a particular task will take 5 days, you might estimate it as
5-6 days if you're fairly confident you know how much woark is required, or 5-6 days if you're fairly confident you know how much woark is required, or
1-10 days if you don't really know what needs to be done. Both ranges 1-10 days if you don't really know what needs to be done. Both ranges
average at 5.5 days, but the first represents a more predictable delivery. average at 5.5 days, but the first represents a more predictable delivery.
When combining a set of such estimates, simply adding the lows and highs When combining a set of such estimates, simply adding the lows and highs
produces an unrealistically wide result. Instead, 'est+' adds the statistical produces an unrealistically wide result. Instead, @code{est+} adds the
mean and variance of the sub-tasks, generating a final estimate from the sum. statistical mean and variance of the sub-tasks, generating a final estimate
For example, suppose you had ten tasks, each of which was estimated at 0.5 to from the sum. For example, suppose you had ten tasks, each of which was
2 days of work. Straight addition produces an estimate of 5 to 20 days, estimated at 0.5 to 2 days of work. Straight addition produces an estimate
representing what to expect if everything goes either extremely well or of 5 to 20 days, representing what to expect if everything goes either
extremely poorly. In contrast, 'est+' estimates the full job more extremely well or extremely poorly. In contrast, @code{est+} estimates the
realistically, at 10-15 days. full job more realistically, at 10-15 days.
Here is an example for a complete columns definition, along with allowed Here is an example for a complete columns definition, along with allowed
values. values.

View File

@ -1700,8 +1700,7 @@ This will add overlays to the date lines, to show the summary for each day."
(high (float (cadr v))) (high (float (cadr v)))
(mean (/ (+ low high) 2.0)) (mean (/ (+ low high) 2.0))
(var (/ (+ (expt (- mean low) 2.0) (expt (- high mean) 2.0)) 2.0))) (var (/ (+ (expt (- mean low) 2.0) (expt (- high mean) 2.0)) 2.0)))
(list mean var) (list mean var)))
))
(defun org-estimate-combine (&rest el) (defun org-estimate-combine (&rest el)
"Combine a list of estimates, using mean and variance. "Combine a list of estimates, using mean and variance.
@ -1715,21 +1714,21 @@ and variances (respectively) of the individual estimates."
(setq var (+ var (cadr stats))))) (setq var (+ var (cadr stats)))))
el) el)
(let ((stdev (sqrt var))) (let ((stdev (sqrt var)))
(list (- mean stdev) (+ mean stdev))) (list (- mean stdev) (+ mean stdev)))))
))
(defun org-estimate-print (e &optional fmt) (defun org-estimate-print (e &optional fmt)
"Prepare a string representation of an estimate, as two numbers with a '-' in between them." "Prepare a string representation of an estimate.
This formats these numbers as two numbers with a \"-\" between them."
(if (null fmt) (set 'fmt "%.0f")) (if (null fmt) (set 'fmt "%.0f"))
(format "%s" (mapconcat (lambda (n) (format fmt n)) e "-"))) (format "%s" (mapconcat (lambda (n) (format fmt n)) e "-")))
(defun org-string-to-estimate (s) (defun org-string-to-estimate (s)
"Convert a string to an estimate. The string should be two numbers joined with a '-'." "Convert a string to an estimate.
The string should be two numbers joined with a \"-\"."
(if (string-match "\\(.*\\)-\\(.*\\)" s) (if (string-match "\\(.*\\)-\\(.*\\)" s)
(list (string-to-number (match-string 1 s)) (string-to-number(match-string 2 s))) (list (string-to-number (match-string 1 s))
(list (string-to-number s) (string-to-number s)) (string-to-number(match-string 2 s)))
)) (list (string-to-number s) (string-to-number s))))
(provide 'org-colview) (provide 'org-colview)
(provide 'org-colview-xemacs) (provide 'org-colview-xemacs)

View File

@ -1501,8 +1501,7 @@ This will add overlays to the date lines, to show the summary for each day."
(high (float (cadr v))) (high (float (cadr v)))
(mean (/ (+ low high) 2.0)) (mean (/ (+ low high) 2.0))
(var (/ (+ (expt (- mean low) 2.0) (expt (- high mean) 2.0)) 2.0))) (var (/ (+ (expt (- mean low) 2.0) (expt (- high mean) 2.0)) 2.0)))
(list mean var) (list mean var)))
))
(defun org-estimate-combine (&rest el) (defun org-estimate-combine (&rest el)
"Combine a list of estimates, using mean and variance. "Combine a list of estimates, using mean and variance.
@ -1516,22 +1515,21 @@ and variances (respectively) of the individual estimates."
(setq var (+ var (cadr stats))))) (setq var (+ var (cadr stats)))))
el) el)
(let ((stdev (sqrt var))) (let ((stdev (sqrt var)))
(list (- mean stdev) (+ mean stdev))) (list (- mean stdev) (+ mean stdev)))))
))
(defun org-estimate-print (e &optional fmt) (defun org-estimate-print (e &optional fmt)
"Prepare a string representation of an estimate, as two numbers with a '-' in between them." "Prepare a string representation of an estimate.
This formats these numbers as two numbers with a \"-\" between them."
(if (null fmt) (set 'fmt "%.0f")) (if (null fmt) (set 'fmt "%.0f"))
(format "%s" (mapconcat (lambda (n) (format fmt n)) e "-")) (format "%s" (mapconcat (lambda (n) (format fmt n)) e "-")))
)
(defun org-string-to-estimate (s) (defun org-string-to-estimate (s)
"Convert a string to an estimate. The string should be two numbers joined with a '-'." "Convert a string to an estimate.
The string should be two numbers joined with a \"-\"."
(if (string-match "\\(.*\\)-\\(.*\\)" s) (if (string-match "\\(.*\\)-\\(.*\\)" s)
(list (string-to-number (match-string 1 s)) (string-to-number(match-string 2 s))) (list (string-to-number (match-string 1 s))
(list (string-to-number s) (string-to-number s)) (string-to-number(match-string 2 s)))
)) (list (string-to-number s) (string-to-number s))))
(provide 'org-colview) (provide 'org-colview)