5 from heapq
import heappush
, heappop
14 optparser
= optparse
.OptionParser()
15 optparser
.add_option("-k", "--k-best", dest
="k", type='int', help="number of best paths", default
=1)
16 (opts
,args
) = optparser
.parse_args()
19 if len(args
)==0: args
=(sys
.stdin
)
22 if (type(fname
) == type('')):
42 avg
=float(total_depth
)/float(lc
)
43 print "averagePaths=%g" % (total_paths
/ float(lc
))
44 print "averageNodes=%f" % (float(total_depth
) / float(lc
))
45 print "totalPaths=%f" % (float(total_depth
))
46 print "Nodes/Len=%f" % (float(total_depth
)/float(total_cols
))
47 print "averageLen=%f" % (float(total_cols
) / float(lc
))