Commitv3

parent d11f1263
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 30,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
...@@ -307,24 +307,39 @@ ...@@ -307,24 +307,39 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Route : [2, 14, 35, 20, 31, 23, 5, 2]\n", "Route : [4, 23, 31, 14, 32, 4]\n",
"17.68 , 399333 , 26.897694\n", "27.43 , 399333 , 26.897694\n",
"\n", "\n",
"\n", "\n",
"17.68\n" "Route : [4, 31, 23, 32, 15, 4]\n",
"45.42999999999999 , 399333 , 26.897694\n",
"\n",
"\n",
"Route : [2, 35, 14, 20, 16, 2]\n",
"25.150000000000002 , 399333 , 26.897694\n",
"\n",
"\n",
"Route : [2, 35, 23, 31, 15, 2]\n",
"22.730000000000004 , 399333 , 26.897694\n",
"\n",
"\n",
"Route : [2, 16, 24, 18, 7, 2]\n",
"59.3 , 399333 , 26.897694\n",
"\n",
"\n"
] ]
} }
], ],
"source": [ "source": [
"running = 1\n", "running = 5\n",
"global_distance = []\n", "global_distance = []\n",
"\n", "\n",
"for run in range (running):\n", "for run in range (running):\n",
" iterasi = 300\n", " iterasi = 50\n",
" alpha = 2 #jejak pheromon\n", " alpha = 2 #jejak pheromon\n",
" beta = 2#visibility\n", " beta = 2#visibility\n",
" individu = 40\n", " individu = 40\n",
" n_kota = 7\n", " n_kota = 5\n",
" evaporation_coeff = 0.1\n", " evaporation_coeff = 0.1\n",
" Q = 1\n", " Q = 1\n",
" nodelist = []\n", " nodelist = []\n",
...@@ -352,12 +367,12 @@ ...@@ -352,12 +367,12 @@
" tau = update_tau(individu, tau, tabulists, L, evaporation_coeff, Q,n_kota)\n", " tau = update_tau(individu, tau, tabulists, L, evaporation_coeff, Q,n_kota)\n",
"\n", "\n",
" print (\"Route : \",route)\n", " print (\"Route : \",route)\n",
" print (shortest_distance,\",\",min_cost,\",\",Weather)\n", " print (min_dist,\",\",min_cost,\",\",Weather)\n",
" global_distance.append(shortest_distance)\n", " global_distance.append(shortest_distance)\n",
" print(\"\\n\")\n", " print(\"\\n\")\n",
"\n", "\n",
"for shortest in global_distance:\n", "#for shortest in global_distance:\n",
" print (shortest) \n", "# print (shortest) \n",
"\n", "\n",
"\n", "\n",
"#print (\"Rata-rata rute terpendek yang dihasilkan: \",np.average(global_distance))\n" "#print (\"Rata-rata rute terpendek yang dihasilkan: \",np.average(global_distance))\n"
...@@ -365,16 +380,16 @@ ...@@ -365,16 +380,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 32,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"[2, 14, 35, 20, 31, 23, 5, 2]" "[2, 16, 24, 18, 7, 2]"
] ]
}, },
"execution_count": 19, "execution_count": 32,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -385,7 +400,16 @@ ...@@ -385,7 +400,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#route = []"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -400,7 +424,7 @@ ...@@ -400,7 +424,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 37,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -408,12 +432,10 @@ ...@@ -408,12 +432,10 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Pakkodian\n", "Pakkodian\n",
"Museum T. B. Silalahi Center\n", "Pantai Meat\n",
"Makam Raja Sisingamangaraja XII\n", "Dolok Tolong\n",
"Lumban Silintong\n", "Air Terjun Siboruon\n",
"Monumen Raja Sonakmalela\n", "Air Terjun Pandumaan\n",
"Balerong Onan Balige\n",
"Bukit Pahoda\n",
"Pakkodian\n" "Pakkodian\n"
] ]
} }
...@@ -428,13 +450,6 @@ ...@@ -428,13 +450,6 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {
......
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