Fossil SCM

Adding a simulation (www/collisions.ipynb) for checkin collisions over a working day, given parameters like number of checkins per day. This is in support of discussion on the forum centering on this post: https://fossil-scm.org/forum/forumpost/7349f4b6e1

wyoung 2019-06-16 17:58 trunk
Commit 950e54ef35f61b375ef26ce71800dc07f43305eb5da3f658c8556aae78365a65
1 file changed +68
--- a/www/collisions.ipynb
+++ b/www/collisions.ipynb
@@ -0,0 +1,68 @@
1
+{
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "Pull in the packages we needrce": [
8
+ "require(stats)"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "co1
13
+ "cell_type": "markdowoutputs": [],
14
+ "source": [
15
+ "require(stats)"
16
+ ]
17
+ },
18
+ {
19
+ "cell_type": "markdown",
20
+ "metadata": {},
21
+ "source": [
22
+ "# Parameters\n",
23
+ "\n",
24
+ "* **cpd** - Checkins per day. Defaults to 20.\n",
25
+ "\n",
26
+ "* **days** - Number of days to simulate. Defaults to 10000, or roughly\n",
27
+ " 40 working years.\n",
28
+ "\n",
29
+ "* **winSz** - Size of the commit window in percentage of the working day.\n",
30
+ " Defaults to 0.01% w, which is roughly 3 seconds for the default 8-hour work day, a\n",
31
+ " a long-ish commit time for Fossil.\n",
32
+ "\n",
33
+ "* **workSec** - Seconds in working day, defaulting to 8 hours. This value\n",
34
+ " only affects the reporting output, not the results of the underlying\n",
35
+ " simulation. It's a scaling parameter to humanize the results.\n",
36
+ " \n",
37
+ "* **spread** - Adjustment factor in computing the standard deviation for our \n",
38
+ " normally-distributed random numbers. The default gives \"nice\" distributions,\n",
39
+ " spread over the working day with a low chance of generating values outside\n",
40
+ " the working day.\n",
41
+ " \n",
42
+ " The smaller this value gets (<4), the more spread out the checkins, and\n",
43
+ " so the lower the chance of collisions. You might want to decrease it a bit\n",
44
+ " to simulate early and late workers.\n",
45
+ " \n",
46
+ " As you increase this value (>4) you're simulating a work environment\n",
47
+ " where people tend to check their work in closer and closer to mid-day,\n",
48
+ " which increases the chance of collision."
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "code",
53
+ "execution_count": 2,
54
+ "metadata": {},
55
+ "outputs": [],
56
+ "source": [
57
+ "collisions <- function(\n",
58
+ " cpd = 20,\n",
59
+ " days = 10000,\n",
60
+ " winSz = 0.01 / 100,\n",
61
+ " workSec = 8 * 60 * 60,\n",
62
+ " spread = 4)\n",
63
+ "{\n",
64
+ " cat(\"Running simulation...\\n\")\n",
65
+ "\n",
66
+ " day = 0\n",
67
+ " collisions = 0\n",
68
+ " winSec = workSec * w
--- a/www/collisions.ipynb
+++ b/www/collisions.ipynb
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/www/collisions.ipynb
+++ b/www/collisions.ipynb
@@ -0,0 +1,68 @@
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "Pull in the packages we needrce": [
8 "require(stats)"
9 ]
10 },
11 {
12 "cell_type": "co1
13 "cell_type": "markdowoutputs": [],
14 "source": [
15 "require(stats)"
16 ]
17 },
18 {
19 "cell_type": "markdown",
20 "metadata": {},
21 "source": [
22 "# Parameters\n",
23 "\n",
24 "* **cpd** - Checkins per day. Defaults to 20.\n",
25 "\n",
26 "* **days** - Number of days to simulate. Defaults to 10000, or roughly\n",
27 " 40 working years.\n",
28 "\n",
29 "* **winSz** - Size of the commit window in percentage of the working day.\n",
30 " Defaults to 0.01% w, which is roughly 3 seconds for the default 8-hour work day, a\n",
31 " a long-ish commit time for Fossil.\n",
32 "\n",
33 "* **workSec** - Seconds in working day, defaulting to 8 hours. This value\n",
34 " only affects the reporting output, not the results of the underlying\n",
35 " simulation. It's a scaling parameter to humanize the results.\n",
36 " \n",
37 "* **spread** - Adjustment factor in computing the standard deviation for our \n",
38 " normally-distributed random numbers. The default gives \"nice\" distributions,\n",
39 " spread over the working day with a low chance of generating values outside\n",
40 " the working day.\n",
41 " \n",
42 " The smaller this value gets (&lt;4), the more spread out the checkins, and\n",
43 " so the lower the chance of collisions. You might want to decrease it a bit\n",
44 " to simulate early and late workers.\n",
45 " \n",
46 " As you increase this value (&gt;4) you're simulating a work environment\n",
47 " where people tend to check their work in closer and closer to mid-day,\n",
48 " which increases the chance of collision."
49 ]
50 },
51 {
52 "cell_type": "code",
53 "execution_count": 2,
54 "metadata": {},
55 "outputs": [],
56 "source": [
57 "collisions <- function(\n",
58 " cpd = 20,\n",
59 " days = 10000,\n",
60 " winSz = 0.01 / 100,\n",
61 " workSec = 8 * 60 * 60,\n",
62 " spread = 4)\n",
63 "{\n",
64 " cat(\"Running simulation...\\n\")\n",
65 "\n",
66 " day = 0\n",
67 " collisions = 0\n",
68 " winSec = workSec * w

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button