Determining the Optimal Rice Distribution Route in Medan City Using Dijkstra's Algorithm

Distribution is an activity carried out to spread the product throughout the market so that consumers can buy it. Distribution can also affect the price of goods. Therefore, the distribution must be effective. The purpose of this study is to determine the shortest route that is effective in distribution so that product prices are not high and the company does not suffer losses. The data analysis method used is Dijkstra's Algorithm obtained with data on the distance between the starting point and the destination point through predetermined points. The calculation results show that the shortest and fastest routes to be taken based on the dijkstra algorithm are: A-20-19-F-26-C-D-11-12-B-E with a distance of 40.71 km. There are several road routes that can be chosen to be used but the shortest route that can be taken is 40.71 km. Medan Rice Distributors are expected to choose the shortest transportation route so that rice distribution can be carried out quickly and optimally.


Introduction
Distribution is a familiar term in the world of economics. Because distribution is an important part of the world economy. Therefore, the problem of distribution of goods is one of the important aspects that need to be considered by every freight forwarding company. The occurrence of distribution constraints can even cause losses to the company or producer. With distribution, the production will reach consumers who are located quite far away. Therefore, the distribution must use the optimal route, but not all companies use the method in dealing with the problem of the optimal distribution route. To be able to choose the optimal route, it is necessary to know the distance between the destinations. Then the optimal path is chosen from the starting point to the destination point. But this is often not helpful because of the large number of roads that exist, resulting in many choices of routes that can be taken. Because it must be selective in choosing a short and efficient path, not tortuous, can save time and costs. And not only that, a good distribution must also determine the utility/vehicle to be used. For that, we need an algorithm that is able to handle the problem of finding a route that is able to handle the problem of finding the shortest route.
Such as the distribution of rice carried out at the Medan City Rice Distributor. The company has several distribution points in the city of Medan. Distribution is carried out from the Medan City Rice Distributor to several supermarkets as distribution points. Distribution is carried out at different locations so that a travel route is needed from one delivery location to another. The route used by the Medan City Rice Distributor is still done manually without regard to distance or other routes that might be the shortest route. This is a deficiency in the distribution route determination system. To determine the shortest route optimally, the method can be used. There are many algorithms that can solve this problem, including the Dijkstra algorithm, the Floyd-Warshall algorithm, and the Bellman-Ford algorithm.
From the explanation above regarding the importance of implementing distribution in a company and seeing the many methods that can solve these problems, the researchers consider it necessary to review the distribution problem at the Medan City Rice Distributor. For this reason, in writing this final project, the researcher is interested in taking the title of "determination of the shortest route for transporting field rice using the dijkstra algorithm method.

Distribution
Distribution is a marketing activity that seeks to facilitate and facilitate the delivery of products and services from producers to consumers so that their use is appropriate (type, quantity, price, and place) as needed. The most effective distribution will facilitate the flow or access of goods by consumers so that they can be obtained easily. In addition, consumers will also get goods in accordance with what is needed. Basically the distribution function is segmenting, determining the mode of transportation used, scheduling and determining routes, adding value services, storing inventory, and handling retrieval. In general, distribution systems can be divided into two types, namely: direct distribution systems and indirect distribution systems. Direct distribution systems distribute goods directly from producers to consumers. The distribution system does not directly use an intermediary (middleman) so that it does not directly meet consumers.

Shortest Path
The shortest path is the minimum path required to reach a place from a certain place. The minimum path in question can be found by using a graph. A graph is a set of points in a two-dimensional plane connected by a set of edges. A graph is formed from a set of vertices connected by edges. There are several terms related to graphs, including:  These points are called vertices.  The lines connecting the vertices are called edges.  Adjacent means neighbor. That is, if there are two vertices called adjacent, if they have the same edge.  Paths are paths that pass through edges and vertices in a graph.  A cycle is a path that starts and ends at the same vertex.  Direct on a directed graph where the edges have a direction.
The graphs used are weighted graphs, namely graphs in which each edge is assigned a value. There are several kinds of shortest path problems (Mukti et a., 2018), including:  The shortest path between two specific vertices (a pair shortest path).  The shortest path between all pairs of vertices (all pairs shortest path).  The shortest path from a certain vertex to all other vertices (single source shortest path).  The shortest path between two vertices that pass through certain vertices (intermediate shortest path) In determining the shortest route, these locations form a graph. The steps are as follows (Nawagusti, 2018):  Combine each vertex of each route into a connected graph.  Give the direction of travel on the route as a flow so that a directed graph is formed from the existing connected graph.  Data from the mileage obtained is converted into the weight of the distance. Apply the distance weights as a directed graph load flow so as to form a weighted graph.

Application of Dijkstra's Algorithm
Dijkstra's algorithm is an algorithm used to solve the shortest path problem for a directed graph. Look at the graph below. A person wants to travel from city s (source) to city t (destination). There are several alternative routes that can be traversed, namely through city 1 or city 2 or city 3 and then city t If the numbers on the arc of the graph indicate the distance between two cities connected by the respective road segment, find the shortest path that can be taken from city s to city t. The shortest path problem can be solved by Dijkstra's algorithm. According to this algorithm, each node is marked, for example, marked with an X and not marked with an X. If a node is found to be part of the shortest path, then the node and arc leading to that node are marked with an X. This algorithm consists of a three-step procedure that done repeatedly to find the shortest distance starting from the initial node s gradually to the node t.
Suppose that from node s there are m nearby nodes that can be selected when departing from s. Since there are m nodes in front of node s, there are m routes to choose from when departing from s. Choose the shortest route m of these routes. Suppose that for the moment this selected route is the shortest route from s to y. Put an X on the node s and arc (s,y). Now determine which node is the (m+1)th node closest to node s? The closest (m+1) node to node s is a node that has not been marked with an X, that is, a node that is temporarily considered to have the shortest route from node s to node (m+1) must use or traverse the node that has been marked X as a among node.
If the m nodes closest to node s are known, the node to (m+1) can be searched in the manner described above, starting from m=0. The process is repeated until the shortest route from s to t has been obtained. For further explanation, Dijkstra's algorithm can be described in the following steps: Step 1: First of all, all nodes and arcs are not marked with X. Number d(x) for each node to indicate the length of the shortest route from node s to node x.
Step 2: For each node x that has not been marked with an X, determine d(x) as follows: d(x) = Min {d(x), d(y) + a(y,x)} If d(x) = ∞ for all x that is not marked X then the iteration is stopped because there is no route from s to any node that has not been marked with the X. If d(s) ≠ ∞ then put an X on the node x which has the smallest d(x). Also color the arc that goes directly to the x node from the colored node where the d(x) minimum was found, for example y=x.
Step 3: If node t has been marked with X, the iteration process is stopped because all the shortest routes from s to t have been found. If node t has not been marked with an X, go back to step 2

Methodology
The type of research used in this research is descriptive research. This is because this study describes a problem that exists and then provides a proposal as the final result and conclusion. The location where the research was conducted is in the city of Medan with the starting point being at the Rice Distributor in Medan City, which is located at Jl. Sei Snake Baru, Babura Sunggal, Kec. Medan Sunggal, Medan City, North Sumatra. The object observed in this study is the route data and the system used in determining the fastest route

Results and Discussion
Based on research using the dijkstra algorithm, the following data is needed: a. The company studied was only 1 rice distributor. b. The locations studied were only those in the city of Medan. c. The data provided is the location points and the distance between the points based on Google Maps.

Figure 2. Medan Rice Distributors
The nodes are the location of crossroads, small shops, places to eat and also shops that sell services. The entered nodes are then numbered along with letters to make it easier to identify the location on the graph.

Merdeka Walk
The route modeling that is the subject of the study is to make an algorithmic calculation from node A which is the Medan Rice Distributor as the initial location for reading to several nodes as the destination for rice distribution, namely node B, node C, node D, node E and node F. From the results of the calculation With these results, one shortest route will be generated that will pass through node B, node C, node D, node E and node F so that rice can be distributed faster and does not take longer. Due to the nature of Dijkstra, which is greedy, where the calculation process is imposed on all existing nodes, for ease of calculation of this rice transportation route, a Bounding Box is used, namely by selecting only certain nodes in the same direction where the node is most likely to be traversed or passed in one direction. reading route. This makes Dijkstra's calculations faster and more efficient. For example, for the transportation route from node A to node F, the nodes included in the bounding box are node 2, node 3, node 4, node 5, node 19, node 20, node 26 and node F. For transport routes from node A to node C, the nodes included in the bounding box are node 2, node 3, node 4, node 5, node 6, node 20, node 26 and node C. In this calculation, it is necessary to determine the shortest route from node A to node closest. There are two closest nodes from A, namely node C and node, it is necessary to calculate the route from node A to node C and node A to node respectively. The calculation of Dijkstra's algorithm from point A to point F is as follows:  ,20) are marked with arrows. The shortest route is from node A to node 20. Node F has not been marked with an X so go back to step 2. Since d(1) = 4.38 is the smallest of all, node 1 is marked with an X and arc(A,1) is marked with an arrow. Node F has not been marked with an X so go back to step 2. Since d(4) = 8.26 is the smallest of all, node 4 is marked with an X and arc(1,4) is marked with an arrow. Node F has not been marked with an X so go back to step 2. Since d(5) = 10.60 is the smallest of all, node 5 is marked with an X and arc(4,5) is marked with an arrow. Node F has not been marked with an X so go back to step 2. Since d(2) = 8.60 is the smallest of all, node 2 is marked with an X and arc(1,2) is marked with an arrow. However, node 2 is only connected to node 5. So put an X on node 5 and an arrow on arc(2,5). And y=5 is calculated again, so d(26)=12.34 is the smallest, then it is marked X at node 26 and arc(5,26) is marked X. Node F has not been marked with an X so go back to step 2. Node F has not been marked X so go back to step 2.  It has been obtained that d(F) = 10.65 is the shortest route, then it is marked with an X at node F and an arrow is given to arc(19,F). The final result is that the shortest route from node A to node F is A-20-19-F. Figure 11. Graph of Rice Transport Node Distribution step 7 The calculation of Dijkstra's algorithm from point A to point C is as follows:  ,20) are marked with arrows. The shortest route temporarily is from node A to node 20. Node F has not been marked with an X so go back to step 2. Since d(1) = 4.38 is the smallest of all, node 1 is marked with an X and arc(A,1) is marked with an arrow. Node F has not been marked with an X so go back to step 2. Since d(4) = 8.26 is the smallest of all, node 4 is marked with an X and arc(1,4) is marked with an arrow. Node F has not been marked X so go back to step 2. Since d(5) = 10.60 is the smallest of all, node 5 is marked with an X and arc(4,5) is marked with an arrow. Node F has not been marked X so go back to step 2. Since d(2) = 8.60 is the smallest of all, node 2 is marked with an X and arc(1,2) is marked with an arrow. However, node 2 is only connected to node 5. So put an arrow on arc(2,5  It has been obtained that d(C) = 16.43 is the shortest route, so it is marked with an X at node F and an arrow is given to arc (6,C). The final result is that the shortest route from node A to node F is A-1-4-5-6-C. Figure 18. Graph of Rice Transport Node Distribution Obtained d(F) = 10.65 and d(C) = 16.43, then the shortest route to be used is from node A to node F, namely A-20-19-F with a distance of 10.65. The shortest route from node F to node C = F-26-C is 3.77 + 2.58 = 6.35 Shortest route from node C to node D = 4.23 Shortest route from node D to node B = D-11-12-B = 1.52+ 5.09 + 4.77 = 11.38 Shortest route from node B to node E = 4.77 + 3.33 = 8.10 Then the shortest route that can be passed is A-20-19-F-26-C-D-11-12-B-E with a distance of 10.65 + 6.35 + 4.23 + 11.38 + 8.10 = 40.71

Conclusion
Based on the analysis and calculation results, conclusions are obtained. This study uses the Dijkstra algorithm to determine the shortest route from the Medan City Distributor to several supermarket locations. The calculation results show that the shortest and fastest routes to be taken based on the dijkstra algorithm are: A-20-19-F-26-C-D-11-12-B-E with a distance of 40.71 km. Medan Rice Distributors are expected to choose the shortest transportation route so that rice distribution can be carried out quickly and optimally. The Medan Rice Distributor is expected to coordinate with drivers who drive rice transportation vehicles regarding the shortest route to be taken so that the rice distribution process can be carried out optimally and on time.