In [1]:
import numpy as np

In [2]:
path_to_csv = "generated/central.csv"
data = np.genfromtxt(path_to_csv, dtype=float, delimiter=';')
#times = data[:,0].astype(int)
residual = data[:,1]
production = data[:,2]

path_to_csv = "generated/regio-central.csv"

data = np.genfromtxt(path_to_csv, dtype=float, delimiter=';')
times = data[:,0].astype(int)
residualRegio = data[:,1]
productionRegio = data[:,2]

In [3]:
plot(times, residualRegio, 'r', label='Residual Load')
plot(times, productionRegio,'m', label='Production Regio Central')
legend()
#plot(times, production, 'b')
savefig('regiocentral.pdf')



In [4]:
data[:,0]


Out[4]:
array([  0.,   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.,  37.,  38.,  39.,  40.,  41.,  42.])

In [5]:
plot(times, residual, 'r')
plot(times, production,'m')


Out[5]:
[<matplotlib.lines.Line2D at 0x35cc610>]

In [6]:
import pylab
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': 10,
          'text.fontsize': 10,
          'legend.fontsize': 10,
          'xtick.labelsize': 8,
          'ytick.labelsize': 8,
          'text.usetex': True,
          'figure.figsize': fig_size}
pylab.rcParams.update(params)
# Generate data
# Plot data
pylab.figure(1)
pylab.rcParams.update(params)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])
#pylab.axis([0, 45.,110000.,165000.])

plot(times, residualRegio, 'r--', label='Residual Load')
plot(times, productionRegio,'-g', label='Production')

pylab.xlabel('$t$ (time steps)')
pylab.ylabel('$\mathcal{P} (kWh)$')
pylab.legend()
legend(loc=2)
pylab.savefig('regiocentral.pdf')



In [7]:
pylab.rcParams.update(params)
pylab.figure(2)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])
#pylab.axis([0, 45.,110000.,165000.])

plot(times, residual, '-r', label='Residual Load')
plot(times, productionRegio,'b--', label='Production Regio-Central',linewidth=2.5)
plot(times, production,'g-.', label='Production Central',linewidth=2.5)

pylab.xlabel('$t$ (time steps)')
pylab.ylabel('$\mathcal{P} (kWh)$')
pylab.legend()
legend(loc=2)
pylab.savefig('central.pdf')



In [8]:
problemSizes = np.array([50, 100, 500, 1000])
runTimesCentral = np.array([1995.29, 2231.21, 40850.04, 51557.12]);
runTimesRegioCentral = np.array([318.50, 1036.22, 8073.79, 16018.25]);
pylab.rcParams.update(params)
pylab.figure(3)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])
pylab.axis([0, 1100.,0.,60000.])

plot(problemSizes, runTimesCentral, 'r:x', label='Runtime Central',linewidth=2,markersize=7)
#plot(problemSizes, runTimesCentral, 'rx', label='Runtime Central')
plot(problemSizes, runTimesRegioCentral,'g:o', label='Runtime Regio-Central',linewidth=2,markersize=5)
#plot(problemSizes, runTimesRegioCentral,'gx', label='Runtime Regio-Central')

pylab.xlabel('$n$ (\# plants)')
pylab.ylabel('$t (secs)$')
pylab.legend()
legend(loc=2)
pylab.savefig('times.pdf')



In [9]:
n_groups = 4

means_central = np.array([1.26, 0.36, 3.20, 3.30])
means_regiocentral = np.array([1.30, 0.61, 1.30, 2.20])

pylab.rcParams.update(params)
pylab.figure(4)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])

index = np.arange(n_groups)
bar_width = 0.15

opacity = 0.9
error_config = {'ecolor': '0.3'}

rects1 = plt.bar(index, means_central, bar_width,
                 alpha=opacity,
                 hatch="/",
                 color='w',
                 label='Central')

rects2 = plt.bar(index + bar_width, means_regiocentral, bar_width,
                 alpha=opacity,
                 color='w',
                 hatch="\\",
                 label='Regio-Central')

plt.xlabel('$n$ (\# plants)')
plt.ylabel('Violation in \% of target load')
#plt.title('Violation by problem size and algorithm')
plt.xticks(index + bar_width, problemSizes)
plt.legend(loc=2)
pylab.savefig('violations.pdf')

plt.show()



In [10]:
pylab.rcParams.update(params)
pylab.figure(2)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])
#pylab.axis([0, 45.,110000.,165000.])

data = np.genfromtxt("violation.csv", dtype=float, delimiter=';')
times = data[:,0].astype(int)
productionVio = data[:,1]
demand = data[:,2]

data = np.genfromtxt("penalty.csv", dtype=float, delimiter=';')
productionPenalty = data[:,1]

plot(times, demand, '-r', label='Demand')
plot(times, productionVio,'b--', label='$\mathcal{P}$ Violation',linewidth=2.5)
plot(times, productionPenalty,'g-.', label='$\mathcal{P}$ Penalties',linewidth=2.5)

pylab.xlabel('$t$ (time steps)')
pylab.ylabel('$\mathcal{P} (kWh)$')
pylab.legend()
legend(loc=2)

#legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
pylab.savefig('synthesizedComparison.pdf')



In [10]: