Commitv1

parents
,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35
0,0,50.9,12.8,44.7,5.9,71,60.6,12.4,63.5,50.5,52.7,43.1,51.9,56.3,6,11.8,14.6,60.7,9,42.4,6.8,36.3,4.4,3.4,9.8,21,74.2,37.1,64.5,36.1,11.6,3.3,10.7,22.5,14.4,5.7
1,50.9,0,59.2,6.2,47.3,53.5,12,51.4,17.6,18.6,20.7,50.3,59,7.7,52.4,58.2,61,67.9,55.5,8.7,53.2,45.7,47.9,49.8,56.2,32.2,102,83.5,71.7,63.9,46.1,49.7,45.2,32.9,60.8,52.1
2,12.8,59.2,0,53,14.2,11.9,68.9,20.7,71.8,58.8,61,51.4,60.2,64.6,8,4.1,4.8,69,15.4,50.7,8.7,44.6,12.7,9.4,4.5,29.3,82.5,30.4,72.8,44.4,19.9,9.5,18.9,31.8,4.5,7.7
3,44.7,6.2,53,0,41.1,47.2,15.9,45.5,18.8,12.3,14.5,44,52.8,11.6,46.2,52,54.8,61.7,49.2,2.4,47,39.5,41.7,43.6,50,26,95.8,77.2,65.5,57.7,39.9,43.5,39,26.7,54.5,45.9
4,5.9,47.3,14.2,41.1,0,8.4,57,13.8,59.8,46.9,49,39.4,48.2,52.7,7.4,13.1,16,57,10.4,38.8,8.1,32.7,2.9,4.8,11.2,17.4,70.5,38.4,60.9,32.4,7.9,4.7,7,19.9,15.7,7.1
5,7.1,53.5,11.1,47.2,8.4,0,63.2,14.9,66,53.1,55.3,45.6,54.4,58.9,3.5,10.9,13,63.3,9.6,45,2.8,38.9,7,3.7,8.9,23.6,76.7,36.2,67.1,38.6,14.1,3.8,13.2,26.1,13.5,4
6,60.6,12,68.9,15.9,57,63.1,0,61.4,5.5,28.2,30.4,59.9,68.7,10.8,62.1,67.9,70.7,77.6,65.1,18.3,62.9,55.4,57.6,59.5,65.9,41.9,112,93.1,81.4,73.6,55.8,59.4,54.9,42.6,70.4,61.8
7,12.4,51.7,20.7,45.5,11.3,14.9,61.4,0,64.2,51.3,53.5,43.8,52.6,57.1,13.9,19.6,22.9,61.5,15,43.2,14.6,37.1,11.9,11.3,17.7,21.8,74.9,44.9,65.3,36.8,12.8,11.2,11.9,24.3,22.2,13.6
8,62.5,16.6,71.8,17.8,58.8,66,5.5,63.3,0,31.1,33.2,61.8,70.6,23,64,69.7,73.6,80.4,67,21.2,64.7,58.2,59.5,62.4,67.8,43.8,114,95,83.3,75.5,57.7,61.3,56.8,44.5,72.3,64.6
9,50.5,18.6,58.8,12.3,46.9,53.1,28.2,51.3,31.1,0,5.7,49.9,58.6,23.9,52,57.8,60.7,67.5,55.1,10,52.8,23.4,47.5,49.4,55.8,31.9,102,83.1,71.3,63.5,45.7,49.3,44.8,19.8,60.4,51.7
10,52.7,20.7,61,14.5,49,55.2,30.4,53.5,33.2,5.7,0,52,60.8,26.1,54.2,59.9,62.8,69.6,57.2,12.2,54.9,47.5,49.7,51.6,58,34,104,85.2,73.5,65.7,47.9,51.5,47,34.7,62.5,53.8
11,43.1,50.3,51.4,44,39.4,45.6,59.9,43.8,62.8,49.9,52,0,13.6,55.6,44.6,50.3,53.2,22.4,47.6,41.7,45.6,37.9,40.1,42,48.4,24.4,94.2,75.6,26.2,56.1,38.2,41.8,37.3,25.1,52.9,44.2
12,51.9,59,60.2,52.8,48.2,54.4,68.7,52.8,71.6,58.6,60.8,13.6,0,64.4,53.4,59.1,62,11.6,56.4,50.5,54.1,46.6,48.9,50.8,57.2,33.2,103,84.4,15.5,64.9,47,50.6,46.1,33.8,61.7,53
13,56.3,7.7,64.6,11.6,52.7,58.8,10.8,57.1,23,23.9,26.1,55.6,64.4,0,57.8,63.6,66.4,73.3,60.8,14,58.6,51.1,53.3,55.2,61.6,37.6,107,88.8,77.1,69.3,51.5,55.1,50.6,38.3,66.1,57.5
14,6,52.5,8,46.2,7.4,3.3,62.1,13.9,65,52,54.1,44.6,53.4,57.8,0,7,9.8,62.1,8.6,43.9,1.9,37.8,5.9,2.6,5,22.6,75.7,32.3,66,37.6,13.1,2.8,12.2,25.1,9.6,0.35
15,11.8,58.2,4.1,52,13.2,10.9,67.9,19.6,70.7,57.8,59.9,50.3,59.1,63.6,7,0,5.9,67.9,14.4,49.6,7.6,43.6,11.7,8.4,3.5,28.3,81.4,29.3,71.8,43.3,18.8,8.5,17.9,30.8,5.6,6.6
16,14.6,61,4.7,54.8,16,13.7,70.7,22.5,73.6,60.6,62.8,53.2,62,66.4,9.9,5.9,0,70.8,17.2,52.5,10.5,46.4,14.5,11.2,6.4,31.2,84.3,32.1,74.6,46.2,21.7,11.4,20.8,33.7,0.6,9.5
17,60.7,67.9,74.2,61.7,57,68.5,82.8,61.5,80.4,72.7,74.9,22.4,11.6,78.5,62.2,67.9,76.1,0,65.2,64.6,62.9,60.7,57.7,64.8,66,42,112,93.2,9.7,73.7,55.9,59.5,55,42.7,70.5,67.1
18,9,55.5,15.4,49.2,10.4,9.6,65.1,15,68,55.1,57.2,47.6,56.4,60.8,8.6,14.3,17.2,65.2,0,46.9,9.3,40.8,8.9,6,12.4,25.6,78.7,39.6,69,40.6,16.1,5.9,15.2,28.1,16.9,8.3
19,42.4,8.7,50.7,2.4,38.8,44.9,18.3,43.2,21.2,10,12.2,41.7,50.5,14,43.9,49.6,52.5,59.3,46.9,0,44.6,37.2,39.4,41,47.7,23.7,93.5,74.9,63.2,55.4,37.6,41.2,36.7,24.4,52.2,43.6
20,6.7,53.1,8.7,46.9,8.1,2.8,62.9,14.6,65.7,52.8,54.9,45.3,47.9,58.5,1.9,7.6,10.5,62.9,9.3,44.6,0,38.6,6.6,3.4,5.7,23.3,76.4,32.9,66.7,38.3,13.8,3.4,12.9,25.7,10.2,2
21,36.3,45.7,44.6,39.5,32.7,38.9,55.4,37.1,58.2,23.4,47.5,37.9,40.4,51.1,37.8,43.6,46.4,55.5,40.8,37.2,38.5,0,33.3,35.2,41.6,17.6,87.4,68.9,59.3,49.3,32.5,35.1,30.6,14.7,46.2,37.5
22,4.4,47.9,12.7,41.7,2.9,7,57.6,11.9,60.5,47.5,49.5,40.1,42.7,53.3,5.9,11.7,14.5,57.7,8.9,39.4,6.7,33.3,0,3.3,9.7,18,71.2,37,61.5,33.1,8.6,3.2,7.6,20.5,14.3,5.6
23,3.4,49.8,9.4,43.6,4.8,3.6,59.5,11.3,62.4,49.4,51.6,42,44.6,55.2,2.6,8.4,11.2,59.6,6,41.3,3.4,35.2,3.3,0,6.4,19.9,73.1,33.6,63.4,35,10.5,0.13,9.5,22.4,5.6,2.3
24,9.8,56.2,4.1,50,11.2,8.9,65.9,17.7,68.8,55.8,58,48.4,51,61.6,5,3.5,5.9,66,12.4,47.7,5.7,41.6,9.7,6.4,0,26.4,79.5,27.4,69.8,41.4,16.9,6.6,16,28.9,5.6,4.7
25,21,32.2,29.3,26,17.4,23.6,41.9,21.8,44.8,31.9,34,24.4,27,37.6,22.6,28.3,31.2,42,25.6,23.7,23.3,17.6,18,19.9,26.3,0,72.1,53.6,45.8,34,16.2,19.8,15.3,4.9,5.6,22.2
26,74.2,102,82.5,95.8,70.5,76.7,112,74.9,115,102,104,94.2,96.8,107,75.7,81.4,84.3,112,78.7,93.5,76.4,87.4,71.2,73.1,79.5,72.1,0,107,118,36.5,69.3,72.9,68.4,74.6,84,75.3
27,51.5,83.5,59.8,78.1,47.8,36.2,93.1,52.3,96.8,83.1,60.4,76.4,78.2,89.7,53,29.3,33,93.2,40.5,74.9,33.8,68.9,48.5,34.5,28.2,32.8,103,0,15.1,69.4,46.7,34.6,45.7,56.9,61.3,31.9
28,64.5,71.7,72.8,65.5,60.9,67.1,81.4,65.3,84.2,71.3,73.5,26.2,18.9,77.1,66,71.8,74.6,9.7,69,63.2,66.8,59.3,61.5,63.4,69.8,45.8,116,97.1,0,77.5,59.7,63.3,58.8,46.5,74.3,65.7
29,36.1,63.9,44.3,57.7,32.4,38.6,73.6,36.8,76.5,63.5,65.7,56.1,58.7,69.3,37.6,43.3,46.2,73.7,40.6,55.4,38.3,49.3,33.1,35,41.4,34,36.5,68.6,77.5,0,31.2,34.8,30.3,36.5,45.9,37.2
30,11.9,46.1,20.2,39.9,8.3,14.1,55.8,12.7,58.7,45.7,47.9,38.3,40.8,51.5,13.4,18.8,22,55.9,16.4,37.6,14.2,31.5,8.9,10.8,17.2,16.2,69.4,44.4,59.7,31.3,0,10.7,0.9,18.7,21.7,12.7
31,3.3,49.7,9.5,43.5,4.7,3.8,59.4,11.2,62.2,49.3,51.5,41.8,44.4,55.1,2.8,8.5,11.3,59.5,5.9,41.2,3.5,35.1,3.2,0.13,6.5,19.8,72.9,33.8,63.3,34.8,10.3,0,9.4,22.3,11.1,2.4
32,11.2,45.2,19.4,39.1,7.5,13.2,54.9,11.9,57.9,44.8,47.1,37.5,39.9,50.7,12.7,17.9,21.3,55,15.7,36.7,13.4,30.6,8.1,10,16.5,15.5,68.6,43.7,59,30.5,0.9,9.9,0,18,21,11.8
33,23.5,32.9,31.8,26.7,19.9,26.1,42.6,24.3,45.5,19.8,34.7,25.1,27.6,38.3,25.1,30.8,33.6,42.7,28.1,24.4,25.8,14.7,20.5,22.4,28.8,4.9,74.6,56.1,46.5,36.5,18.7,22.3,17.8,0,33.4,24.7
34,14.4,60.8,4.5,54.6,15.7,13.5,70.4,22.2,73.3,60.4,62.5,52.9,55.5,66.1,9.6,5.6,0.6,70.5,16.9,52.2,10.2,46.2,14.3,10.9,6.1,30.9,84,31.9,74.4,45.9,21.4,11.1,20.5,33.4,0,9.2
35,5.7,52.1,7.7,45.9,7.1,3.6,61.8,13.6,64.6,51.7,53.8,44.2,46.8,57.5,0.35,6.6,9.5,61.8,8.3,43.6,2,37.5,5.6,2.3,4.7,22.2,75.3,31.9,65.7,37.2,12.7,2.4,11.8,24.7,9.2,0
ID_City,City
0,Pantai BUL BUL
1,BUKIT travel Gibeon
2,Pakkodian
3,Taman Eden 100 Tobasa
4,Water Park Tambunan
5,Bukit Pahoda
6,Bukit Senyum
7,Air Terjun Pandumaan
8,Long Beach
9,PANTAI AGADON
10,Situmurun Waterfall
11,Simanimbo Waterfall
12,Air Terjun Sigura Gura
13,The Kaldera
14,Museum T. B. Silalahi Center
15,Bukit Tarabunga
16,Pantai Meat
17,Air Terjun Sialogo
18,Air Terjun Siboruon
19,Gunung Pangulubao
20,Lumban Silintong
21,Siregar Aek Nalas
22,Pantai Janji Maria
23,Balerong Onan Balige
24,Dolok Tolong
25,Pantai Pasir Putih Parparean
26,Dolok Surungan
27,Air Terjun Sampuran
28,Air Terjun Morena
29,Tornagodang
30,Hatulian Beach
31,Monumen Raja Sonakmalela
32,Lumban Binanga Beach
33,Pantai Pasifik Porsea
34,Desa Adat Ragi Hotang
35,Makam Raja Sisingamangaraja XII
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analisis Masalah\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Source Code, "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import math\n",
"import random\n",
"import time\n",
"import pandas as pd\n",
"import csv\n",
"import sys\n",
"import datetime\n",
"import timeit"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"start = datetime.datetime.strptime(\"21-07-2020\", \"%d-%m-%Y\")\n",
"end = datetime.datetime.strptime(\"22-07-2020\", \"%d-%m-%Y\")\n",
"date_generated = [start + datetime.timedelta(days=x) for x in range(0, (end-start).days)]\n",
"#print(len(date_generated))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"cost = 400000\n",
"Cost = int(cost)\n",
"min_cost = 399333"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"Weather = 26.897694"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"class Fitness_value:\n",
" def getting_max_distance():\n",
" max_distance = 0 \n",
" max_distance += len(date_generated) * 720\n",
" return max_distance\n",
" def getting_max_cost():\n",
" max_cost = 0\n",
" max_cost +=Cost\n",
" return max_cost"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"#Load dataset sebelum integrasi\n",
"#Datax = pd.read_csv('./Yolanda/tri/Data Toba Samosir_Sheet3.csv')\n",
"#Datax.drop(Datax.filter(regex=\"Unname\"),axis=1, inplace=True)\n",
"Datax = pd.read_csv('./Data Toba Samosir_Sheet3.csv')\n",
"Datax.drop(Datax.filter(regex=\"Unname\"),axis=1, inplace=True)\n",
"Dataz = pd.read_csv('./List_city.csv')\n",
"Dat = Datax.to_numpy()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 0. , 50.9, 12.8, ..., 22.5, 14.4, 5.7],\n",
" [50.9, 0. , 59.2, ..., 32.9, 60.8, 52.1],\n",
" [12.8, 59.2, 0. , ..., 31.8, 4.5, 7.7],\n",
" ...,\n",
" [23.5, 32.9, 31.8, ..., 0. , 33.4, 24.7],\n",
" [14.4, 60.8, 4.5, ..., 33.4, 0. , 9.2],\n",
" [ 5.7, 52.1, 7.7, ..., 24.7, 9.2, 0. ]])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Dat"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"#id_city = list(Dataz['ID_City'])\n",
"#path = random.sample(range(len(id_city)), 7)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"#Datax = pd.read_csv('./Yolanda/tri/Data Toba Samosir_Sheet1.csv')\n",
"#Datax.drop(Datax.filter(regex=\"Unname\"),axis=1, inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"def generate_start_nodes (individu,n_kota):\n",
" \"\"\"\n",
" :param individu:(int) jumlah semut\n",
" :param n_kota :(int) jumlah kota\n",
" :return : tabulist yang masih berisi start (dan end) node untuk semua individu semut\n",
" \"\"\"\n",
" start_nodes= []\n",
" for i in range (individu): \n",
" start_nodes.append([0 for i in range(n_kota+1)])\n",
" start_nodes[-1][0] = random.randint(0,(n_kota-1))\n",
" start_nodes[-1][-1] = start_nodes[-1][0]\n",
" return start_nodes"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"def evaluate_best_city (kota_sekarang, matriks_jarak ,tau, tabulist, alpha, beta):\n",
" \"\"\"\n",
" Mengevaluasi kota terbaik yang memungkinkan berdasarkan probabilitas dan tabulist\n",
" :param kota_sekarang: (int 0..15) \n",
" :param tabulist : (int[0..15]) merupakan kota yang sudah pernah dikunjungi oleh semut\n",
" :param tau : (list) intensitas pheromon pada \n",
" :param matriks_jarak: (matriks[16][16]) matriks yang berisi jarak antar kota\n",
" :return : kota dengan probabilitas tertinggi\n",
" \"\"\"\n",
" probability = [0] * np.size(matriks_jarak[1])\n",
" allowed = []\n",
" allowed[:] = [x for x in range(np.size(matriks_jarak[1])) if x not in tabulist]\n",
" p = 0\n",
" for i in allowed:\n",
" visibility = 1/matriks_jarak[kota_sekarang][i]\n",
" p += (tau[kota_sekarang][i]**alpha)*(visibility**beta)\n",
" for i in allowed:\n",
" visibility = 1/matriks_jarak[kota_sekarang][i]\n",
" probability[i] = (tau[kota_sekarang][i]**alpha)*(visibility**beta)/p\n",
" tmp = max(probability)\n",
" return probability.index(tmp)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"def update_tau(individu, tau, tabulists, L, evaporation_coeff, Q,n_kota):\n",
" \"\"\"\n",
" :param evaporation: koefisien evaporation\n",
" :param tau : matriks tau seukuran kota x kota\n",
" :param L : matriks/array[1x16] yang mengandung informasi jarak tour yang\n",
" dihasilkan oleh satu semut\n",
" :param delta_tau : matriks seukuran kota x kota\n",
" :return : tau yang baru\n",
" \"\"\"\n",
" for i in range (individu):\n",
" for j in range (n_kota):\n",
" delta_tau = Q/L[i]\n",
" tau[tabulists[i][j],tabulists[i][j+1]] = evaporation_coeff * tau[tabulists[i][j],tabulists[i][j+1]] + delta_tau\n",
" return (tau)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"def hitung_jarak_1_rute(single_solution,matriks_jarak):\n",
" \"\"\"\n",
" :param single_solution: Sebuah tabulist dari seekor semut (1 solusi) [0..16]\n",
" :param matriks_jarak : matriks jarak antar node\n",
" :return : Total jarak yang dihasilkan solusi tersebut\n",
" \"\"\"\n",
" jarak = 0\n",
" for i in range (len(single_solution)-1):\n",
" jarak += matriks_jarak[single_solution[i]][single_solution[i+1]] \n",
" return (jarak)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"def compute_shortest_distances(tabulists, matriks_jarak):\n",
" \"\"\"\n",
" :param tabulists: Tabulist sejumlah individu x banyak kota\n",
" :return : tuple (jarak terkecil yang di temukan (float)\n",
" rute dengan jarak terkecil (list),\n",
" list jarak (L)(list)\n",
" rata2 jarak yang ditemukan (float))\n",
" :>>>(min_dist,route,L,rerata)\n",
" \"\"\"\n",
" distances = []\n",
" distances = [0] * len(tabulists)\n",
" for i in range(0,len(tabulists)):\n",
" distances[i] = hitung_jarak_1_rute(tabulists[i],matriks_jarak)\n",
" L = distances\n",
" L = L- 0.97*min(L)\n",
" return (min(distances) , tabulists[distances.index(min(distances))] , L, np.mean(distances))"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"#tabulists"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"Maximum_distance = Fitness_value.getting_max_distance()\n",
"Maximum_cost = Fitness_value.getting_max_cost()\n",
"TARGET_weather = Weather\n",
"CITY_COUNT = len(Datax)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"400000"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Maximum_cost"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Route : [2, 14, 35, 20, 31, 23, 5, 2]\n",
"17.68 , 399333 , 26.897694\n",
"\n",
"\n",
"17.68\n"
]
}
],
"source": [
"running = 1\n",
"global_distance = []\n",
"\n",
"for run in range (running):\n",
" iterasi = 300\n",
" alpha = 2 #jejak pheromon\n",
" beta = 2#visibility\n",
" individu = 40\n",
" n_kota = 7\n",
" evaporation_coeff = 0.1\n",
" Q = 1\n",
" nodelist = []\n",
"\n",
" matriks_jarak = Dat\n",
" tau = np.ones(np.shape(matriks_jarak))*0.5 #init. intensitas pheromon/jejak pada busur\n",
" delta_tau = np.zeros((n_kota,n_kota))\n",
"\n",
" shortest_distance = math.inf #infinit\n",
"\n",
" shortest_route = []\n",
" average = []\n",
" for i in range (iterasi):\n",
" tabulists = generate_start_nodes(individu,n_kota)\n",
" for j in range (1,n_kota):\n",
" for k in range (individu):\n",
" tabulists[k][j] = evaluate_best_city(tabulists[k][j-1],matriks_jarak,tau, tabulists[k],alpha,beta)\n",
" min_dist,route,L,rerata = compute_shortest_distances(tabulists,matriks_jarak)\n",
" average.append(rerata)\n",
"\n",
" if ((shortest_distance > min_dist) and (shortest_distance > Maximum_distance) and (min_cost <=Maximum_cost) and ((Weather >=18) and (Weather <=28))):\n",
" shortest_distance = min_dist\n",
" shortest_route = route\n",
"\n",
" tau = update_tau(individu, tau, tabulists, L, evaporation_coeff, Q,n_kota)\n",
"\n",
" print (\"Route : \",route)\n",
" print (shortest_distance,\",\",min_cost,\",\",Weather)\n",
" global_distance.append(shortest_distance)\n",
" print(\"\\n\")\n",
"\n",
"for shortest in global_distance:\n",
" print (shortest) \n",
"\n",
"\n",
"#print (\"Rata-rata rute terpendek yang dihasilkan: \",np.average(global_distance))\n"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[2, 14, 35, 20, 31, 23, 5, 2]"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"route"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"def decoding_ACO():\n",
" name = 0\n",
" for i in range(len(route)):\n",
" name = route[i]\n",
" print(Dataz.iloc[name][1])\n",
" i+=1\n",
" return "
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Pakkodian\n",
"Museum T. B. Silalahi Center\n",
"Makam Raja Sisingamangaraja XII\n",
"Lumban Silintong\n",
"Monumen Raja Sonakmalela\n",
"Balerong Onan Balige\n",
"Bukit Pahoda\n",
"Pakkodian\n"
]
}
],
"source": [
"decoding_ACO()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
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