In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from dspsp_analysis import (algorithm_dataset, instance_dataset, comparison_dataset,
max_event, metrics_dataset, mean_hypervolume)
%matplotlib inline
data = metrics_dataset()
instance_ids = list(data.instance.unique())
algorithm_ids = list(data.algorithm.unique())
instance_datasets = {}
for inst in instance_ids:
ds = instance_dataset(data, inst, zero_values=True)
instance_datasets[inst] = {alg: algorithm_dataset(ds, alg, zero_values=True) for alg in algorithm_ids}
comparison_datasets = {}
for inst in instance_ids:
comparison_datasets[inst] = {alg: comparison_dataset(instance_datasets[inst][alg]) for alg in algorithm_ids}
for inst in instance_ids:
min_event = min([max_event(ds) for ds in comparison_datasets[inst].values()])
for k in comparison_datasets[inst].keys():
comparison_datasets[inst][k] = comparison_datasets[inst][k][:min_event+1]
In [2]:
mean_hypervolume(data)
Out[2]:
In [3]:
mean_hypervolume(data).index
Out[3]:
In [4]:
comparison_datasets["ST10_DT10_E5_SK4-5"]["NSGAII"].tail()
Out[4]:
In [5]:
comparison_datasets["ST10_DT10_E5_SK4-5"]["NSGAIIDynamic"].tail()
Out[5]:
In [6]:
comparison_datasets["ST10_DT10_E5_SK4-5"]["SMPSO"].tail()
Out[6]:
Geração dos gráficos comparativos
In [9]:
plt.title("NSGA-II x NSGA-II Dinamico")
plt.xlabel("Eventos dinâmicos (pontos de reescalonamento)")
plt.ylabel("Hipervolume")
plt.plot(comparison_datasets["ST10_DT10_E5_SK4-5"]["NSGAII"].event, comparison_datasets["ST10_DT10_E5_SK4-5"]["NSGAII"].hypervolume, "-ro", markersize=3, lw=.5, label="NSGAII")
plt.plot(comparison_datasets["ST10_DT10_E5_SK4-5"]["NSGAIIDynamic"].event, comparison_datasets["ST10_DT10_E5_SK4-5"]["NSGAIIDynamic"].hypervolume, "-go", markersize=3, lw=.5, label="NSGAIIDyn")
plt.legend()
plt.show()
In [ ]:
plt.title("SMPSO x SMPSO Dinamico")
plt.xlabel("Eventos dinâmicos (pontos de reescalonamento)")
plt.ylabel("Hipervolume")
plt.plot(datasets["smpso"].event, datasets["smpso"].hypervolume, "-ro", markersize=3, lw=.5, label="SMPSO")
plt.plot(datasets["smpso_dyn"].event, datasets["smpso_dyn"].hypervolume, "-go", markersize=3, lw=.5, label="SMPSODyn")
plt.legend()
plt.show()
In [ ]:
plt.title("NSGA-II x SMPSO")
plt.xlabel("Eventos dinâmicos (pontos de reescalonamento)")
plt.ylabel("Hipervolume")
plt.plot(datasets["nsgaii"].event, datasets["nsgaii"].hypervolume, "-ro", markersize=3, lw=.5, label="NSGAII")
plt.plot(datasets["smpso"].event, datasets["smpso"].hypervolume, "-go", markersize=3, lw=.5, label="SMPSO")
plt.legend()
plt.show()
In [ ]:
plt.title("NSGA-II Dinamico x SMPSO Dinamico")
plt.xlabel("Eventos dinâmicos (pontos de reescalonamento)")
plt.ylabel("Hipervolume")
plt.plot(datasets["nsgaii_dyn"].event, datasets["nsgaii_dyn"].hypervolume, "-ro", markersize=3, lw=.5, label="NSGAIIDyn")
plt.plot(datasets["smpso_dyn"].event, datasets["smpso_dyn"].hypervolume, "-go", markersize=3, lw=.5, label="SMPSODyn")
plt.legend()
plt.show()
In [ ]: