from tqdm import tqdm_notebook import matplotlib get_ipython().run_line_magic('matplotlib', 'notebook') import matplotlib.pyplot as plt import seaborn as sns sns.set() # **``TSPGrid(3, 3)``** will be used for demonstration purposes. # In[3]: from objfun_tsp import TSPGrid tsp = TSPGrid(3, 3) # In[4]: from heur_go import Crossover, UniformMultipoint, RandomCombination # crossover from heur_go import GeneticOptimization # heuristics from heur_aux import Correction, MirrorCorrection, ExtensionCorrection # corrections from heur_aux import CauchyMutation, LevyMutation # mutations # In[5]: def rel(x):
# In[2]: # Import extrenal librarires import numpy as np # Import our code from heur_sg import ShootAndGo from objfun_tsp import TSPGrid # <-- our implementation of TSP # ### ``TSPGrid(3, 2)`` demonstration # In[3]: # initialization tsp = TSPGrid(3, 2) # In[4]: # random point generation x = tsp.generate_point() print(x) # In[5]: # decode this solution (into list of visited cities) cx = tsp.decode(x) print(cx) # In[6]: