Commit 45873984 authored by Marc Serramia's avatar Marc Serramia

All data and experiments done

parent ca477fb1
...@@ -110,13 +110,21 @@ LABELS = ["Hard problem"]#["Medium problem", "Easy problem", "No constraints"] ...@@ -110,13 +110,21 @@ LABELS = ["Hard problem"]#["Medium problem", "Easy problem", "No constraints"]
""" """
#VALUES SETTINGS: #VALUES SETTINGS:
#""" """
PLOT_TYPE = "VALUES" PLOT_TYPE = "VALUES"
TO_PLOT = "SOLVE" TO_PLOT = "SOLVE"
PLOT_NORMS = 500 PLOT_NORMS = 500
DRAW_LINE = True DRAW_LINE = True
SD = False SD = False
POINT_SIZE = 10 POINT_SIZE = 10
"""
#VALUES HEATMAP SETTINGS:
#"""
PLOT_TYPE = "VALUES_HEATMAP"
TO_PLOT = "BUILD"
PLOT_NORMS = 500
POINT_SIZE = 10
#""" #"""
#-----------------PROBLEM VISUALISER----------------------- #-----------------PROBLEM VISUALISER-----------------------
......
This diff is collapsed.
...@@ -90,6 +90,29 @@ class Plot: ...@@ -90,6 +90,29 @@ class Plot:
plotfile.close() plotfile.close()
return x,y,z return x,y,z
def loadScatterPointsValuesHeatmap(self):
size = os.path.getsize(self.plot_filename)
plotfile = open(self.plot_filename, "r")
x = []
y = []
z = []
while size:
line = plotfile.readline()
data = line.strip('\n').split(',')
ind_prob = data[3]
normvalue_prob = data[4]
if PARAMETERS.TO_PLOT == "SOLVE":
time = data[9]
else:
time = data[8]
if ind_prob != 0:
x.append(round(float(ind_prob),2))
y.append(round(float(normvalue_prob),2))
z.append(float(time))
size -= len(line)
plotfile.close()
return x,y,z
def loadScatterPointsValues(self): def loadScatterPointsValues(self):
size = os.path.getsize(self.plot_filename) size = os.path.getsize(self.plot_filename)
plotfile = open(self.plot_filename, "r") plotfile = open(self.plot_filename, "r")
...@@ -252,6 +275,41 @@ class Plot: ...@@ -252,6 +275,41 @@ class Plot:
plt.show() plt.show()
plt.close(fig) plt.close(fig)
def plotvaluerangeheatmap(self):
plot_fig_path = self.plot_filename[:-4]+"PlotValueHeatmap.pdf"
fig = plt.figure()
ax = fig.add_subplot(111)
if PARAMETERS.TO_PLOT == "SOLVE":
fig.suptitle('Effect of value indifference and value promotion probability on solving times', size=16)
else:
fig.suptitle('Effect of value indifference and value promotion probability on building times', size=16)
ax.set_xlabel('Value promotion probability', size=12)
ax.set_ylabel('Value indifference probability', size=12)
x, y, z = self.loadScatterPointsValuesHeatmap()
maxtime = max(z)
for i in range(len(z)):
if z[i] > 10.0:
z[i] = 10.0
cdict = {'red': [[0.0, 0.0, 0.0],
[0.25, 1.0, 1.0],
[0.75, 1.0, 1.0],
[1, 0.0, 0.0]],
'green': [[0.0, 1.0, 1.0],
[0.25, 1.0, 1.0],
[0.75, 0.0, 0.0],
[1, 0.0, 0.0]],
'blue': [[0.0, 0.0, 0.0],
[1, 0.0, 0.0]]}
newcmp = LinearSegmentedColormap('testCmap', segmentdata=cdict, N=256)
plt.scatter(x, y, c=z, cmap = newcmp)
plt.colorbar(label = "Seconds")
plt.show()
if PARAMETERS.SAVE:
plt.savefig(plot_fig_path)
if PARAMETERS.SHOW:
plt.show()
plt.close(fig)
def plotnormrange(self): def plotnormrange(self):
plot_fig_path = os.getcwd()+"/PLOTDATA/PlotNormRange.pdf" plot_fig_path = os.getcwd()+"/PLOTDATA/PlotNormRange.pdf"
fig = plt.figure() fig = plt.figure()
...@@ -395,6 +453,13 @@ def main(): ...@@ -395,6 +453,13 @@ def main():
pl.plotvaluerange() pl.plotvaluerange()
else: else:
print("INEXISTENT PLOT FILE") print("INEXISTENT PLOT FILE")
elif PARAMETERS.PLOT_TYPE == "VALUES_HEATMAP":
plot_data_file = os.getcwd()+"/PLOTDATA/"+str(PARAMETERS.PLOT_NORMS)+"N.txt"
if os.path.exists(plot_data_file):
pl = Plot(plot_data_file)
pl.plotvaluerangeheatmap()
else:
print("INEXISTENT PLOT FILE")
else: else:
print("INVALID PLOT TYPE") print("INVALID PLOT TYPE")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment