def handle_stats( runs ):
        output = cStringIO.StringIO()
        writer = csv.writer( output )

        def catWrite(listA,listB):
            copy = listA[:]
            copy.extend( listB )
            writer.writerow( copy )

        catWrite( [ 'rank' ], stats.get_max_rank_range( runs ) )
        catWrite( [ 'amt runs' ], stats.get_amount_of_runs_at_total_rank_range( runs ) )
        catWrite( [ 'avg gain' ], stats.get_average_cumulated_gains_at_total_rank_range( runs ) )
        catWrite( [ 'max gain' ], stats.get_max_cumulated_gains_at_total_rank_range( runs ) )
        catWrite( [ 'min gain' ], stats.get_min_cumulated_gains_at_total_rank_range( runs ) )
        catWrite( [ 'avg cost' ], stats.get_average_cumulated_costs_at_total_rank_range( runs ) )
        catWrite( [ 'max cost' ], stats.get_max_cumulated_costs_at_total_rank_range( runs ) )
        catWrite( [ 'min cost' ], stats.get_min_cumulated_costs_at_total_rank_range( runs ) )
        writer.writerow([])

        costInterval = 10
        catWrite( [ 'cost' ], stats.get_min_cost_range( runs, costInterval ) )
        catWrite( [ 'amt runs' ], stats.get_amount_of_runs_at_cost_range( runs, costInterval ) )
        catWrite( [ 'avg gain' ], stats.get_average_cumulated_gains_at_cost_range( runs, costInterval ) )
        catWrite( [ 'max gain' ], stats.get_max_cumulated_gains_at_cost_range( runs, costInterval ) )
        catWrite( [ 'min gain' ], stats.get_min_cumulated_gains_at_cost_range( runs, costInterval ) )
        writer.writerow([])

        writer.writerow( [ 'avgTotalRank', stats.get_average_total_rank(runs)] )
        writer.writerow( [ 'avgGain', stats.get_average_cumulated_gain(runs)] )
        writer.writerow( [ 'avgCost', stats.get_average_cumulated_cost(runs)] )
        writer.writerow( [ 'maxTotalRank', stats.get_max_total_rank(runs)] )
        writer.writerow( [ 'maxGain', stats.get_max_cumulated_gain(runs)] )
        writer.writerow( [ 'maxCost', stats.get_max_cumulated_cost(runs)] )
        writer.writerow( [ 'minTotalRank', stats.get_min_total_rank(runs)] )
        writer.writerow( [ 'minGain', stats.get_min_cumulated_gain(runs)] )
        writer.writerow( [ 'minCost', stats.get_min_cumulated_cost(runs)] )
        writer.writerow( [ 'varTotalRank', stats.get_total_rank_variance(runs)] )
        writer.writerow( [ 'varGain', stats.get_cumulated_gain_variance(runs)] )
        writer.writerow( [ 'varCost', stats.get_cumulated_cost_variance(runs)] )

        return output.getvalue()
 def handle_stats( runs ):
     return 'avgGainsRank = ' + repr(stats.get_average_cumulated_gains_at_total_rank_range( runs )) + '\n' \
     + 'maxGainsRank = ' + repr(stats.get_max_cumulated_gains_at_total_rank_range( runs )) + '\n' \
     + 'minGainsRank = ' + repr(stats.get_min_cumulated_gains_at_total_rank_range( runs )) + '\n' \
     + 'avgGainsCost = ' + repr(stats.get_average_cumulated_gains_at_cost_range( runs, 10 )) + '\n' \
     + 'maxGainsCost = ' + repr(stats.get_max_cumulated_gains_at_cost_range( runs, 10 )) + '\n' \
     + 'minGainsCost = ' + repr(stats.get_min_cumulated_gains_at_cost_range( runs, 10 )) + '\n' \
     + 'avgCostsRank = ' + repr(stats.get_average_cumulated_costs_at_total_rank_range( runs )) + '\n' \
     + 'maxCostsRank = ' + repr(stats.get_max_cumulated_costs_at_total_rank_range( runs )) + '\n' \
     + 'minCostsRank = ' + repr(stats.get_min_cumulated_costs_at_total_rank_range( runs )) + '\n' \
     + 'avgTotalRank = ' + repr(stats.get_average_total_rank(runs)) + '\n' \
     + 'avgGain = ' + repr(stats.get_average_cumulated_gain(runs)) + '\n' \
     + 'avgCost = ' + repr(stats.get_average_cumulated_cost(runs)) + '\n' \
     + 'maxTotalRank = ' + repr(stats.get_max_total_rank(runs)) + '\n' \
     + 'maxGain = ' + repr(stats.get_max_cumulated_gain(runs)) + '\n' \
     + 'maxCost = ' + repr(stats.get_max_cumulated_cost(runs)) + '\n' \
     + 'minTotalRank = ' + repr(stats.get_min_total_rank(runs)) + '\n' \
     + 'minGain = ' + repr(stats.get_min_cumulated_gain(runs)) + '\n' \
     + 'minCost = ' + repr(stats.get_min_cumulated_cost(runs)) + '\n' \
     + 'varTotalRank = ' + repr(stats.get_total_rank_variance(runs)) + '\n' \
     + 'varGain = ' + repr(stats.get_cumulated_gain_variance(runs)) + '\n' \
     + 'varCost = ' + repr(stats.get_cumulated_cost_variance(runs))
Esempio n. 3
0
 def handle_stats(runs):
     return 'avgGainsRank = ' + repr(stats.get_average_cumulated_gains_at_total_rank_range( runs )) + '\n' \
     + 'maxGainsRank = ' + repr(stats.get_max_cumulated_gains_at_total_rank_range( runs )) + '\n' \
     + 'minGainsRank = ' + repr(stats.get_min_cumulated_gains_at_total_rank_range( runs )) + '\n' \
     + 'avgGainsCost = ' + repr(stats.get_average_cumulated_gains_at_cost_range( runs, 10 )) + '\n' \
     + 'maxGainsCost = ' + repr(stats.get_max_cumulated_gains_at_cost_range( runs, 10 )) + '\n' \
     + 'minGainsCost = ' + repr(stats.get_min_cumulated_gains_at_cost_range( runs, 10 )) + '\n' \
     + 'avgCostsRank = ' + repr(stats.get_average_cumulated_costs_at_total_rank_range( runs )) + '\n' \
     + 'maxCostsRank = ' + repr(stats.get_max_cumulated_costs_at_total_rank_range( runs )) + '\n' \
     + 'minCostsRank = ' + repr(stats.get_min_cumulated_costs_at_total_rank_range( runs )) + '\n' \
     + 'avgTotalRank = ' + repr(stats.get_average_total_rank(runs)) + '\n' \
     + 'avgGain = ' + repr(stats.get_average_cumulated_gain(runs)) + '\n' \
     + 'avgCost = ' + repr(stats.get_average_cumulated_cost(runs)) + '\n' \
     + 'maxTotalRank = ' + repr(stats.get_max_total_rank(runs)) + '\n' \
     + 'maxGain = ' + repr(stats.get_max_cumulated_gain(runs)) + '\n' \
     + 'maxCost = ' + repr(stats.get_max_cumulated_cost(runs)) + '\n' \
     + 'minTotalRank = ' + repr(stats.get_min_total_rank(runs)) + '\n' \
     + 'minGain = ' + repr(stats.get_min_cumulated_gain(runs)) + '\n' \
     + 'minCost = ' + repr(stats.get_min_cumulated_cost(runs)) + '\n' \
     + 'varTotalRank = ' + repr(stats.get_total_rank_variance(runs)) + '\n' \
     + 'varGain = ' + repr(stats.get_cumulated_gain_variance(runs)) + '\n' \
     + 'varCost = ' + repr(stats.get_cumulated_cost_variance(runs))