Precedence is an API that allows for the creation and analysis of precedence networks, a tool used in project management.
1.0
Precedence is available as a Ruby gem. The latest release can be found at http://www.aimred.com/gems/precedence-1.0.gem
Source can also be downloaded from it’s Subversion repository at http://precedence.googlecode.com/svn/
net = Precedence::Network.new('Begin','End') net.new_activity('act-1-1') do |act| act.duration = 3 act.description = 'System specification' end net.new_activity('act-1-2' do |act| act.duratiom = 2 act.description = 'Review' end net.new_activity('act-1-3') do |act| act.duration = 2 act.description = 'System re-specification' end net.new_activity('act-2-1') do |act| act.duration = 3 act.description = 'Test tool design' end net.new_activity('act-2-2') do |act| act.duration = 5 act.description = 'Test tool implementation' end net.new_activity('act-3-1') do |act| act.duration = 3 act.description = 'System design' end net.new_activity('act-3-2') do |act| act.duration = 12 act.description = 'System implementation' end net.new_activity('act-2-3') do |act| act.duration = 10 act.description = 'System testing' end net.connect('act-1-1','act-1-2') net.connect('act-1-2','act-1-3') net.connect('act-1-3','act-3-1') net.connect('act-1-2','act-2-1') net.connect('act-2-1','act-2-2') net.connect('act-2-2','act-3-2') net.connect('act-3-1','act-3-2') net.connect('act-3-2','act-2-3') net.fix_connections!
File.open('network.dot',File::CREAT|File::TRUNC|File::WRONLY) do |file| file.puts(net.to_dot) end system("dot","-Tpng","-onetwork.png","network.dot")
activity = net.activities['act-1-2'] activity.on_critical_path? # => true activity.earliest_start # => 3.0 activity.latest_finish # => 5.0 activity.total_float # => 0 - activities on the critical path have no float
File.open('network.yaml',File::CREAT|File::TRUNC|File::WRONLY do |file| file.puts(net.to_yaml) end
new_net = Precedence::Network.from_yaml(File.new('network.yaml',File::RDONLY))
This software is made available under the BSD license.
© 2006 – 2013 Aimred CC 2004 – 2013 Aimred CC