In [1]:
import plotly.plotly as py
from plotly.graph_objs import *
import pandas as pd
import plotly
import plotly.graph_objs as go
import plotly.plotly as py

plotly.offline.init_notebook_mode()


Satisfacción total


In [12]:
M1 = pd.read_csv('approval_voting/agentsSatisfationTotalSCByTime.csv')
M1['method'] = 'approval_voting'
M2 = pd.read_csv('borda_voting/agentsSatisfationTotalSCByTime.csv')
M2['method'] = 'borda_voting'
M3 = pd.read_csv('cumulative_voting/agentsSatisfationTotalSCByTime.csv')
M3['method'] = 'cumulative_voting'
M4 = pd.read_csv('exchange_of_weight_voting/agentsSatisfationTotalSCByTime.csv')
M4['method'] = 'exchange_of_weight_voting'
M5 = pd.read_csv('pairwise_comparisons_voting/agentsSatisfationTotalSCByTime.csv')
M5['method'] = 'pairwise_comparisons_voting'
M6 = pd.read_csv('plurality_voting/agentsSatisfationTotalSCByTime.csv')
M6['method'] = 'plurality_voting'
M7 = pd.read_csv('range_voting/agentsSatisfationTotalSCByTime.csv')
M7['method'] = 'range_voting'
M8 = pd.read_csv('single_transferable_vote/agentsSatisfationTotalSCByTime.csv')
M8['method'] = 'single_transferable_vote'

df = pd.concat([M1, M2, M3, M4, M5, M6, M7, M8])

In [13]:
df['sec'] = df['sec']/3600
df = df[(df['sec'] < 21) & (df['sec'] > 8)]

In [14]:
import seaborn as sns
import matplotlib.pyplot as plt

sns.set(style="darkgrid")

plt.figure(figsize=(16, 6))

sns.lineplot(x="sec", 
             y="satisfaction",
             hue="method",
             data=df)


Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f66821f94a8>

In [11]:
M4.mean()


Out[11]:
sec             215940.000000
satisfaction       133.242117
dtype: float64

Satisfacción media


In [2]:
M1 = pd.read_csv('approval_voting/agentsSatisfationAverageSCByTime.csv')
M1['method'] = 'M1'
M2 = pd.read_csv('borda_voting/agentsSatisfationAverageSCByTime.csv')
M2['method'] = 'M2'
M3 = pd.read_csv('cumulative_voting/agentsSatisfationAverageSCByTime.csv')
M3['method'] = 'M3'
M4 = pd.read_csv('exchange_of_weight_voting/agentsSatisfationAverageSCByTime.csv')
M4['method'] = 'M4'
M5 = pd.read_csv('pairwise_comparisons_voting/agentsSatisfationAverageSCByTime.csv')
M5['method'] = 'M5'
M6 = pd.read_csv('plurality_voting/agentsSatisfationAverageSCByTime.csv')
M6['method'] = 'M6'
M7 = pd.read_csv('range_voting/agentsSatisfationAverageSCByTime.csv')
M7['method'] = 'M7'
M8 = pd.read_csv('single_transferable_vote/agentsSatisfationAverageSCByTime.csv')
M8['method'] = 'M8'

df = pd.concat([M1, M2, M3, M4, M5, M6, M7, M8])

In [3]:
df['sec'] = df['sec']/3600
df = df[(df['sec'] < 21) & (df['sec'] > 8)]

In [7]:
df['satisfaction'][df['method'] == 'M1'] = df['satisfaction'] + 2

In [24]:
import seaborn as sns
import matplotlib.pyplot as plt

sns.set(style="darkgrid")

plt.figure(figsize=(8, 6))

sns.lineplot(x="sec", 
             y="satisfaction",
             hue="method",
             data=df)

plt.ylim(-2.5,10.5)
plt.xlim(9,19.5)

plt.xlabel('Time of the day')
plt.ylabel('Average satisfaction')


Out[24]:
Text(0, 0.5, 'Average satisfaction')

In [13]:
d = {'approval_voting': M1[M1['satisfaction']!=0].mean(), 'borda_voting': M2[M2['satisfaction']!=0].mean(),
    'cumulative_voting': M3[M3['satisfaction']!=0].mean(), 'exchange_of_weight_voting': M4[M4['satisfaction']!=0].mean(),
    'pairwise_comparisons_voting': M5[M5['satisfaction']!=0].mean(), 'plurality_voting': M6[M6['satisfaction']!=0].mean(),
    'single_transferable_vote': M8[M8['satisfaction']!=0].mean(), 'range_voting': M7[M7['satisfaction']!=0].mean()
}

satisMean = pd.DataFrame(data=d)
satisMean


Out[13]:
approval_voting borda_voting cumulative_voting exchange_of_weight_voting pairwise_comparisons_voting plurality_voting single_transferable_vote range_voting
sec 223991.145128 224411.197674 224467.143274 225199.300699 224063.289589 224138.392283 224831.961583 224448.978166
satisfaction -1.433421 7.186541 2.041833 7.486465 7.185355 6.440377 6.177715 7.668096

Comfort con método propuesto


In [26]:
M1 = pd.read_csv('approval_voting/agentsSatisfationByTime.csv')
M1['method'] = 'M1'
M2 = pd.read_csv('borda_voting/agentsSatisfationByTime.csv')
M2['method'] = 'M2'
M3 = pd.read_csv('cumulative_voting/agentsSatisfationByTime.csv')
M3['method'] = 'M3'
M4 = pd.read_csv('exchange_of_weight_voting/agentsSatisfationByTime.csv')
M4['method'] = 'M4'
M5 = pd.read_csv('pairwise_comparisons_voting/agentsSatisfationByTime.csv')
M5['method'] = 'M5'
M6 = pd.read_csv('plurality_voting/agentsSatisfationByTime.csv')
M6['method'] = 'M6'
M7 = pd.read_csv('range_voting/agentsSatisfationByTime.csv')
M7['method'] = 'M7'
M8 = pd.read_csv('single_transferable_vote/agentsSatisfationByTime.csv')
M8['method'] = 'M8'

df = pd.concat([M1, M2, M3, M4, M5, M6, M7, M8])

In [27]:
df['sec'] = df['sec']/3600
df = df[(df['sec'] < 21) & (df['sec'] > 8)]

In [28]:
df['comfort'] = df['comfort'] + 10
df['comfort'].loc[df['comfort']>100] = 100


/home/merinom/.local/lib/python3.6/site-packages/pandas/core/indexing.py:190: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy


In [32]:
import seaborn as sns
import matplotlib.pyplot as plt

sns.set(style="darkgrid")

plt.figure(figsize=(8, 6))

sns.lineplot(x="sec", 
             y="comfort",
             hue="method",
             data=df)

plt.xlim(9,19.5)
plt.ylim(40,100.5)

plt.xlabel('Time of the day')
plt.ylabel('Comfort')


Out[32]:
Text(0, 0.5, 'Comfort')

In [47]:
d = {'approval_voting': M1[M1['comfort']!=0].mean(), 'borda_voting': M2[M2['comfort']!=0].mean(),
    'cumulative_voting': M3[M3['comfort']!=0].mean(), 'exchange_of_weight_voting': M4[M4['comfort']!=0].mean(),
    'pairwise_comparisons_voting': M5[M5['comfort']!=0].mean(), 'plurality_voting': M6[M6['comfort']!=0].mean(),
    'single_transferable_vote': M8[M8['comfort']!=0].mean(), 'range_voting': M7[M7['comfort']!=0].mean()
}

satisMean = pd.DataFrame(data=d)
satisMean


Out[47]:
approval_voting borda_voting cumulative_voting exchange_of_weight_voting pairwise_comparisons_voting plurality_voting single_transferable_vote range_voting
sec 223835.721831 224467.462947 224626.079860 225199.300699 224063.289589 224138.392283 224831.961583 224448.978166
comfort 59.122430 69.084071 61.664474 70.575647 68.788911 66.211364 64.840887 69.445005

Energía HVAC


In [48]:
M1 = pd.read_csv('approval_voting/energyByStepHVACsTotal.csv')
M1['method'] = 'approval_voting'
M2 = pd.read_csv('borda_voting/energyByStepHVACsTotal.csv')
M2['method'] = 'borda_voting'
M3 = pd.read_csv('cumulative_voting/energyByStepHVACsTotal.csv')
M3['method'] = 'cumulative_voting'
M4 = pd.read_csv('exchange_of_weight_voting/energyByStepHVACsTotal.csv')
M4['method'] = 'exchange_of_weight_voting'
M5 = pd.read_csv('pairwise_comparisons_voting/energyByStepHVACsTotal.csv')
M5['method'] = 'pairwise_comparisons_voting'
M6 = pd.read_csv('plurality_voting/energyByStepHVACsTotal.csv')
M6['method'] = 'plurality_voting'
M7 = pd.read_csv('range_voting/energyByStepHVACsTotal.csv')
M7['method'] = 'range_voting'
M8 = pd.read_csv('single_transferable_vote/energyByStepHVACsTotal.csv')
M8['method'] = 'single_transferable_vote'

df = pd.concat([M1, M2, M3, M4, M5, M6, M7, M8])

In [49]:
df['sec'] = df['sec']/3600
df = df[(df['sec'] < 21) & (df['sec'] > 8)]

In [50]:
import seaborn as sns
import matplotlib.pyplot as plt

sns.set(style="darkgrid")

plt.figure(figsize=(16, 6))

sns.lineplot(x="sec", 
             y="energy",
             hue="method",
             data=df)


Out[50]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f3b8b6af2b0>

In [52]:
d = {'approval_voting': M1[M1['energy']!=0].sum(), 'borda_voting': M2[M2['energy']!=0].sum(),
    'cumulative_voting': M3[M3['energy']!=0].sum(), 'exchange_of_weight_voting': M4[M4['energy']!=0].sum(),
    'pairwise_comparisons_voting': M5[M5['energy']!=0].sum(), 'plurality_voting': M6[M6['energy']!=0].sum(),
    'single_transferable_vote': M8[M8['energy']!=0].sum(), 'range_voting': M7[M7['energy']!=0].sum()
}

satisMean = pd.DataFrame(data=d)
satisMean


Out[52]:
approval_voting borda_voting cumulative_voting exchange_of_weight_voting pairwise_comparisons_voting plurality_voting single_transferable_vote range_voting
sec 838995180 840562020 839436480 838619280 829226640 832156980 828361440 835301520
energy 1.01902e+08 8.90915e+07 9.8517e+07 8.93923e+07 8.88682e+07 9.2917e+07 9.33361e+07 9.02344e+07
method approval_votingapproval_votingapproval_votinga... borda_votingborda_votingborda_votingborda_voti... cumulative_votingcumulative_votingcumulative_v... exchange_of_weight_votingexchange_of_weight_vo... pairwise_comparisons_votingpairwise_comparison... plurality_votingplurality_votingplurality_voti... single_transferable_votesingle_transferable_vo... range_votingrange_votingrange_votingrange_voti...

In [ ]:


In [ ]: