tre czyta poprawnie wyjcie z dgp

This commit is contained in:
Tomasz Obrebski 2013-11-19 13:31:38 +01:00
parent b97a55609b
commit b30c30d500

View File

@ -277,11 +277,11 @@ def parsegraph(nodes)
$len[i] = dgp[1].to_i $len[i] = dgp[1].to_i
$sat << i if parts[1]=="s" $sat << i if parts[1]=="s"
$arcs |= parts[2].split(',').map{ |a| case a $arcs |= parts[2].scan(/\([^()]+\)/).map{ |a| case a
when /\-\-(\w+)-(\d+)\((\d+)~(\d+)\)/ when /\-\-(\w+):(\d+)/
# [i, $2.to_i, $1, $3.to_i, $4.to_i] # [i, $2.to_i, $1, $3.to_i, $4.to_i]
[i, $2.to_i, $1, 0, 0] [i, $2.to_i, $1, 0, 0]
when /\+\+(\w+)-(\d+)\((\d+)~(\d+)\)/ when /\+\+(\w+):(\d+)/
# [$2.to_i, i, $1, $3.to_i, $4.to_i] # [$2.to_i, i, $1, $3.to_i, $4.to_i]
[$2.to_i, i, $1, 0, 0] [$2.to_i, i, $1, 0, 0]
end } end }
@ -379,6 +379,7 @@ end
def buildR(min, max, tree) def buildR(min, max, tree)
if $DEBUG then print "buildR--#{min}--#{max}--#{tree.inspect}\n" end if $DEBUG then print "buildR--#{min}--#{max}--#{tree.inspect}\n" end
trees=[] trees=[]
print $arcs
for arc in $arcs.select{|a| a[0]==max && $vis.include?([min,a[1]]) } for arc in $arcs.select{|a| a[0]==max && $vis.include?([min,a[1]]) }
if $DEBUG then print "ARC: #{arc.inspect}\n" end if $DEBUG then print "ARC: #{arc.inspect}\n" end
for r in buildR(arc[1],arc[0],tree+[arc]) #!!! buildR(a[1],a[3],tree+[a]) for r in buildR(arc[1],arc[0],tree+[arc]) #!!! buildR(a[1],a[3],tree+[a])