scalability



In [1]:
# reads a file generated by a central run to calculate split times more accurately
import numpy as np
import StringIO
import matplotlib.pyplot as plt
import analysisUtils.analysisUtils as au
import pylab as P
import scipy.stats as st
import cleanFile

def visualizeColumn(columnA, columnB, inputs, prefix, outputfile, inputLabel, outputLabel, titleFig):
    averageRuntimes = []
    averageRuntimesRegio = []
    
    for i in inputs:
        fileName = prefix+str(i)+'.csv'
        data = np.genfromtxt(fileName,dtype=float, delimiter=';', skip_header=0,names=True,autostrip=True)
        runtimeCentral = data[columnA]
        runtimeCentral = runtimeCentral[~numpy.isnan(runtimeCentral)]
        
        runtimeRegioCentral = data[columnB]
        runtimeRegioCentral = runtimeRegioCentral[~numpy.isnan(runtimeRegioCentral)]
        
        meanTime = np.mean(runtimeCentral)
        stdTime = np.std(runtimeCentral)
        print 'mean: ', meanTime, ' std: ', stdTime
        print runtimeCentral
        
        averageRuntimes += [(i, meanTime, stdTime/6)]
        
        meanRegioTime = np.mean(runtimeRegioCentral)
        stdRegioTime = np.std(runtimeRegioCentral)
        
        averageRuntimesRegio += [(i, meanRegioTime, stdRegioTime/6)]
        
    plt.figure()
    averageRuntimes = np.array(averageRuntimes)
    averageRuntimesRegio = np.array(averageRuntimesRegio)
    
    print averageRuntimes
    print '-------'
    print averageRuntimesRegio
    #plot(averageRuntimes[:,0],averageRuntimes[:,1], 'rx-') 
    fig, ax = plt.subplots()
    
    plt.errorbar(averageRuntimes[:,0], averageRuntimes[:,1], averageRuntimes[:,2], label='Central',fmt='.-')
    plt.errorbar(averageRuntimesRegio[:,0], averageRuntimesRegio[:,1], averageRuntimesRegio[:,2], label='Hierarchical',fmt='x--')
    
    plt.legend(loc=2)
    xlabel(inputLabel)
    ylabel(outputLabel)
    #title(titleFig)
    fig = matplotlib.pyplot.gcf()
   # fig.set_size_inches(18.5,10.5)
    
    savefig(outputfile)

In [2]:
def visualizeLSP(columnA, columnB, columnC, inputs, prefix, outputfile, inputLabel, outputLabel, titleFig):
    averageRuntimes = []
    averageRuntimesRegio = []
    averageRuntimesLSP = []
    
    for i in inputs:
        fileName = prefix+str(i)+'.csv'
        data = np.genfromtxt(fileName,dtype=float, delimiter=';', skip_header=0,names=True,autostrip=True)
        runtimeCentral = data[columnA]
        runtimeCentral = runtimeCentral[~numpy.isnan(runtimeCentral)]
        
        runtimeRegioCentral = data[columnB]
        runtimeRegioCentral = runtimeRegioCentral[~numpy.isnan(runtimeRegioCentral)]
        
        runtimeLSP = data[columnC]
        runtimeLSP = runtimeLSP[~numpy.isnan(runtimeLSP)]*1e-9
        
        meanTime = np.mean(runtimeCentral)
        stdTime = np.std(runtimeCentral)
        
        averageRuntimes += [(i, meanTime, stdTime/6)]
        
        meanRegioTime = np.mean(runtimeRegioCentral)
        stdRegioTime = np.std(runtimeRegioCentral)
        
        averageRuntimesRegio += [(i, meanRegioTime, stdRegioTime/6)]
        
        maxLsp  = np.max(runtimeLSP)
        
        averageRuntimesLSP += [(i, maxLsp)]
        
    plt.figure()
    averageRuntimes = np.array(averageRuntimes)
    averageRuntimesRegio = np.array(averageRuntimesRegio)
    averageRuntimesLSP = np.array(averageRuntimesLSP)
    print averageRuntimes
    print '-------'
    print averageRuntimesRegio
    #plot(averageRuntimes[:,0],averageRuntimes[:,1], 'rx-') 
    fig, ax = plt.subplots()
    
    plt.errorbar(averageRuntimes[:,0], averageRuntimes[:,1], averageRuntimes[:,2], label='Central',fmt='.-')
    plt.errorbar(averageRuntimesRegio[:,0], averageRuntimesRegio[:,1], averageRuntimesRegio[:,2], label='Hierarchical Sequential',fmt='x--')
    plt.plot(averageRuntimesLSP[:,0], averageRuntimesLSP[:,1], 'o:', label = 'Longest Seq. Path')
    #plt.errorbar(averageRuntimesLSP[:,0], averageRuntimesLSP[:,1], averageRuntimesLSP[:,2], label='Hierarchical Parallel',fmt='o:')
    
    
    plt.legend(loc=2)
    xlabel(inputLabel)
    ylabel(outputLabel)
    #title(titleFig)
    fig = matplotlib.pyplot.gcf()
   # fig.set_size_inches(18.5,10.5)
    
    savefig(outputfile)

In [3]:
from pylab import arange,pi,sin,cos,sqrt
fig_width_pt = 400  # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27               # Convert pt to inch
golden_mean = (sqrt(5)-1.0)/2.0         # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt  # width in inches
fig_height = fig_width*golden_mean      # height in inches
fig_size =  [fig_width,fig_height]
params = {'backend': 'ps',
          'axes.labelsize': 12,
          'text.fontsize': 12,
          'legend.fontsize': 12,
          'xtick.labelsize': 10,
          'ytick.labelsize': 10,
          'text.usetex': True,
          'figure.figsize': fig_size}
pylab.rcParams.update(params)

In [4]:
prefix = 'scalability/scalability'
column = 'runtimePerStepCentral'
columnRegio = 'runtimePerStepRegioCentral'
inputLabel = '\# plants'
outputLabel ='runtime per step (secs)'
titleFig = 'Mean runtimes per step for \#plants' 

inputs = [50, 100, 150, 200, 250, 300, 350, 400, 700, 800, 900]
outputfile = 'meantimesComparison.pdf'

#inputs = [50]

visualizeColumn(column,columnRegio, inputs, prefix, outputfile, inputLabel, outputLabel, titleFig)

column = 'Top_level_costs_central'
columnRegio = 'Top_level_costs_regio_central'
outputfile = 'costsComparison.pdf'

inputLabel = '\# plants'
outputLabel ='Costs (EUR)'
titleFig = 'Mean costs per \#plants' 

#visualizeColumn(column,columnRegio, inputs, prefix, outputfile, inputLabel, outputLabel, titleFig)


mean:  1.19772176498  std:  3.42016726344
[ 1.59404155  1.58366947  0.90683086 ...,  0.7327009   0.76562676
  0.72012726]
mean:  3.3097914654  std:  7.42864771506
[  3.94016791  11.74788536   0.83510574 ...,   4.21087648   3.3630271
   4.69829193]
mean:  5.27441654128  std:  6.18817809785
[ 1.62698602  1.95384362  1.82586523 ...,  3.82471121  5.78894166
  6.62191705]
mean:  8.08989984552  std:  8.54427249155
[  8.21852516   4.43637709  11.75705435 ...,  10.76248095  15.74882641
  11.5625449 ]
mean:  10.6682274248  std:  5.77343507148
[  3.71116867   3.53076055   4.41682255 ...,  12.18425091  12.24663127
  10.13952534]
mean:  15.2024804175  std:  9.58239066269
[ 16.54647712   9.27394194  10.58963491 ...,  21.97859318   7.39980217
   8.17911041]
mean:  19.1534185714  std:  13.699539373
[ 19.25855638   4.54546583   4.620144   ...,  30.98717362  18.65054308
  13.72944796]
mean:  23.196330928  std:  13.4552017373
[  6.00995416  36.00791169  19.32905499 ...,  24.26349962  21.39501352
  21.64014052]
mean:  65.6816179446  std:  37.2580318153
[ 42.78157234  33.77669517  34.34917275 ...,  84.06995175  82.28071629
  81.01430917]
mean:  81.1932254143  std:  45.2631148026
[ 28.88598919  30.82605286  32.31042834 ...,  57.80526571  58.44409088
  60.21714694]
mean:  106.856999784  std:  74.9791212109
[  61.10054968  155.1205276    60.64115502 ...,  284.11340397  104.08733617
  112.92707179]
[[  5.00000000e+01   1.19772176e+00   5.70027877e-01]
 [  1.00000000e+02   3.30979147e+00   1.23810795e+00]
 [  1.50000000e+02   5.27441654e+00   1.03136302e+00]
 [  2.00000000e+02   8.08989985e+00   1.42404542e+00]
 [  2.50000000e+02   1.06682274e+01   9.62239179e-01]
 [  3.00000000e+02   1.52024804e+01   1.59706511e+00]
 [  3.50000000e+02   1.91534186e+01   2.28325656e+00]
 [  4.00000000e+02   2.31963309e+01   2.24253362e+00]
 [  7.00000000e+02   6.56816179e+01   6.20967197e+00]
 [  8.00000000e+02   8.11932254e+01   7.54385247e+00]
 [  9.00000000e+02   1.06857000e+02   1.24965202e+01]]
-------
[[  5.00000000e+01   1.48730196e+00   4.95158818e-02]
 [  1.00000000e+02   2.81976876e+00   9.51853123e-02]
 [  1.50000000e+02   4.42736215e+00   2.19888620e-01]
 [  2.00000000e+02   5.92391130e+00   4.08451428e-01]
 [  2.50000000e+02   7.71406270e+00   6.03013139e-01]
 [  3.00000000e+02   9.59825759e+00   8.94825478e-01]
 [  3.50000000e+02   1.14359724e+01   1.36078004e+00]
 [  4.00000000e+02   1.34864661e+01   1.69404360e+00]
 [  7.00000000e+02   4.52753040e+01   9.40429801e+00]
 [  8.00000000e+02   3.60703748e+01   1.09727643e+01]
 [  9.00000000e+02   4.39354487e+01   1.49353756e+01]]

In [5]:
prefix = 'scalability/scalability'
column = 'runtimePerStepCentral'
columnRegio = 'runtimePerStepRegioCentral'
columnLSP = 'Longest_serial_path'
inputLabel = '\# plants'
outputLabel ='runtime per step (secs)'
titleFig = 'Mean runtimes per step for \#plants' 

inputs = [50, 100, 150, 200, 250, 300, 350, 400, 700, 900]
outputfile = 'meantimesComparisonLSP.pdf'

#inputs = [50]

visualizeLSP(column,columnRegio, columnLSP, inputs, prefix, outputfile, inputLabel, outputLabel, titleFig)

column = 'Top_level_costs_central'
columnRegio = 'Top_level_costs_regio_central'
outputfile = 'costsComparison.pdf'

inputLabel = '\# plants'
outputLabel ='Costs (EUR)'
titleFig = 'Mean costs per \#plants' 

#visualizeColumn(column,columnRegio, inputs, prefix, outputfile, inputLabel, outputLabel, titleFig)


[[  5.00000000e+01   1.19772176e+00   5.70027877e-01]
 [  1.00000000e+02   3.30979147e+00   1.23810795e+00]
 [  1.50000000e+02   5.27441654e+00   1.03136302e+00]
 [  2.00000000e+02   8.08989985e+00   1.42404542e+00]
 [  2.50000000e+02   1.06682274e+01   9.62239179e-01]
 [  3.00000000e+02   1.52024804e+01   1.59706511e+00]
 [  3.50000000e+02   1.91534186e+01   2.28325656e+00]
 [  4.00000000e+02   2.31963309e+01   2.24253362e+00]
 [  7.00000000e+02   6.56816179e+01   6.20967197e+00]
 [  9.00000000e+02   1.06857000e+02   1.24965202e+01]]
-------
[[  5.00000000e+01   1.48730196e+00   4.95158818e-02]
 [  1.00000000e+02   2.81976876e+00   9.51853123e-02]
 [  1.50000000e+02   4.42736215e+00   2.19888620e-01]
 [  2.00000000e+02   5.92391130e+00   4.08451428e-01]
 [  2.50000000e+02   7.71406270e+00   6.03013139e-01]
 [  3.00000000e+02   9.59825759e+00   8.94825478e-01]
 [  3.50000000e+02   1.14359724e+01   1.36078004e+00]
 [  4.00000000e+02   1.34864661e+01   1.69404360e+00]
 [  7.00000000e+02   4.52753040e+01   9.40429801e+00]
 [  9.00000000e+02   4.39354487e+01   1.49353756e+01]]

In [6]:
# just a playground
import numpy as np

def printTable(X, cols, rows, rowLabel):  
    topString = "\\begin{tabular*}{\\textwidth}{@{\extracolsep{\\fill} }l"
    colLen = len(cols)+1
    singleCol = "d{3}"
    colString = singleCol * colLen
    topString = topString + colString + "}"
    print topString
    print "\\toprule"
    
    headers = rowLabel + " & " 
    first = True 
    for h in cols:
        if(first):
            first = False
        else:
            headers = headers + " & "
        headers = headers + "\multicolumn{1}{c}{"+h+"}"
    
    print headers + "\\\\"
    print "\\midrule"
    
    i = 0
    for row in X: 
        print rows[i],
        for col in row:
            print " & " + str(col),
        print "\\\\"
        i = i + 1
    print '\\bottomrule'
    print '\end{tabular*}'

In [7]:
# prepare table 
inputs = [50, 100, 150, 200, 250, 300, 350, 400, 700, 800, 900]

#inputs = [50, 900]

prefix = 'scalability/scalability' 
columns =     [ 'runtimePerStepCentral', 'runtimePerStepRegioCentral', 'Top_level_costs_central', 'Top_level_costs_regio_central' ]
colHeaders  = [ '$T_{\\text{centr}}$', '$T_{\\text{hier}}$', 'Rel.', '$\Gamma_{\\text{centr}}$', '$\Gamma_{\\text{hier}}$', 'Rel.']

column = 'Top_level_costs_central'
columnRegio = 'Top_level_costs_regio_central'


columnTime = 'runtimePerStepCentral'
columnRegioTime = 'runtimePerStepRegioCentral'
rows = [str(i) for i in inputs]
# extend to second row
b = [ [i, ' '] for i in rows]
#rows = [item for sublist in b for item in sublist]

X = []

for inp in inputs:
    fileName = prefix+str(inp)+'.csv'
    data = np.genfromtxt(fileName,dtype=float, delimiter=';', skip_header=0,names=True,autostrip=True)
    newLine = []
    stdDevLine = []
    
    print str(inp),
    
    ## time diff
    timeCentral = au.readCol(data, columnTime)
    timeRegio = au.readCol(data, columnRegioTime)

    centralMean = np.mean(timeCentral)
    regioMean = np.mean(timeRegio)
    
      
    meanVal = np.mean(timeCentral)
    stdVal = np.std(timeCentral)
    stdString = "("+str(np.around(stdVal, 2)) + ")"
    
    newLine += [str(np.around(meanVal, 2)) + "~"+stdString]
    stdDevLine += ["("+str(np.around(stdVal, 2)) + ")"]
    
    meanVal = np.mean(timeRegio)
    stdVal = np.std(timeRegio)
    stdString = "("+str(np.around(stdVal, 2)) + ")"
    
    newLine += [str(np.around(meanVal, 2)) + "~" +stdString]
    stdDevLine += ["("+str(np.around(stdVal, 2)) + ")"]
    newLine += [str( np.around(100*(regioMean / centralMean), 2)) +  " \%"]
    
    ## extra costs
    costsCentral = au.readCol(data, column)
    costsRegio = au.readCol(data, columnRegio)
    extraCosts = (- 1.0 + (costsRegio / costsCentral)) * 100.0
    meanExtra = np.mean(extraCosts)
    
    meanVal = np.mean(costsCentral)
    stdVal = np.std(costsCentral)
    stdString = "("+str(np.around(stdVal, 2)) + ")"
    
    newLine += [str(np.around(meanVal, 2)) + "~"+stdString]
    
    stdDevLine += ["("+str(np.around(stdVal, 2)) + ")"]
    
    meanVal = np.mean(costsRegio)
    stdVal = np.std(costsRegio)
    stdString = "("+str(np.around(stdVal, 2)) + ")"
    newLine += [str(np.around(meanVal, 2)) + stdString ]
    newLine += ["+ " + str(np.around(meanExtra, 2)) +  " \%"]
    stdDevLine += ["("+str(np.around(stdVal, 2)) + ")"]
         
    X += [newLine]
    #X += [stdDevLine]
    
print X

printTable(X, colHeaders, rows, '\# plants')


50 100 150 200 250 300 350 400 700 800 900 [['1.2~(3.42)', '1.49~(0.3)', '124.18 \\%', '2395.6~(536.14)', '2398.21(536.16)', '+ 0.11 \\%'], ['3.31~(7.43)', '2.82~(0.57)', '85.19 \\%', '4777.65~(845.56)', '4782.79(845.81)', '+ 0.11 \\%'], ['5.27~(6.19)', '4.43~(1.32)', '83.94 \\%', '7008.41~(1170.96)', '7017.81(1169.98)', '+ 0.14 \\%'], ['8.09~(8.54)', '5.92~(2.45)', '73.23 \\%', '9431.81~(1322.07)', '9442.39(1321.87)', '+ 0.11 \\%'], ['10.67~(5.77)', '7.71~(3.62)', '72.31 \\%', '11805.68~(1686.42)', '11819.61(1686.49)', '+ 0.12 \\%'], ['15.2~(9.58)', '9.6~(5.37)', '63.14 \\%', '14120.96~(1818.34)', '14138.42(1818.0)', '+ 0.13 \\%'], ['19.15~(13.7)', '11.44~(8.16)', '59.71 \\%', '16343.07~(2139.34)', '16362.32(2139.0)', '+ 0.12 \\%'], ['23.2~(13.46)', '13.49~(10.16)', '58.14 \\%', '18695.82~(2388.73)', '18721.15(2390.16)', '+ 0.14 \\%'], ['65.68~(37.26)', '45.28~(56.43)', '68.93 \\%', '32576.8~(3930.08)', '32910.47(3906.97)', '+ 1.05 \\%'], ['81.19~(45.26)', '36.07~(65.84)', '44.43 \\%', '37376.75~(4435.96)', '37664.91(4431.76)', '+ 0.79 \\%'], ['106.86~(74.98)', '43.94~(89.61)', '41.12 \\%', '41936.44~(4890.82)', '42303.24(4853.31)', '+ 0.9 \\%']]
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill} }ld{3}d{3}d{3}d{3}d{3}d{3}d{3}}
\toprule
\# plants & \multicolumn{1}{c}{$T_{\text{centr}}$} & \multicolumn{1}{c}{$T_{\text{hier}}$} & \multicolumn{1}{c}{Rel.} & \multicolumn{1}{c}{$\Gamma_{\text{centr}}$} & \multicolumn{1}{c}{$\Gamma_{\text{hier}}$} & \multicolumn{1}{c}{Rel.}\\
\midrule
50  & 1.2~(3.42)  & 1.49~(0.3)  & 124.18 \%  & 2395.6~(536.14)  & 2398.21(536.16)  & + 0.11 \% \\
100  & 3.31~(7.43)  & 2.82~(0.57)  & 85.19 \%  & 4777.65~(845.56)  & 4782.79(845.81)  & + 0.11 \% \\
150  & 5.27~(6.19)  & 4.43~(1.32)  & 83.94 \%  & 7008.41~(1170.96)  & 7017.81(1169.98)  & + 0.14 \% \\
200  & 8.09~(8.54)  & 5.92~(2.45)  & 73.23 \%  & 9431.81~(1322.07)  & 9442.39(1321.87)  & + 0.11 \% \\
250  & 10.67~(5.77)  & 7.71~(3.62)  & 72.31 \%  & 11805.68~(1686.42)  & 11819.61(1686.49)  & + 0.12 \% \\
300  & 15.2~(9.58)  & 9.6~(5.37)  & 63.14 \%  & 14120.96~(1818.34)  & 14138.42(1818.0)  & + 0.13 \% \\
350  & 19.15~(13.7)  & 11.44~(8.16)  & 59.71 \%  & 16343.07~(2139.34)  & 16362.32(2139.0)  & + 0.12 \% \\
400  & 23.2~(13.46)  & 13.49~(10.16)  & 58.14 \%  & 18695.82~(2388.73)  & 18721.15(2390.16)  & + 0.14 \% \\
700  & 65.68~(37.26)  & 45.28~(56.43)  & 68.93 \%  & 32576.8~(3930.08)  & 32910.47(3906.97)  & + 1.05 \% \\
800  & 81.19~(45.26)  & 36.07~(65.84)  & 44.43 \%  & 37376.75~(4435.96)  & 37664.91(4431.76)  & + 0.79 \% \\
900  & 106.86~(74.98)  & 43.94~(89.61)  & 41.12 \%  & 41936.44~(4890.82)  & 42303.24(4853.31)  & + 0.9 \% \\
\bottomrule
\end{tabular*}

In [8]:
# stats (t-test runtime/costs)
# prepare table 
inputs = [50, 100, 150, 200, 250, 300, 350, 400, 700, 800, 900]

#inputs = [50, 900]

prefix = 'scalability/scalability' 
columns =     [ 'runtimePerStepCentral', 'runtimePerStepRegioCentral', 'Top_level_costs_central', 'Top_level_costs_regio_central' ]
colHeaders  = [ '$T_{\\text{centr}}$', '$T_{\\text{hier}}$', 'Rel.', '$\Gamma_{\\text{centr}}$', '$\Gamma_{\\text{hier}}$', 'Rel.']

column = 'Top_level_costs_central'
columnRegio = 'Top_level_costs_regio_central'


columnTime = 'runtimePerStepCentral'
columnRegioTime = 'runtimePerStepRegioCentral'
rows = [str(i) for i in inputs]
# extend to second row
b = [ [i, ' '] for i in rows]
#rows = [item for sublist in b for item in sublist]

X = []

for inp in inputs:
    fileName = prefix+str(inp)+'.csv'
    data = np.genfromtxt(fileName,dtype=float, delimiter=';', skip_header=0,names=True,autostrip=True)
    newLine = []
    stdDevLine = []
    
    ## time diff
    timeCentral = au.readCol(data, columnTime)
    timeRegio = au.readCol(data, columnRegioTime)

    print ' Len, ', timeCentral.shape
    print 'For ', inp ,' plants: '
    print '  Times: ',
    [t, prob] = st.ttest_rel(timeCentral, timeRegio)
    
    if prob < 0.01:
        print ' SIGNIFICANT t=', t, ' prob = ', prob
    else:
        print ' insignificant t=', t, ' prob = ', prob 
        
    ## extra costs
    costsCentral = au.readCol(data, column)
    costsRegio = au.readCol(data, columnRegio)
    
    print '  Costs: ',
    [t, prob] = st.ttest_rel(costsCentral, costsRegio)
    
    if prob < 0.01:
        print ' SIGNIFICANT t=', t, ' prob = ', prob
    else:
        print ' insignificant t=', t, ' prob = ', prob


 Len,  (2400,)
For  50  plants: 
  Times:   SIGNIFICANT t= -4.14173676671  prob =  3.56610736888e-05
  Costs:   SIGNIFICANT t= -31.6871983023  prob =  2.19964661272e-184
 Len,  (2400,)
For  100  plants: 
  Times:   SIGNIFICANT t= 3.22288271438  prob =  0.00128608440707
  Costs:   SIGNIFICANT t= -54.6470630646  prob =  0.0
 Len,  (2400,)
For  150  plants: 
  Times:   SIGNIFICANT t= 6.67340907985  prob =  3.09340154596e-11
  Costs:   SIGNIFICANT t= -78.3326890916  prob =  0.0
 Len,  (2400,)
For  200  plants: 
  Times:   SIGNIFICANT t= 11.796020473  prob =  2.93723219086e-31
  Costs:   SIGNIFICANT t= -78.6559143752  prob =  0.0
 Len,  (2400,)
For  250  plants: 
  Times:   SIGNIFICANT t= 20.8622764087  prob =  5.85186688737e-89
  Costs:   SIGNIFICANT t= -107.101439382  prob =  0.0
 Len,  (2400,)
For  300  plants: 
  Times:   SIGNIFICANT t= 24.7537753475  prob =  1.14824944634e-120
  Costs:   SIGNIFICANT t= -96.6915463077  prob =  0.0
 Len,  (2400,)
For  350  plants: 
  Times:   SIGNIFICANT t= 23.3529116398  prob =  7.39941645774e-109
  Costs:   SIGNIFICANT t= -103.720001991  prob =  0.0
 Len,  (2400,)
For  400  plants: 
  Times:   SIGNIFICANT t= 27.5924796467  prob =  8.61300505408e-146
  Costs:   SIGNIFICANT t= -109.078979628  prob =  0.0
 Len,  (2400,)
For  700  plants: 
  Times:   SIGNIFICANT t= 14.321120363  prob =  1.06577417189e-44
  Costs:   SIGNIFICANT t= -69.8329226586  prob =  0.0
 Len,  (1200,)
For  800  plants: 
  Times:   SIGNIFICANT t= 18.8493826302  prob =  1.28465779935e-69
  Costs:   SIGNIFICANT t= -37.4366504091  prob =  8.34827783009e-204
 Len,  (1200,)
For  900  plants: 
  Times:   SIGNIFICANT t= 17.8563340097  prob =  2.02089314049e-63
  Costs:   SIGNIFICANT t= -42.2634719522  prob =  9.53133603573e-240

In [9]:
# abstraction time ammortizes?
# prepare table 
inputs = [50, 100, 150, 200, 250, 300, 350, 400, 700, 800, 900]

#inputs = [50, 900]

prefix = 'scalability/scalability' 

columnTotalTime = 'Total_runtime_central'
columnTotalTimeRegio = 'Total_runtime_regio_central'

columnTime = 'runtimePerStepCentral'
columnRegioTime = 'runtimePerStepRegioCentral'

rows = [str(i) for i in inputs]


for inp in inputs:
    fileName = prefix+str(inp)+'.csv'
    data = np.genfromtxt(fileName,dtype=float, delimiter=';', skip_header=0,names=True,autostrip=True)
    
    ## time diff
    timeCentral = au.readCol(data, columnTime)
    timeRegio = au.readCol(data, columnRegioTime)

    totalTimeCentral = au.readCol(data, columnTotalTime)
    totalTimeRegio = au.readCol(data, columnTotalTimeRegio)
    
    print inp, ': '
    print '  time / step central ', np.mean(timeCentral), ' time / step regio ', np.mean(timeRegio)
    print '  total time  central ', np.mean(totalTimeCentral), ' total time  regio ', np.mean(totalTimeRegio)
    print '  total ratio: ', np.mean(totalTimeRegio) / np.mean(totalTimeCentral)
    
    # variable costs
    varCosts = 48 * np.mean(timeRegio)
    diff = np.mean(totalTimeRegio) - varCosts
    print '  abstraction duration: ', diff, ' rel: ', diff / np.mean(totalTimeRegio)


50 : 
  time / step central  1.19772176498  time / step regio  1.48730196135
  total time  central  57.4931145695  total time  regio  82.5686609241
  total ratio:  1.43614868567
  abstraction duration:  11.1781667795  rel:  0.135380259948
100 : 
  time / step central  3.3097914654  time / step regio  2.81976875889
  total time  central  158.873088917  total time  regio  154.912241676
  total ratio:  0.975069111657
  abstraction duration:  19.5633412493  rel:  0.12628660613
150 : 
  time / step central  5.27441654128  time / step regio  4.42736215137
  total time  central  253.175231722  total time  regio  240.814038608
  total ratio:  0.951175345908
  abstraction duration:  28.3006553425  rel:  0.117520787019
200 : 
  time / step central  8.08989984552  time / step regio  5.92391130045
  total time  central  388.318695757  total time  regio  320.776399247
  total ratio:  0.826064783262
  abstraction duration:  36.4286568252  rel:  0.113564018147
250 : 
  time / step central  10.6682274248  time / step regio  7.71406269859
  total time  central  512.078841161  total time  regio  423.673150371
  total ratio:  0.82735921955
  abstraction duration:  53.3981408381  rel:  0.126036169135
300 : 
  time / step central  15.2024804175  time / step regio  9.59825759103
  total time  central  729.723268223  total time  regio  520.91120067
  total ratio:  0.713847595868
  abstraction duration:  60.1948363006  rel:  0.115556809343
350 : 
  time / step central  19.1534185714  time / step regio  11.4359724059
  total time  central  919.368810658  total time  regio  617.779631098
  total ratio:  0.671960614648
  abstraction duration:  68.8529556169  rel:  0.111452291644
400 : 
  time / step central  23.196330928  time / step regio  13.4864661393
  total time  central  1113.42865986  total time  regio  723.239617383
  total ratio:  0.649560805696
  abstraction duration:  75.8892426952  rel:  0.104929598533
700 : 
  time / step central  65.6816179446  time / step regio  45.2753040354
  total time  central  3152.72456612  total time  regio  2387.74352168
  total ratio:  0.757358745301
  abstraction duration:  214.528927978  rel:  0.0898458842126
800 : 
  time / step central  81.1932254143  time / step regio  36.0703748083
  total time  central  3897.28213061  total time  regio  1963.96844449
  total ratio:  0.50393283798
  abstraction duration:  232.590453693  rel:  0.11842881404
900 : 
  time / step central  106.856999784  time / step regio  43.9354487364
  total time  central  5129.14410747  total time  regio  2365.38254647
  total ratio:  0.46116515678
  abstraction duration:  256.481007123  rel:  0.108431089722

In [9]: