TSP problem experimented with DIM

We are experimenting the TSP problem with the Dynamic Islands Model.


In [1]:
%pylab inline


Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.

In [2]:
import pandas as pd
from pandas import Series, DataFrame, Panel
pd.__version__


Out[2]:
'0.11.0'

In [3]:
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rc('figure', figsize=(10, 8))
mpl.__version__


Out[3]:
'1.2.1'

In [4]:
data_set = [pd.read_csv('result_monitor_%d' % i, index_col='DateTime', parse_dates=True) for i in range(2)]

Evolution of the number of individuals

A resampling is made in order to reduce the number of rows used for plotting. We use a time step at 100ms.


In [18]:
nbindis = pd.concat([data_set[i]['nb_individual_isl%d' % i].resample('s', fill_method='pad') for i in range(2)], axis=1)
_max = nbindis.max(axis=1); _max.name = 'max'
_avg = nbindis.mean(axis=1); _avg.name = 'avg'
#nbindis = nbindis.join(_max).join(_avg)
#nbindis.plot()
nbindis.plot(subplots=True)
nbindis.cumsum().plot()


Out[18]:
<matplotlib.axes.AxesSubplot at 0x7f7a6f575910>

In [19]:
nbindis.describe()


Out[19]:
0 1
count 17.000000 17.000000
mean 105.774784 94.232749
std 59.273556 59.274343
min 12.641869 12.932660
25% 59.980451 36.165049
50% 92.816425 107.323151
75% 163.834951 140.019549
max 187.067340 187.346620

Evolution of the best fitness


In [6]:
bests = pd.concat([data_set[i]['best_value_isl%d' % i].resample('s', fill_method='pad') for i in range(2)], axis=1)
_max = bests.max(axis=1); _max.name = 'max'
_avg = bests.mean(axis=1); _avg.name = 'avg'
#bests = bests.join(_max).join(_avg)
bests.plot()
#bests.plot(subplots=True)


Out[6]:
<matplotlib.axes.AxesSubplot at 0x7f7a78032590>

In [20]:
bests.describe()


Out[20]:
0 1
count 17.000000 17.000000
mean -18539.515866 -18652.756082
std 5340.608330 5704.741263
min -33374.414239 -34413.741100
25% -19768.338257 -19737.181684
50% -16602.183575 -16479.057878
75% -15095.625430 -14813.300687
max -13912.477021 -13567.052083

In [7]:
mig_data_set = [pd.read_csv('result_monitor_%d' % i, index_col='migration') for i in range(2)]

In [16]:
attractiveness = pd.concat([pd.concat([mig_data_set[j]['P%dto%d' % (j,i)] for j in range(2)],axis=1).sum(axis=1) for i in range(2)],axis=1)
attractiveness.cumsum().plot()


Out[16]:
<matplotlib.axes.AxesSubplot at 0x7f7a6f6163d0>

In [21]:
attractiveness.describe()


Out[21]:
0 1
count 10000.000000 10000.000000
mean 107.479530 92.520470
std 75.754222 75.754222
min 2.500000 3.500000
25% 7.000000 5.700000
50% 99.700000 100.300000
75% 194.300000 193.000000
max 196.500000 197.500000