-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconjunctiveNetwork.rb
More file actions
executable file
·36 lines (28 loc) · 1.19 KB
/
conjunctiveNetwork.rb
File metadata and controls
executable file
·36 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#conjunctiveNetworks.rb $n_nodes $p_value $dpGraph
# Takes input from dvd website and passes it to conjunctiveNetwork.m2 to
# compute fixed points/limit cycles
# returns 0 (no errors) or 1 (errors)
unless ARGV.size == 3
puts "Usage: ruby conjunctiveNetworks.rb n_nodes p_value dpGraph"
exit 0
end
n_nodes = ARGV[0]
p_value = ARGV[1]
dpGraph = ARGV[2]
puts "<br>"
if (p_value.to_i != 2)
puts "This feature is only available for 2 states per node, not #{p_value}.<br>"
exit 1
end
puts "<br>"
puts "<font color=blue><b>If your dependency graph is not strongly connected
then it will exit at this time, sorry.</b></font><br>";
puts "<font color=blue><b>Calculating fixed points and limit cycles for
conjunctive/disjunctive network now...</b></font><br>";
# dpGraph = "../../" + dpGraph
# m2_result = `cd lib/M2code/; M2 conjunctiveNetwork.m2 --stop --no-debug --silent -q -e 'QR = makeRing (#{n_nodes}, #{p_value}); ll = limCycles("#{dpGraph}"); exit 0'`
m2_result = `cd lib/M2code/; M2 conjunctiveNetwork.m2 --stop --no-debug --silent -q -e 'QR = makeRing (#{n_nodes}, #{p_value}); ll = limCycles("#{dpGraph}"); exit 0'`
m2_result = m2_result.gsub(/\n/, "<br>")
puts m2_result
puts "<br>"
exit 0