precedence 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +118 -0
- data/README +41 -9
- data/TODO +10 -5
- data/lib/precedence/activity.rb +429 -80
- data/lib/precedence/network.rb +223 -88
- data/lib/precedence/utilities.rb +44 -0
- data/lib/precedence.rb +1 -0
- data/tests/tc_activity.rb +287 -45
- data/tests/tc_network.rb +277 -39
- data/tests/ts_precedence.rb +2 -0
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,5 +1,123 @@
|
|
1
|
+
= 0.8
|
2
|
+
|
3
|
+
* Added multiple durations. An activity has the following durations associated
|
4
|
+
activity = Precedence::Activity.new('activity1') do |act|
|
5
|
+
act.expected_duration = 2 # This is what would've been act.duration
|
6
|
+
act.minimum_duration = 1 # The minimum time the activity could need
|
7
|
+
act.maximum_duration = 4 # The maximum time the activity should need
|
8
|
+
end
|
9
|
+
|
10
|
+
From this the following may be determined:
|
11
|
+
activity.mean_duration
|
12
|
+
activity.standard_deviation
|
13
|
+
activity.variance
|
14
|
+
|
15
|
+
A Beta distribution is assumed to be used for the probability density function
|
16
|
+
and if certain assumptions are made the following hold
|
17
|
+
- The mean_duration is calculated as:
|
18
|
+
(4*expected_duration + minimum_duration + maximum_duration)/6
|
19
|
+
- The standard deviations is:
|
20
|
+
(maximum_duration - minimum_duration)/6
|
21
|
+
- The variance is the standard deviation squared.
|
22
|
+
|
23
|
+
The activity.duration attribute is still present and it is configurable to
|
24
|
+
allow the differing duration types. The duration to be used is set using the
|
25
|
+
Activity.duration_type attribute. For instance assuming we have the following
|
26
|
+
two activities set up:
|
27
|
+
act1 = Precedence::Activity.new('a1') do |activity|
|
28
|
+
activity.expected_duration = 2
|
29
|
+
activity.minimum_duration = 1
|
30
|
+
activity.maximum_duration = 3
|
31
|
+
end
|
32
|
+
act2 = Precedence::Activity.new('a2') do |activity|
|
33
|
+
activity.expected_duration = 3
|
34
|
+
activity.minimum_duration = 1
|
35
|
+
activity.maximum_duration = 5
|
36
|
+
end
|
37
|
+
act1.add_post_activities(act2)
|
38
|
+
# Duration type is initially set to the expected duration
|
39
|
+
act2.earliest_finish # => 5
|
40
|
+
# Change duration type to the maximum duration
|
41
|
+
act2.duration_type = Activity::MAXIMUM_DURATION
|
42
|
+
act2.earliest_finish # => 7
|
43
|
+
|
44
|
+
The allowed duration types are : EXPECTED_DURATION, MEAN_DURATION,
|
45
|
+
MINIMUM_DURATION and MAXIMUM_DURATION
|
46
|
+
|
47
|
+
* Moved the ActivityHash and ResourceHash into the Precedence::Utilities module.
|
48
|
+
|
49
|
+
* Added Activity.active_at?(time) which returns true if the activity is active at
|
50
|
+
time.
|
51
|
+
|
52
|
+
* Added Network.activities_at_time(time) which returns an array of activities
|
53
|
+
active at that time.
|
54
|
+
|
55
|
+
* Added Activity.active_during?(range) which returns true if the activity is active
|
56
|
+
during the time range given.
|
57
|
+
|
58
|
+
* Added Network.activities_during_time(range) which returns an array of activities
|
59
|
+
active during the range given.
|
60
|
+
|
61
|
+
* Added Network.each_time_period(tick,&block) which iterates over the duration
|
62
|
+
of the project in time steps of the tick parameter, yielding an array of
|
63
|
+
activities active at each time to the block.
|
64
|
+
|
65
|
+
* Removed the StartActivity and FinishActivity of the network from the
|
66
|
+
Network.activities hash. They are still avaialable in the hash if needed
|
67
|
+
precNetwork.activities['start']
|
68
|
+
precNetwork.activities['finish']
|
69
|
+
will return the StartActivity/FinishActivity however
|
70
|
+
precNetwork.activities.each
|
71
|
+
will not include them. I am still thinking of a way to get rid of them altogether.
|
72
|
+
|
73
|
+
* Added Network.reference_exists? which will return true if the reference is in the network.
|
74
|
+
|
75
|
+
|
76
|
+
= 0.7
|
77
|
+
* Added ability to load from and save networks to YAML files.
|
78
|
+
|
79
|
+
* Split StartFinishActivity into seperate StartActivity and FinishActivity
|
80
|
+
classes.
|
81
|
+
|
82
|
+
* Added StartActivity::REFERENCE and Network::START as well as
|
83
|
+
FinishActivity::REFERENCE and Network::FINISH as constants to hold the
|
84
|
+
reserved references for the start and finish activities in a network.
|
85
|
+
|
86
|
+
* Totally changed the way activities are created in both the Activity and
|
87
|
+
Network classes.
|
88
|
+
Activity.new(reference,duration,description,post_activities,pre_activities)
|
89
|
+
is now
|
90
|
+
Activity.new(reference) do |activity|
|
91
|
+
activity.duration = duration
|
92
|
+
activity.description = description
|
93
|
+
activity.add_post_activities(post_activities)
|
94
|
+
activity.add_pre_activities(pre_activities)
|
95
|
+
end
|
96
|
+
|
97
|
+
The same applies to the Network.new_activity method
|
98
|
+
Network.new_activity(reference,duration,description,post_activities,pre_activities)
|
99
|
+
has become
|
100
|
+
network.new_activity(reference) do |activity|
|
101
|
+
activity.duration = duration
|
102
|
+
activity.description = description
|
103
|
+
activity.add_pre_activities(pre_activities)
|
104
|
+
end
|
105
|
+
network.connect(reference,post_activities)
|
106
|
+
pre_activities.each do |pre_act_ref|
|
107
|
+
network.connect(pre_act_ref,reference)
|
108
|
+
end
|
109
|
+
|
110
|
+
In fact the block from his method is passed directly to the Activity.new
|
111
|
+
method. While you could use add_post_activities and add_pre_activities in this
|
112
|
+
block it is better to use Network.connect when dealing with the Network class.
|
113
|
+
|
114
|
+
* Added resources to activities. They can be set via the activity.resources hash
|
115
|
+
|
1
116
|
= 0.6: Initial Release
|
2
117
|
Basic precedence network functionality:
|
118
|
+
|
3
119
|
* Earlist/latest start/finish
|
120
|
+
|
4
121
|
* Generating float and determining critical path
|
122
|
+
|
5
123
|
* Diagram generation via dot files
|
data/README
CHANGED
@@ -16,14 +16,38 @@ Source can also be downloaded from http://rubyforge.org/projects/precedence.
|
|
16
16
|
|
17
17
|
# Set up network
|
18
18
|
net = Precedence::Network.new('Begin','End')
|
19
|
-
net.new_activity('act-1-1'
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
net.new_activity('act-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
net.new_activity('act-1-1') do |act|
|
20
|
+
act.duration = 3
|
21
|
+
act.description = 'System specification'
|
22
|
+
end
|
23
|
+
net.new_activity('act-1-2' do |act|
|
24
|
+
act.duratiom = 2
|
25
|
+
act.description = 'Review'
|
26
|
+
end
|
27
|
+
net.new_activity('act-1-3') do |act|
|
28
|
+
act.duration = 2
|
29
|
+
act.description = 'System re-specification'
|
30
|
+
end
|
31
|
+
net.new_activity('act-2-1') do |act|
|
32
|
+
act.duration = 3
|
33
|
+
act.description = 'Test tool design'
|
34
|
+
end
|
35
|
+
net.new_activity('act-2-2') do |act|
|
36
|
+
act.duration = 5
|
37
|
+
act.description = 'Test tool implementation'
|
38
|
+
end
|
39
|
+
net.new_activity('act-3-1')
|
40
|
+
act.duration = 3
|
41
|
+
act.description = 'System design'
|
42
|
+
end
|
43
|
+
net.new_activity('act-3-2') do |act|
|
44
|
+
act.duration = 12
|
45
|
+
act.description = 'System implementation'
|
46
|
+
end
|
47
|
+
net.new_activity('act-2-3') do |act|
|
48
|
+
act.duration = 10
|
49
|
+
act.description = 'System testing'
|
50
|
+
end
|
27
51
|
net.connect('act-1-1','act-1-2')
|
28
52
|
net.connect('act-1-2','act-1-3')
|
29
53
|
net.connect('act-1-3','act-3-1')
|
@@ -35,7 +59,7 @@ Source can also be downloaded from http://rubyforge.org/projects/precedence.
|
|
35
59
|
net.fix_connections!
|
36
60
|
|
37
61
|
# Generate a diagram
|
38
|
-
File.open('network.dot',File::CREAT|File::TRUNC|File::WRONLY) do|file|
|
62
|
+
File.open('network.dot',File::CREAT|File::TRUNC|File::WRONLY) do |file|
|
39
63
|
file.puts(net.to_dot)
|
40
64
|
end
|
41
65
|
system("dot","-Tpng","-onetwork.png","network.dot")
|
@@ -47,6 +71,14 @@ Source can also be downloaded from http://rubyforge.org/projects/precedence.
|
|
47
71
|
activity.latest_finish # => 5.0
|
48
72
|
activity.total_float # => 0 - activities on the critical path have no float
|
49
73
|
|
74
|
+
# Save the network to a YAML file
|
75
|
+
File.open('network.yaml',File::CREAT|File::TRUNC|File::WRONLY do |file|
|
76
|
+
file.puts(net.to_yaml)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Read the network from a YAML file
|
80
|
+
newNet = Precedence::Network.from_yaml(File.new('network.yaml',File::RDONLY))
|
81
|
+
|
50
82
|
== Documentation
|
51
83
|
|
52
84
|
The Precedence API online documentation is available at
|
data/TODO
CHANGED
@@ -5,18 +5,23 @@ I plan on adding the following leading up to a 1.0 release
|
|
5
5
|
== 0.7
|
6
6
|
|
7
7
|
* Adding resource usage (money, coffee, bulldozers) to each activity.
|
8
|
+
|
8
9
|
* Saving and loading precedence networks (probably using YAML).
|
9
10
|
|
10
11
|
== 0.8
|
11
12
|
|
12
|
-
* Adding
|
13
|
-
activities used
|
14
|
-
|
13
|
+
* Adding a method to the network that will return the set of
|
14
|
+
activities used during each time period of the network.
|
15
|
+
|
16
|
+
* Calculating resource usage and generating some graphs from that.
|
15
17
|
|
16
18
|
== 0.9
|
17
19
|
|
18
|
-
*
|
20
|
+
* network.critical_paths
|
21
|
+
|
22
|
+
* network.probabability_completed_by(time)
|
19
23
|
|
20
24
|
== 1.0 and further
|
21
25
|
|
22
|
-
*
|
26
|
+
* Splitting up some functions into modules so they can be included in a variety
|
27
|
+
of objects
|