#     * note that $\mathrm{SG}_{0}$ is pure Random Shooting (Random Search)
#
# * implemented as ``class ShootAndGo(Heuristic)`` in ``src/heur_sg.py``
#
#

# In[12]:

from heur_sg import ShootAndGo

# In[13]:

# Random Shooting for the AirShip initialization...
demo_rs = ShootAndGo(airship, maxeval=100, hmax=0)
# ...and execution:
demo_rs.search()

# # 2. Performance evaluation
#
# ## What is the recommended approach to store and analyze results of your experiments?
#
# 1. Append all relevant statistics from a single run into table (e.g. CSV file in memory or on disk), including all task and heuristic parameters
# 2. Load the table into analytical tool of your choice (**data frame**, Excel or Google Docs spreadsheets, etc.)
# 3. Pivot by relevant parameters, visualize in tables or charts

# ## Demonstration
#
# Neccessary setup first:

# In[14]:
예제 #2
0
# In[7]:

# neighbourhood of x:
N = tsp.get_neighborhood(x, 1)
print(N)

# In[8]:

# decoded neighbours and their objective function values
for xn in N:
    print('{} ({}) -> {:.4f}'.format(xn, tsp.decode(xn), tsp.evaluate(xn)))

# **Carefully** mind the difference between encoded solution vector vs decoded city tour and meaning of such neighbourhood.

# ### TSP optimization using Random Shooting ($\mathrm{SG}_{0}$)

# In[9]:

heur = ShootAndGo(tsp, maxeval=1000, hmax=0)
print(heur.search())

# # Assignments:
#
# 1. Find a better performing heuristic (to test TSP implementation on your own).
# 2. Can you improve heuristic performance using any
#    1. **better random point generator**?
#    2. **better neighbourhood generator**?
#
# Use performance measure(s) of your choice (e.g. $FEO$).