0% found this document useful (0 votes)
28 views55 pages

Major Project Report Group 9

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views55 pages

Major Project Report Group 9

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 55

.

CHAPTER-1
INTRODUCTION

The logistics industry involves the transportation of goods from one place to another. The
movement of goods involves various challenges, including finding the optimal path for
logistics vehicles. In this project report, we explore the use of Ant Colony Optimization
(ACO) to address this challenge. ACO is a heuristic algorithm that is inspired by the behavior
of ants when they search for food. The objective of this project is to develop an ACO-based
algorithm that can identify the optimal path for logistics vehicles.

Nowadays, e-commerce has created its means into a clicks-and-mortar era; during this day
associated with the age of on-line looking, going “mobile shopping” on mobile devices has
become the thought mode. With shopping changing into so convenient, several ecommerce
platforms have adopted a multi-channel approach to product promotion and marketing. The
increase of e-commerce businesses has also brought a flow of demand to supplying
businesses; nevertheless, despite the demand, thanks to massive capital investments yet with
increasing labor and material costs, the logistics trade is really facing low profits. The optimal
path selection, finally all comes down to the short-circuit problems of the transportation
network. The optimal path based on short-circuit always is a hotspot of computer science,
logistics and transportation engineering, and geographical information science. With the
shortest path, the disorder traffic becomes orderly, traffic flow distribution will be optimized
and the blindness of travel is reduced. It will improve the efficiency of the urban road
network. For the huge traffic network, some algorithms must be adopted to search for an
optimal path.

One way to tackle this downside is to utilize algorithms reminiscent of massive knowledge
analysis or AI (AI) to assist cut back transportation prices by optimizing travel routes,
reducing fuel consumption, and dispatching vehicles effectively whereas navigation systems
presently offered on the market are capable of route designing, the shortest path isn't
continually the optimum path. Several navigation systems calculate period based mostly on
period of time road ordinance or road length (distance); however, alternative factors such as

1
flow of cars throughout peak hours or real-time weather would possibly lead to traffic jams
associated with delayed travel time. Therefore, an optimum route will solely be known by
taking into thought a spread of factors. Idle driving ensuing from an ineffective travel route
won't only waste fuel consumption; however, it additionally cuts back transportation
efficiency; thus, we'd like higher ways to enhance transportation routes for supplying
vehicles.

In recent years, the rapid growth of urbanization and the increasing complexities of modern
cities have presented significant challenges for residents and commuters. Navigating through
crowded streets, finding optimal routes, and efficiently accessing various amenities have
become increasingly daunting tasks. Fortunately, advancements in Artificial Intelligence (AI)
have revolutionized the way we address these challenges, offering novel solutions to enhance
city navigation and transform urban mobility.

This project report aims to explore and analyze the implementation of AI-based city
navigation systems as a means to improve the efficiency and convenience of urban
transportation. By leveraging the power of AI algorithms, machine learning techniques, and
real-time data, these systems can intelligently guide users through complex urban
environments, optimizing routes, reducing travel times, and minimizing congestion.The
primary objective of this project is to design, develop, and evaluate an AI-based city
navigation system that caters to the unique requirements of modern cities. This system will
utilize advanced AI algorithms to analyze large volumes of data from diverse sources,
including GPS signals, traffic sensors, public transportation schedules, and user preferences.
By integrating these datasets, the navigation system will provide users with personalized,
efficient, and accurate recommendations for reaching their destinations. Additionally, this
report will delve into the underlying technologies and methodologies that enable the
functioning of AI-based city navigation systems. It will explore the utilization of machine
learning algorithms for real-time traffic prediction, intelligent routing algorithms for
optimizing travel routes, and user-centric interfaces for intuitive navigation experiences. The
report will also address the ethical considerations, privacy concerns, and social implications
associated with implementing AI in urban navigation.

Furthermore, the project aims to evaluate the performance and effectiveness of the AI-based
city navigation system through extensive simulations and real-world testing. By collecting
and analyzing user feedback, traffic data, and performance metrics, we will assess the

2
system's impact on improving travel efficiency, reducing congestion, and enhancing the
overall urban mobility experience.

In conclusion, this project report seeks to highlight the transformative potential of AI-based
city navigation systems in addressing the complex challenges of urban transportation. By
harnessing the power of AI, we can create intelligent navigation systems that empower users,
optimize traffic flows, and contribute to the development of sustainable and livable cities.
The insights gained from this project will not only advance our understanding of AI-based
navigation but also lay the foundation for future innovations in urban mobility.

3
CHAPTER-2
LITERATURE REVIEW

The optimal path for logistics vehicles plays a crucial role in the efficient and effective
operation of logistics networks. Therefore, finding an optimal path for logistics vehicles has
been a subject ofinterest for researchers for a long time. In recent years, Artificial Intelligence
(AI) has been widely used in logistics and supply chain management to solve various
problems such as route optimization, inventory management, and demand forecasting. In this
literature review, we will discuss various studies that have been conducted to find the optimal
path for logistics vehicles using AI.
The fast pace of developments in computing (AI) is providing new opportunities to boost the
performance of various industries associated with businesses, as well as transport sector. The
innovations introduced by AI embody extremely advanced processes that mimic the approach
the human brain works on. The application of AI within the transport field is aimed toward
overcoming the challenges of an increasing travel demand, greenhouse emission emissions,
safety issues, and environmental degradation. In light of the supply of a large quantity of
quantitative and qualitative knowledge and AI during this digital age, addressing these
concerns in an economical and effective fashion has become additionally plausible. samples
of AI ways that are finding their thanks to the transport field embody Artificial Neural
Networks (ANN), Genetic algorithms (GA), Simulated hardening (SA), Artificial system
(AIS), Ant Colony Optimizer (ACO) and Bee Colony optimization (BCO) and symbolic
logic Model (FLM) The in application of AI needs an honest understanding of the
relationships between AI and knowledge on one hand, and installation characteristics and
variables on the opposite hand. Moreover, it's promising for transport authorities to see the
way to use these technologies to make a fast improvement in relieving congestion, creating
additional travel time for their customers and raising the social science and productivity of
their very important assets. This paper provides a summary of the AI techniques applied
worldwide to handle transportation issues principally in traffic management, traffic safety,
public transportation, and concrete mobility which will result in faster transportation of goods
with minimal cost and effort with the help of AI. The overview concludes by addressing the
challenges and limitations of AI applications in transport.

4
2.1Tools and technologies used

2.1.1 Python:

Python is a widely used interpreted, interactive, object-oriented, and high-level programming


language. Python is a garbage-collected and dynamically typed programming language.
Guido van Rossum created it between 1985 and 1990. Python source code, like Perl, is
available under the GNU General Public License (GPL).

Python supports a variety of programming paradigms, including procedural, object-oriented,


and functional languages. Python's design philosophy prioritizes code readability by
employing significant indentation.

2.1.1.1 History of Python:

Python is a popular high-level general-purpose programming language. It was created in


1991 by Guido van Rossum and is maintained by the Python Software Foundation. It was
designed with code readability in mind, and its syntax allows programmers to express
concepts in fewer lines of code.

History was about to be written in the late 1980s. It was around this time that Python
development began. Soon after, Guido Van Rossum began doing application-based work at
Centrum Wiskunde& Informatica (CWI) in the Netherlands in December 1989. It began as a
hobby project because he was looking for an interesting project to keep him occupied during
the holidays. Python is said to have achieved success in the programming language ABC
Programming Language, which interacted with the Amoeba Operating System and had
exception handling capabilities. He had previously assisted in the creation of ABC, and while
he saw some issues with ABC, he liked the majority of its features. What he did after that was
extremely clever. He had copied ABC's syntax and some of its best features. It also came
with a lot of complaints, so he completely fixed those issues and created a good scripting
language that eliminated all flaws. The name was inspired by the BBC TV show 'Monty
Python's Flying Circus,' as he was a big fan of the show and also wanted a short, unique, and
slightly unusual name Python was chosen as a mysterious name for his invention! He was the

5
"Benevolent dictator for life" (BDFL) until he stepped down as leader on July 12, 2018. He
previously worked for Google, but now he works for Dropbox.

In 1991, the language was finally released. When it was first released, it used far fewer codes
to express concepts than Java, C++, and C. Its design philosophy was also quite good. Its
primary goal is to improve code readability and developer productivity. It had more than
enough capability when it was released to provide classes with inheritance, several core data
types, exception handling, and functions.

Following are the illustrations of different versions of Python along with the
timeline.

Fig.1 History of Python

Python 2.x and 3.x are the most commonly used versions. There is a lot of competition
between the two, and they both appear to have a diverse fanbase.

This language is used for a variety of purposes, including development, scripting, generation,
and software testing. Python has been adopted by top technology companies such as
Dropbox, Google, Quora, Mozilla, Hewlett-Packard, Qualcomm, IBM, and Cisco due to its
elegance and simplicity.

6
Python has come a long way to become the world's most popular coding language. Python
has just turned 30 years old, and the Anaconda Foundation recently released pyscript, a new
feature that allows Python to be written and run in the browser, much like javascript was
previously not possible, but it still has that undiscovered charm and X factor, as evidenced by
the fact that Google users have consistently searched for Python far more than they have
searched for Kim Kardashian, Donald Trump, Tom Cruise, and other celebrities

2.1.1.2 Installation:
To obtain the most recent Python release, go to https://www.python.org/downloads/. We will
install Python 3.8.6 on our Windows operating system during this process. When we click on
the link above, we will be taken to the following page.

Step 1: Choose the Python version you want to download.

Select the download option.

Fig.2 Python Installation


Python Environment Configuration

Step 2: Select the Install Now option.

Double-click the downloaded executable file to launch the following window. Proceed by
selecting Customize installation. When you check the Add Path box, the Python path is
automatically set.

7
Fig.3 Python Environment Configuration
We can also select the chatbotsg installation option to select the desired location and features.
Another critical step is to install a launcher for all users.

Step 3: In-Process Installation

Python Environment Configuration

Try running python from the command prompt now. In the case of Python3, type python –
version.

We are prepared to collaborate with Python.

2.2 Libraries used:


2.2.1 Pandas:
Pandas is an open-source Python Library providing high-performance data manipulation and
analysis tool using its powerful data structures. The name Pandas is derived from the word
Panel Data – an Econometrics from Multidimensional data.

In 2008, developer Wes McKinney started developing pandas when in need of high
performance, flexible tool for analysis of data.

Prior to Pandas, Python was majorly used for data munging and preparation. It had very little
contribution towards data analysis. Pandas solved this problem. Using Pandas, we can
accomplish five typical steps in the processing and analysis of data, regardless of the origin of
data — load, prepare, manipulate, model, and analyze.

Python with Pandas is used in a wide range of fields including academic and commercial
domains including finance, economics, Statistics, analytics, etc.

8
Fig.4 Pandas

2.2.1.1 Key Features of Pandas:


 Fast and efficient Data Frame object with default and customized indexing.
 Tools for loading data into in-memory data objects from different file formats.
 Data alignment and integrated handling of missing data.
 Reshaping and pivoting of date sets.
 Label-based slicing, indexing and subletting of large data sets.
 Columns from a data structure can be deleted or inserted.
 Group by data for aggregation and transformations.
 High performance merging and joining of data.
 Time Series functionality.

2.2.2 Deque:
A deque (pronounced "deck") is a double-ended queue data structure in Python. It is a
versatile and efficient container that allows elements to be added or removed from both ends
with constant time complexity.
The name "deque" is short for "double-ended queue," and it reflects the main characteristic of
this data structure: the ability to efficiently append and pop elements from both ends.
Here are some key features and functionalities of a deque:
 Constant Time Operations: The deque data structure provides constant time
complexity for adding or removing elements from both ends. This means that
appending or popping elements from the left or right side of the deque takes the same
amount of time, regardless of the size of the deque.

9
 Versatility: A deque can be used as a queue, where elements are added from one end
(rear) and removed from the other end (front), or as a stack, where elements are added
and removed from the same end. It allows you to implement various data structures
and algorithms efficiently.
 Efficient Rotations: Deques support efficient rotation operations, where elements can
be shifted from one end to the other. This can be useful in scenarios where you need
to reorder or cycle elements in a collection.
 Memory Efficiency: Deques are implemented as a doubly-linked list of fixed-size
blocks, which allows them to dynamically grow and shrink without copying elements.
This makes deques memory-efficient compared to other data structures like lists when
dealing with large collections.
 Thread-Safe Operations: The deque data structure provides thread-safe operations for
multi-threaded environments. It supports atomic operations like appending or popping
elements, making it suitable for concurrent programming.
 To use deques in Python, you need to import the deque class from the collections
module. Here's an example of creating and using a deque:

Fig.5 Dequeue

Deques are a useful data structure when you need to efficiently add or remove elements from
both ends. They provide a flexible and efficient solution for implementing queues, stacks, and
other data structures in Python.

10
2.2.3 Heapq:
heapq is a Python module that provides an implementation of the heap queue algorithm, also
known as the priority queue algorithm. It is a data structure that allows efficient insertion and
extraction of elements based on their priority or value.

The heapq module provides functions to create and manipulate heaps. A heap is a binary
tree-based data structure that satisfies the heap property: for every node, the value of the
parent node is greater (or smaller) than the values of its children, according to the desired
order (min heap or max heap).

Here are some key features and functionalities:

 Priority Queue: The main use case of heapq is to create a priority queue, where
elements are inserted and extracted based on their priority or value. Elements with
higher priority (or lower value) can be efficiently extracted from the queue. It is
particularly useful for scenarios where you need to process elements in a specific
order.
 In-Place Operations: heapq operates on lists in-place, meaning that the original list is
modified during the heap operations. This allows efficient memory usage as you don't
need to create a separate data structure. It is especially useful when dealing with large
collections of data.
 Customizable Order: The order of elements in the heap can be customized by
providing a comparison function or by using custom objects with defined comparison
methods. This flexibility allows you to create heaps based on different criteria.
 Merging and Combining Heaps: heapq provides functions to merge and combine
multiple heaps into a single heap efficiently. This allows you to merge sorted
sequences or combine multiple priority queues into one.
 Heap Operations: heapq supports various operations on heaps, such as inserting
elements (heappush), extracting elements (heappop), accessing the smallest or
largest element without removal (heappushpop, heapreplace), and more. These
operations ensure the heap property is maintained while performing efficient
operations.

To use heapq, you need to import the module and call the functions provided. Here's an
example of using heapq to create and manipulate a min heap:

11
Fig.6 Heapq

2.2.4 Itertools:

Itertools is a Python module that provides a collection of tools for working with iterators and
iterable objects. It offers various functions that enable efficient iteration, combination, and
permutation of data.

The itertools module is designed to work with sequences or other iterable objects, providing
a way to generate and manipulate iterators on the fly. It avoids the need to create explicit lists
or tuples, which can be memory-intensive, and instead focuses on providing efficient and
memory-friendly iteration.

Here are some key features and functionalities of itertools:

 Infinite Iterators: itertools provides iterators that generate an infinite sequence of


values. For example, count() generates an infinite sequence of numbers, while cycle()
repeats a given sequence indefinitely. These iterators are useful when you need to
generate a potentially unbounded series of values.
 Combinatoric Generators: itertools offers functions for generating combinations and
permutations of iterable objects. For example, combinations () generate all possible
combinations of a specified length from an iterable, while permutations () generate
all possible permutations. These functions are helpful when you need to explore and
analyze the different ways elements can be combined or ordered.
 Iteration Functions: itertools provides functions that manipulate and iterate over
iterable objects. For instance, chain () combines multiple iterables into a single

12
iterable, islice() enables slicing of an iterable, and groupby() groups consecutive
elements of an iterable based on a key function. These functions help simplify
complex iteration tasks and improve code readability.
 Efficient Iteration: The functions in itertools are designed to be efficient, both in
terms of time complexity and memory usage. They generate values on the fly, often
using algorithms with low memory overhead. This makes itertools especially useful
when working with large data sets or when memory is a constraint.

2.2.5 NumPy :

NumPy is a Python-based array-processing library. It includes a high-performance


multidimensional array object as well as tools for manipulating these arrays. It is the
fundamental Python package for scientific computing. It is free and open-source software. It
has several features, the most important of which are:

 An effective N-dimensional array object


 Advanced (broadcasting) functions
 C/C++ and Fortran code integration tools
 Linear algebra, Fourier transform, and random number capabilities are all useful.

Fig.7 NumPy

In addition to its obvious scientific applications, NumPy can be used as an efficient multi-
dimensional container of generic data. Numpy can define arbitrary data types, allowing
NumPy to seamlessly and quickly integrate with a wide range of databases.

13
Distance matrix from scipy.spatial - used to create a distance matrix which contains distance
from each city to every other city in a country which is further used as an input data for ant
colony optimization.

2.2.6 Folium
Folium is a Python library used for visualizing geospatial data on interactive maps. It is built
on top of the popular mapping library, Leaflet.js, and allows users to create maps with
various features and customize them with overlays and markers.

Key features and functionalities of Folium:

 Interactive Maps: Folium enables the creation of interactive maps that can be zoomed,
panned, and interacted with by users. These maps can be displayed in Jupyter
notebooks, saved as HTML files, or embedded in web applications.
 Multiple Tilesets: Folium supports various tilesets, including OpenStreetMap,
Mapbox Bright, Mapbox Control Room, Stamen Terrain, and many more. You can
choose the tileset that best suits your needs and customize the map's appearance.
 Markers and Popups: You can add markers to the map to represent specific locations
or points of interest. Each marker can be customized with icons, colors, and tooltips.
Popups can also be associated with markers to provide additional information when
clicked.
 Vector Layers: Folium allows you to overlay vector data on your map. You can add
GeoJSON or TopoJSON data to display boundaries, shapes, or other spatial data. The
library also supports the display of choropleth maps, where regions are shaded based
on a given attribute.
 Heatmaps: Folium provides support for creating heatmaps to visualize density or
intensity information on a map. Heatmaps are useful for displaying patterns or
clustering in data, such as population density, crime rates, or sensor readings.
 Plugin Support: Folium supports various plugins that extend its functionality. These
plugins include minimaps, mouse position displays, full screen mode, and more. You
can easily add these plugins to enhance the user experience of your maps.
 Folium is built on top of the powerful data manipulation and analysis libraries of
Python, such as NumPy and Pandas. It offers a simple and intuitive API, making it
easy to create visually appealing maps with minimal code. Whether you are analyzing

14
spatial data, creating data visualizations, or building interactive web applications,
Folium is a valuable tool for working with geospatial data in Python.

2.2.7Plotly:
Plotly is a powerful Python library used for creating interactive data visualizations. It provides a wide
range of graph types, including line charts, scatter plots, bar charts, pie charts, 3D plots, and more.
With Plotly, you can create highly customizable and interactive plots that can be embedded in web
applications or displayed in Jupyter notebooks.

Here are some key features and functionalities of Plotly:

 Interactive Visualizations: Plotly allows you to create interactive plots with zooming,
panning, hovering, and clickable elements. Users can explore the data by interacting directly
with the plot, making it ideal for data exploration and analysis.
 Publication-Quality Graphs: Plotly produces visually appealing and professional-looking
graphs that can be customized in various ways. You can control the appearance of the plot
elements, such as colors, fonts, annotations, and legends, to match your specific requirements.
 Multiple Output Formats: Plotly supports multiple output formats, including static images
(PNG, JPEG, SVG), interactive HTML files, and even animations and GIFs. This versatility
allows you to use the plots in different contexts, such as presentations, reports, or web
applications.
 Collaboration and Sharing: Plotly provides a web-based platform called Plotly Chart Studio,
where you can save and share your plots. You can collaborate with others, publish your
visualizations, and embed them in websites or dashboards.
 Plotting Libraries Integration: Plotly seamlessly integrates with popular Python libraries such
as Pandas, NumPy, and Matplotlib. It can easily convert data structures from these libraries
into Plotly objects, making it convenient to use Plotly in existing data analysis workflows.
 Dash Framework: Plotly also offers a web application framework called Dash, which allows
you to build interactive dashboards and data-driven web applications using only Python. With
Dash, you can create complex applications that combine multiple Plotly graphs, interactive
controls, and data manipulation capabilities.
 Plotly provides a rich set of features for creating stunning and interactive visualizations. It is
widely used in various domains, including data science, finance, biology, social sciences, and
more. Whether you are a data analyst, scientist, or developer, Plotly is a valuable tool for
creating engaging and informative data visualizations in Python.

15
2.3 Algorithms Used:

2.3.1 Ant Colony:

The ant colony optimization (ACO) algorithm is a metaheuristic algorithm inspired by the
behavior of ants searching for food. It is commonly used to solve combinatorial optimization
problems such as the traveling salesman problem (TSP) and the vehicle routing problem
(VRP).

The ACO algorithm is based on the concept of pheromone trails left by ants as they move
from one location to another. The pheromone trails represent the attractiveness of paths, and
ants tend to choose paths with higher pheromone levels. Through the collective behavior of
the ant colony, the algorithm finds good solutions to optimization problems.

Here's a general outline of the ant colony optimization algorithm:

 Initialization: Create a population of ants and initialize pheromone trails on the edges
between nodes. Set the parameters such as the number of ants, pheromone
evaporation rate, and heuristic information about the problem.
 Ant Movement: Each ant selects the next node to visit based on a probabilistic
decision rule that combines the pheromone information and heuristic knowledge. The
probabilistic rule assigns higher probabilities to paths with higher pheromone levels
and shorter distances.
 Pheromone Update: After all ants complete their tours, update the pheromone trails
based on the quality of the solutions found. Typically, the pheromone update includes
depositing pheromone on edges traversed by the ants and evaporating existing
pheromone trails to avoid convergence to suboptimal solutions.
 Iteration: Repeat the ant movement and pheromone update steps for a certain number
of iterations or until a termination condition is met.
 Solution Construction: As the iterations progress, the pheromone trails guide the ants
to explore and exploit better solutions. Over time, the pheromone concentration
increases on the edges of good paths, leading to the convergence of the ant colony
toward an optimal or near-optimal solution.

16
Fig.8 ACO algorithm

Here are some diagrams to illustrate the Ant Colony Optimization (ACO) technique:

 Pheromone Trail Diagram: The pheromone trail is the key element of ACO. Ants
deposit pheromones on the ground as they move around, and these pheromones attract
other ants to follow the same path.
 Ants Movement Diagram: Ants move in a probabilistic manner in ACO. At each step,
an ant decides which path to follow based on a combination of pheromone trail
strength and the distance to the destination.
 ACO Flowchart: The ACO algorithm can be summarized in a flowchart that outlines
the various steps involved in finding the optimal path.
 ACO Performance Comparison Diagram: To evaluate the performance of ACO, it can
be compared to other optimization algorithms, such as Genetic Algorithms (GA) and
Simulated Annealing (SA).

17
2.3.2 A* Algorithm:
It is an informed Search it uses the cost of distance between each node and heuristic value. In
this case the heuristic value will be the distance between the nodes in a straight line. As we
travel from one place to another.

Here's a step-by-step overview of the A* algorithm:

 Initialization: Start with the initial node and set its cost-to-reach as zero. Create an
open set to store the nodes that are yet to be explored and a closed set to store the
nodes that have already been visited.
 Main Loop: While the open set is not empty, perform the following steps:
 Select the node with the lowest total cost (the sum of the cost-to-reach and the
estimated cost to the goal) from the open set.
 If the selected node is the goal, the algorithm terminates, and the shortest path is
found.
 Otherwise, move the selected node from the open set to the closed set.
 Expand the selected node by considering its neighboring nodes.
 Neighbor Evaluation: For each neighboring node that is not in the closed set, calculate
the cost-to-reach from the start node to that neighbor. Calculate the estimated cost
from the neighbor to the goal using a heuristic function (e.g., Euclidean distance,
Manhattan distance, or any other admissible heuristic).
 Update Node Information: If the calculated cost-to-reach is lower than the existing
value (or the neighbor is not in the open set), update the cost-to-reach of the neighbor
and set its parent as the selected node. If the neighbor is not in the open set, add it to
the open set.
 Termination: If the goal node is reached, the shortest path is found. Otherwise, if the
open set becomes empty, there is no path from the start to the goal.
 Path Reconstruction: Once the goal node is reached, trace back from the goal node to
the start node using the parent references to reconstruct the shortest path.

18
2.3.3 DFS:

 DFS stands for Depth-First Search. It is an algorithm used to traverse or search


through a graph or tree data structure. It starts at a designated node (often called the
"root") and explores as far as possible along each branch before backtracking.
 Here's an overview of the Depth-First Search algorithm:
 Initialization: Choose a starting node and mark it as visited. If necessary, prepare any
data structures to track visited nodes or store the traversal order.
 Process Current Node: Perform any desired operations on the current node. This could
involve examining its value, recording its position, or performing specific
computations.
 Explore Neighbors: From the current node, select an unvisited neighbor (connected
node) and recursively apply the Depth-First Search algorithm to it. This involves
moving to the neighbor node, marking it as visited, and repeating steps 2 and 3.
 Backtrack: If there are no unvisited neighbors, backtrack to the previous node and
continue exploring the remaining unvisited neighbors from there. Repeat step 4 until
all nodes have been visited.

2.3.4 BFS:

BFS stands for Breadth-First Search. It is an algorithm used to traverse or search through a
graph or tree data structure. It starts at a designated node (often called the "root") and
explores all its neighbors at the current depth before moving on to the neighbors at the next
depth level.

Here's an overview of the Breadth-First Search algorithm:

 Initialization: Choose a starting node and mark it as visited. If necessary, prepare any
data structures to track visited nodes or store the traversal order.
 Process Current Node: Perform any desired operations on the current node. This could
involve examining its value, recording its position, or performing specific
computations.
 Enqueue Neighbors: Enqueue (add) all unvisited neighbors (connected nodes) of the
current node into a queue data structure.

19
 Dequeue and Process: Dequeue (remove) the next node from the queue and treat it as
the current node. Repeat steps 2 and 3 for this current node.
 Repeat: Continue steps 4 and 5 until the queue becomes empty. This indicates that all
nodes have been visited.

2.4 Web development tools and technologies used


Web development is the process of creating either a static or dynamic webpage or web
application with the different technologies for the internet (WWW) or intranet (private
network). The web development process can be broadly divided into two parts. The first part,
Front-End consists of a User Interface (UI) of the web page i.e. how the page will look for the
user. The second part is Back-end. It consists of all the databases and table and basically
concerns all the server-side programming. The technologies used in the project are briefly
described below:

2.4.1 Front-End

Frontend development refers to the process of creating the user interface (UI) and user
experience (UX) of a website or web application. It involves designing and implementing the
visual elements that users interact with, such as layouts, buttons, forms, and navigation
menus. Frontend developers use a combination of HTML (Hypertext Markup Language),
CSS (Cascading Style Sheets), and JavaScript to build responsive and interactive interfaces.

HTML is the standard markup language used to structure the content of a web page, defining
elements like headings, paragraphs, images, and links. CSS is responsible for styling the
HTML elements, specifying properties like colors, fonts, layouts, and animations. JavaScript,
on the other hand, adds interactivity and dynamic behavior to the frontend by manipulating
the HTML and CSS in response to user actions.

Frontend developers work closely with designers to ensure that the visual aspects of a website
or application align with the desired aesthetics and user experience. They also collaborate
with backend developers who handle server-side processes, data storage, and communication
between the client and the server.In recent years, frontend development has evolved
significantly with the rise of frameworks and libraries like React, Angular, and Vue.js. These
tools provide developers with efficient ways to build complex and interactive UIs, manage
state, and handle data flow. Additionally, responsive design and mobile-first development
have become essential considerations in frontend development, as websites and applications

20
need to adapt to various devices and screen sizes.The role of a frontend developer requires a
combination of technical skills, creativity, and attention to detail. They must have a solid
understanding of HTML, CSS, and JavaScript, as well as knowledge of modern frontend
frameworks and tools. In addition to technical expertise, frontend developers need to stay
updated with the latest design trends, accessibility standards, and best practices to create
intuitive and user-friendly interfaces.

Overall, frontend development plays a crucial role in shaping the user experience of a website
or web application. It encompasses the design and implementation of the visual elements and
interactive features that users interact with, ensuring a seamless and engaging digital
experience.

2.4.1.1 HTML

HTML stands for a Hyper Text Markup Language. It is a Markup language for creating web
pages and websites. The elements of HTML are the building block of a website and are
represented by tags. Tags do not render themselves on a webpage, but they help to render
other content. Example of HTML tags is “body”, “head”, “title”, “table”. The tags are
enclosed in <>.

Syntax: < body></body>, <div></div>.

Most of the tags have closing tags and they are represented as above.

(Hypertext Markup Language) is a standard markup language used for creating the structure
and content of web pages. It forms the foundation of every website and is essential for
displaying information on the internet.

HTML uses a set of tags to define different elements and their respective properties. Tags are
enclosed in angle brackets (<>) and come in pairs: an opening tag and a closing tag. The
content placed between these tags is affected by the tag's functionality. For example, the
`<h1>` tag represents a top-level heading, `<p>` represents a paragraph, and `<img>`
represents an image.

21
HTML allows you to structure your content in a logical manner by using elements such as
headings, paragraphs, lists, tables, and more. It also supports links, allowing you to navigate
between web pages, and provides semantic elements like `<header>`, `<nav>`, `<footer>`,
and `<article>`, which add meaning to the structure of the page and aid in search engine
optimization.

To style HTML elements, you can use CSS (Cascading Style Sheets). CSS allows you to
define the visual appearance of HTML elements by specifying properties like colors, fonts,
layouts, and animations.HTML is a versatile language that has evolved over time. With the
latest version, HTML5, new features and elements have been introduced, including video and
audio embedding, canvas for graphics rendering, form validation, and more. HTML5 also
includes support for responsive design, enabling websites to adapt to different devices and
screen sizes. When creating an HTML document, it typically starts with a `<!DOCTYPE>`
declaration that specifies the HTML version being used, followed by the `<html>` element,
which serves as the root element of the document. Inside the `<html>` element, you have the
`<head>` element for metadata and the `<body>` element for the visible content.

HTML is a fundamental skill for web development, and learning its syntax and structure is
crucial for anyone interested in creating web pages or web applications. It forms the
backbone of the web and provides the structure upon which other technologies, such as CSS
and JavaScript, can be built to create dynamic and interactive experiences for users.

2.4.1.2 CSS

CSS stands for a Cascading Style Sheet. It is used to add a style to HTML elements. It can be
written in an HTML file or separately as a “.CSS” extension.

Fig.9 CSS

22
A standard CSS syntax consists of a selector and a declaration block as shown in figure The
selector points to the HTML element which one wishes to style. The property and value are
separated by a colon (:). Each declaration block is surrounded by curly braces and each
declaration ends with a semicolon (;).

2.4.1.3 JavaScript (JS)

JS is a high level, interpreted programming language. It is a scripting language, primarily


used on the Web. Being an interpreted language, it does not need to be compiled. It renders
web pages in an interactive and dynamic fashion. It is one of the three core technologies of
the World Wide Web (WWW) along with HTML and CSS. (W3schools, Date of retrieval
19th May 2018).

It is case sensitive and generally, the name of the function and variable is written with a lower
case. Every statement is ended with a semicolon (;). For example, a variable is defined as:
“var a = 10;”. Here ‘var’ is a datatype of the variable ‘a’, ‘=’ is an operator which assigns a
value ‘10’ to the variable ‘a’. <script></script> is used in an HTML file to insert JS script
into HTML. If separate JS file is created its source must be pointed using ansrc attribute of
<script>. Commonly JS is used for image manipulation, form validation and dynamic
changes of content. To select an HTML element, JS often uses a document. getElementById
() method.

Fig.10 JavaScript

23
2.4.1.4 Bootstrap

Bootstrap is a free and open-source front-end library for designing websites and web
applications. It contains HTML and CSS-based design templates for typography, forms,
buttons, navigation, and other interface components, as well as optional JavaScript
extensions. Unlike many web frameworks, it concerns itself with front-end development
only. Creating visually beautiful, responsive, and user-friendly interfaces is critical in the
ever-changing field of web development. This is where the Bootstrap framework comes into
play. Bootstrap is a popular front-end framework that gives developers a robust set of tools,
components, and styles to help them with web development. Bootstrap provides a solid basis
for designing modern and responsive designs, whether you are creating a basic website or a
major web application.

Twitter programmers Mark Otto and Jacob Thornton created bootstrap as an internal solution
to address consistency and efficiency issues in their projects. Recognizing its potential, they
made it available as an open-source project in 2011, and it immediately gained popularity due
to its ease of use and effectiveness. Bootstrap has since matured into a feature-rich
framework with an active community contributing to its development and support.

One of the key benefits of choosing Bootstrap is that it is mobile-first. With the increased
usage of mobile devices for online browsing, it is critical that websites and applications are
optimized for various screen sizes and resolutions. The responsive grid concept in Bootstrap
allows developers to create flexible layouts that automatically adjust to different devices.
Another distinguishing characteristic of Bootstrap is its large library of pre-built components.
These elements, which include navigation bars, buttons, forms, modals, and carousels, have a
consistent style and structure. By combining ready-to-use pieces into their designs,
developers can save time and effort while maintaining a consistent and professional aesthetic.
Bootstrap also excels at cross-browser compatibility, which ensures that your website or
application operates reliably across multiple web browsers. It handles various cross-browser
discrepancies, allowing developers to concentrate on the core functionality and design of
their applications rather than worrying about browser oddities. Furthermore, Bootstrap
provides a plethora of customization choices. Developers can quickly tweak the default styles
with Sass variables, allowing them to tailor Bootstrap to their project's specific design needs.
Furthermore, Bootstrap's theming capabilities enable the construction of new themes as well

24
as the use of pre-existing themes, delivering a visually consistent and personalized user
experience.

Finally, Bootstrap has emerged as the go-to framework for developers looking to design
modern, responsive, and visually appealing online interfaces. Its vast feature set, which
includes a mobile-first approach, a big component library, cross-browser compatibility, and
customization options, makes it a powerful tool for projects of any size. Developers can
utilize Bootstrap to improve design uniformity, responsiveness, and to streamline the
development process, resulting in great user experiences.

2.4.2 Backend
In the client-server model, the client is considered as a front-end and the server is considered
as a backend, even some presentation work is done on the server. It is an essential aspect of
web development, focusing on the server-side operations that power a web application. It
involves working with server-side technologies, databases, and application logic to handle
requests, process data, manage databases, and integrate third-party services. The key
components of backend development include the server, databases, application logic, and
APIs.

Backend development plays a crucial role in data management, ensuring efficient storage,
retrieval, and manipulation of data. It also addresses security concerns by implementing
authentication, authorization, and data validation measures. Additionally, backend
development optimizes performance, scalability, and integration with external services,
contributing to the seamless functioning and enhanced user experience of web applications.

In summary, backend development forms the backbone of a web application, managing


server-side operations, data storage, security, performance optimization, and integration. It is
instrumental in creating robust and efficient web applications that meet user needs and
deliver a seamless experience.

2.4.2.1 Django

Django is a web application framework written in Python programming language. It is based


on MVT (Model View Template) design pattern. The Django is very demanding due to its
rapid development feature. It takes less time to build application after collecting client

25
requirement. This framework uses a famous tag line: The web framework for perfectionists
with deadlines.

By using Django, we can build web applications in very less time. Django is designed in such
a manner that it handles much of configure things automatically, so we can focus on
application development only. Django was design and developed by Lawrence journal world
in 2003 and publicly released under BSD license in July 2005. Currently, DSF (Django
Software Foundation) maintains its development and release cycle. Django was released on
21, July 2005. Its current stable version is 2.0.3 which was released on 6 March, 2018.

Django's strength lies in its ability to handle complex web applications with ease. It promotes
code reuse, follows best practices, and provides a rich ecosystem of packages and extensions.
Whether you are building a small prototype or a large-scale web application, Django offers
the tools and conventions to streamline your development process and create feature-rich,
scalable applications.

It is a high-level Python web framework that simplifies and accelerates the process of
building web applications. It follows the model-view-controller (MVC) architectural pattern
and emphasizes efficiency, reusability, and maintainability. In summary, Django provides a
comprehensive set of tools and features that enable developers to quickly develop robust and
scalable web applications. With Django, developers can focus on writing application logic
instead of boilerplate code. It offers a powerful ORM (Object-Relational Mapping) that
allows seamless interaction with databases, simplifying data modeling and management.
Django's templating engine enables the creation of dynamic and reusable templates,
promoting code reuse and maintainability.

Django's built-in authentication and authorization system enhance the security of web
applications, handling user authentication, permissions, and session management. It also
offers features like form handling, URL routing, and middleware support, which facilitate
request handling and processing. One of Django's notable features is its administrative
interface, known as the Django Admin. It provides an out-of-the-box solution for creating an
admin interface for managing application data. The Django Admin is highly customizable,
allowing developers to tailor it to their specific needs. Furthermore, Django's extensive
ecosystem and active community contribute to its popularity. It offers numerous third-party

26
libraries, packages, and extensions that extend its functionality and provide solutions for
common development tasks.

In summary, Django simplifies web application development by providing a robust


framework, efficient tools, and a rich set of features. It promotes code reusability, scalability,
and security. With Django, developers can rapidly build and maintain high-quality web
applications while leveraging the strength of the Python programming language and its
extensive ecosystem.

2.4.3 Artificial Intelligence


(AI) is a field of computer science that focuses on creating intelligent machines capable of
performing tasks that typically require human intelligence. It involves the development of
algorithms and systems that can analyze data, learn from patterns, make decisions, and solve
problems.

AI encompasses various subfields and techniques, including machine learning, natural


language processing, computer vision, expert systems, and robotics. Machine learning, in
particular, is a branch of AI that focuses on enabling computers to learn and improve from
data without explicit programming. It involves training algorithms to recognize patterns,
make predictions, or perform tasks based on provided examples or experience.AI applications
are vast and diverse. They range from virtual assistants like Siri and Alexa to
recommendation systems used by online platforms, self-driving cars, fraud detection
algorithms, medical diagnosis systems, and more. AI has also found applications in areas like
finance, marketing, manufacturing, and cyber security.

One of the key challenges in AI is achieving human-level or general artificial intelligence,


where machines possess the same cognitive abilities as humans across various domains.
While we have seen remarkable advancements in narrow AI applications, achieving general
AI remains an ongoing pursuit. Ethical considerations in AI are also important, as AI systems
can have significant societal impacts. Issues like bias in data; privacy concerns, job
displacement, and the overall ethical use of AI technologies are being actively discussed and
addressed.

As AI continues to advance, it has the potential to revolutionize industries, improve


efficiency, and enhance our daily lives. It opens up new possibilities for automation, data
analysis, decision-making, and problem-solving. However, it also raises questions about the

27
ethical implications, the impact on the workforce, and the need for responsible development
and deployment. Overall, AI represents a rapidly evolving field that aims to replicate and
extend human intelligence through machines. It has already made significant contributions in
various domains and holds great promise for shaping the future of technology and society.

2.4.4 Machine Learning


(ML) is a subfield of Artificial Intelligence (AI) that focuses on the development of
algorithms and models that enable computers to learn and make predictions or decisions
based on data. It involves designing and training systems to automatically analyze and extract
patterns from data, without being explicitly programmed for each specific task.

ML algorithms learn from examples or experiences by identifying patterns and relationships


within the data. They use statistical techniques to generalize from observed examples and
make predictions or take actions on new, unseen data. The learning process typically involves
the use of labeled data, where the desired outcomes are known, to train the algorithm and
optimize its performance.ML algorithms can be categorized into different types based on
their learning approach. Supervised learning algorithms learn from labeled data, where input
examples are paired with corresponding desired outputs. Unsupervised learning algorithms
work with unlabeled data and aim to find patterns or structure in the data without explicit
guidance. Reinforcement learning algorithms learn by interacting with an environment and
receiving feedback in the form of rewards or penalties to improve their decision-making
abilities.ML has found applications in various domains, including computer vision, natural
language processing, recommendation systems, fraud detection, healthcare, finance, and
many more. It powers technologies like virtual assistants, image and speech recognition
systems, autonomous vehicles, and personalized content recommendations.

To create ML models, data preprocessing, feature selection, and model training are essential
steps. Data preprocessing involves cleaning and transforming the data to ensure it is in a
suitable format for training. Feature selection involves identifying relevant attributes or
features from the data that contribute to the learning task. Model training involves using the
prepared data to adjust the model's parameters or structure to minimize errors and improve
performance.ML is a rapidly evolving field, with ongoing research and advancements. Deep
Learning, a subset of ML, focuses on artificial neural networks with multiple layers that can
learn hierarchical representations of data. Deep Learning has achieved remarkable success in

28
various applications, such as image and speech recognition. While ML has great potential, it
also raises ethical and societal considerations. These include concerns about bias in data,
privacy, transparency, and the responsible use of ML systems. In summary, machine learning
enables computers to learn from data and make predictions or decisions. It is a powerful tool
within the broader field of AI and has significant applications across industries, driving
advancements in technology and improving decision-making processes.

2.4.5 Iterative Depth-First Search


(IDDFS) is a graph traversal algorithm that combines the depth-first search (DFS) approach
with iterative deepening. It aims to explore the nodes of a graph in a depth-first manner but
with a depth limit that increases iteratively. This allows the algorithm to gradually explore
deeper levels of the graph while still maintaining the benefits of DFS. The algorithm starts
with a depth limit of 0 and performs a depth-limited DFS. It explores nodes at the current
depth level, recursively moving to their neighboring nodes until it reaches the depth limit. If
the goal node is not found within the depth limit, the algorithm increases the depth limit and
repeats the process. This continues until the goal node is found or the entire graph has been
explored. IDDFS is particularly useful in scenarios where the search space is vast and the
depth of the graph is unknown. By gradually increasing the depth limit, IDDFS can
efficiently explore large graphs while ensuring that the search terminates. Compared to
traditional DFS, IDDFS has the advantage of guaranteeing completeness, meaning that if a
goal node exists in the graph, IDDFS will eventually find it. Additionally, it can save memory
compared to breadth-first search (BFS) since it only needs to store the nodes at the current
depth level.

However, IDDFS may still suffer from inefficiency in certain cases, such as graphs with
exponential branching factors or graphs with very deep paths. In such scenarios, alternative
search algorithms like A* may provide better performance. In summary, Iterative Depth-First
Search (IDDFS) is an algorithm that combines the depth-first search strategy with iterative
deepening. It explores a graph in a depth-first manner with increasing depth limits, gradually
searching deeper levels until a goal node is found. IDDFS offers completeness and can be
memory-efficient, making it a valuable approach for exploring large graphs with unknown
depths.

29
CHAPTER-3
PROJECT METHODOLOGY & MATERIAL
METHODOLOGY

Nowadays, ecommerce has changed the way of shopping. It's very easy for us to buy
anything from anywhere. Some of the companies have their own delivery system and some
use courier services. Talking about the shipping charge, every product has a different
shipping charge but why so, that is because products are coming from different places some
are far from your location some are near that’s how shipping charge is calculated. The farther
the place is, the greater the money will be required to deliver it, which includes the charge of
fuel used, delivery charges etc. In one day, a lot of deliveries are there and many times there
are not many delivery people to complete all deliveries, some of them travel with cycles too.
Due to lack of optimal scheduling of deliveries, the delivery people have to travel more. So
here we thought of solving this problem by providing the most optimal path for completing
all the deliveries assigned to each delivery person in or before time. In this project with help
of AI and some advanced search algorithms like A*, AO*, we are going to provide the
shortest path so the delivery person’s effort will be reduced and the customer will also be
satisfied as they are going to get their order on time. We are going to build an interface in
which the path which should be followed will be shown to the delivery person based on the
cost factor.

3.1 Proposed System


The purpose of our system is to help the delivery person to reach the destination in a shorter
span of time with effective cost. The algorithm is designed to minimize the distance traveled
by logistics vehicles while ensuring that all delivery locations are visited. The algorithm's
performance is evaluated on various scenarios using real-world data.

3.1.2 Materials and Methodology:

Data Collection: The first step in the project is to collect real-world data on the
transportation network. The data will include the location of delivery points, road network
details, traffic flow, and other relevant information. Collected real-world data on the

30
transportation network, including the location of delivery points, road network details, traffic
flow, and other relevant information.

Algorithm Development: Initially by using pandas module loading all the data from
specified files to get road-segments and gps details and converting them to lists for better
accessing.

Implementation: The developed algorithm will be implemented in a programming language


such as Python.

Input/Output: The software will take the real-world data as input and provide the optimized
path as output. The input data will be in a suitable format, such as a CSV file, and the output
will be a visual representation of the optimized path on a map.

User Interface: The software will have a user-friendly interface that will allow users to input
data, adjust parameters, and visualize the results. The user interface will be developed using
HTML, CSS and JavaScript.

Testing: The software will be tested using real-world data to ensure that it is efficient,
accurate, and reliable. The testing will involve measuring the distance traveled, fuel
consumption, and travel time of the optimized path.

Deployment: The software will be deployed on a suitable platform, such as a web


application or a desktop application, depending on the client's requirements.

3.1.3 Set of valid states

In an AI system for city navigation, the set of valid states typically represents the different
possible configurations or conditions that the system can be in during the navigation process.
Here are some examples of valid states that might be considered:

 Current Location: The AI system needs to keep track of its current location within
the city. Each location can be represented by coordinates or specific addresses.
 Destination: The desired endpoint or destination where the user wants to reach. It can
be represented similarly to the current location.
 Road Network: The city's road network, including the streets, intersections, and
connections between different locations. The AI system needs to know the valid paths
or routes available between various points in the city.

31
 Traffic Conditions: The current traffic conditions on different roads or intersections.
This information is essential for the AI system to determine the optimal route,
considering factors such as congestion or accidents.
 Legal Restrictions: Any legal or regulatory restrictions that might impact navigation,
such as one-way streets, traffic rules, or specific vehicle restrictions in certain areas.
 User Preferences: User-specific preferences or constraints, such as avoiding toll
roads, choosing the shortest or fastest route, or preferring specific landmarks or points
of interest along the way.
 Time of Day: The time of day may influence navigation decisions, as traffic patterns
and conditions can vary based on the time.

These are just a few examples, and the specific set of valid states may vary depending on the
complexity of the navigation system and the features it incorporates. The AI system would
need to consider and update these states dynamically as it receives new information or user
inputs to make accurate and efficient navigation decisions within the city.

In city navigation AI, the successor function is a function that generates the possible next
states or actions that can be taken from the current state during the navigation process. It
defines the valid actions or movements that the AI system can make to explore the city and
progress towards the desired destination. The successor function plays a crucial role in search
algorithms such as breadth-first search, depth-first search, A*, and others.

Some examples of the successor function in city navigation AI:

 Adjacent Streets: Given the current location, the successor function can generate the
neighboring streets or intersections that are directly connected to the current position.
This includes identifying the valid roads or paths that can be taken from the current
location.
 Turns and Directions: The successor function can determine the possible turns or
directions that can be taken at an intersection or junction. For example, it can generate
actions like turning left, turning right, or continuing straight on a specific road.
 Traffic Conditions: The successor function can incorporate information about the
current traffic conditions to determine the feasible actions. It may consider factors like
road congestion, accidents, or construction work to generate actions that avoid heavily
congested routes or suggest alternative paths.

32
 Legal Restrictions: The successor function can take into account any legal
restrictions or rules specific to the city's road network. For instance, it can exclude
actions that violate one-way street regulations or actions that are not allowed during
certain times of the day.
 Landmarks or Points of Interest: If the AI system has knowledge of landmarks or
points of interest in the city, the successor function can generate actions that involve
visiting or passing by those locations. This can provide options for more scenic or
personalized routes.
 User Preferences: The successor function can consider user preferences or
constraints to generate actions that align with the user's specific requirements. For
example, if the user wants to avoid toll roads or prefers the fastest route, the function
can prioritize generating actions that adhere to those preferences.

The successor function helps the AI system explore the navigation space systematically,
generating potential actions or movements that lead to different states or locations within the
city. It enables the system to evaluate and compare different paths and determine the most
optimal route to reach the desired destination.

3.1.4 Time

The time taken in city navigation AI can vary depending on several factors. Here are some
key factors that can influence the time taken:

 Complexity of the Road Network: The size and complexity of the city's road
network can impact the time taken for navigation. Navigating through a large city
with numerous streets, intersections, and alternative routes may require more time for
the AI system to explore and evaluate different paths.
 Traffic Conditions: The current traffic conditions play a significant role in
determining the time taken for navigation. Congestion, road closures, accidents, and
other factors affecting traffic flow can cause delays and increase the time required to
reach the destination. Real-time traffic information and intelligent routing algorithms
can help mitigate delays by dynamically adjusting the route based on current
conditions.
 Routing Algorithm Efficiency: The efficiency of the routing algorithm used by the
AI system can affect the time taken for navigation. Some algorithms, like A* (A-star),
utilize heuristics and smart search strategies to find optimal or near-optimal routes

33
efficiently. Faster algorithms can significantly reduce navigation time compared to
slower or less optimized ones.
 Hardware and Processing Speed: The hardware and processing speed of the AI
system or the device running the navigation software can impact the time taken.
Faster processors and efficient computing resources can allow for quicker route
calculations and decision-making, leading to faster navigation.
 User Preferences and Constraints: User-specific preferences or constraints can also
influence navigation time. For example, if the user wants to take a scenic route, visit
specific landmarks, or avoid certain road types (e.g., toll roads), the navigation system
may need to calculate alternative paths that align with those preferences, potentially
affecting the overall time taken.

It's important to note that city navigation AI systems strive to provide accurate and efficient
routes based on the available data and algorithms. However, unexpected events, such as
sudden traffic incidents or unforeseen road conditions, can still impact the actual time taken
during navigation.

3.1.5 Delivery

In city navigation AI, the concept of delivery cost typically refers to the cost associated with
delivering goods or services from one location to another within the city. The calculation of
delivery cost involves various factors, including distance, time, transportation method, and
potentially other specific considerations. Here are some key elements that can contribute to
the calculation of delivery cost in city navigation AI:

 Distance: The distance between the pickup location and the delivery destination is a
fundamental factor in determining the delivery cost. Shorter distances generally result
in lower costs, while longer distances may increase the cost.
 Time: The time required to complete the delivery can be considered as part of the
cost calculation. Some delivery services may charge based on time, especially if it
involves time-sensitive deliveries or if there are additional costs associated with
waiting or delays.
 Transportation Method: The chosen transportation method can impact the delivery
cost. Different modes of transportation, such as cars, bicycles, motorcycles, or even
drones, can have varying costs associated with them, considering factors like fuel or
energy consumption, maintenance, and operational expenses.

34
 Weight and Size: The weight and size of the goods being delivered can influence the
cost. Larger or heavier items may require special handling, additional resources, or
specific types of vehicles, which can contribute to higher delivery costs.
 Delivery Urgency: If the delivery needs to be expedited or completed within a
specific time frame, there may be additional charges for express or same-day delivery
services. Urgency or delivery time requirements can impact the overall cost.
 Additional Services: Additional services requested by the customer, such as package
tracking, insurance, or special handling instructions, can contribute to the overall cost
of the delivery.

It's important to note that the specific calculations and pricing models for delivery costs can
vary between different delivery services, companies, or platforms. The city navigation AI
system would need to incorporate these factors and potentially have access to pricing or cost
data to provide accurate estimates or calculations of delivery costs for different routes and
scenarios.

3.1.6 Goal state

In city navigation AI, the goal state represents the desired destination or endpoint that the
user wants to reach. It is the ultimate objective of the navigation process. The goal state
serves as a reference point for the AI system to plan and generate routes or directions to guide
the user from their current location to the desired destination.

The goal state typically includes the following components:

 Destination Location: The specific coordinates or address of the desired endpoint


within the city. It could be a residential address, a business location, a landmark, or
any other point of interest.
 Criteria for Success: In addition to the destination location, the goal state may also
include specific criteria that define the successful completion of the navigation task.
For example, it could be reaching the destination within a certain time frame, taking
the shortest route, avoiding toll roads, or considering other user preferences.
 Contextual Factors: Depending on the specific requirements of the navigation AI
system, the goal state might take into account contextual factors. This could include
considerations such as the availability of parking spaces near the destination,

35
accessibility requirements for individuals with disabilities, or any other factors
relevant to the user's needs.

The AI system uses the goal state as a reference point to determine the optimal route and
provide directions to guide the user to their desired destination. It considers factors such as
traffic conditions, road networks, user preferences, and any other relevant constraints to
generate the most suitable path to reach the goal state efficiently and effectively. The goal
state is an essential component in city navigation AI as it defines the purpose of the
navigation process, enabling the system to provide accurate, personalized, and user-specific
guidance to successfully reach the desired destination. In city navigation AI, the initial state
represents the starting point or current location from which the navigation process begins. It
serves as the reference point for the AI system to plan and generate routes or directions to
guide the user from their current location to the desired destination.

3.1.7 Initial state

The initial state typically includes the following components:

 Current Location: The specific coordinates or address of the starting point within the
city. It represents the user's present location from which they intend to initiate the
navigation process.
 Additional Information: Depending on the capabilities of the navigation AI system,
the initial state may also include additional information relevant to the navigation
process. This could include details such as the mode of transportation (e.g., walking,
driving), any specified preferences or constraints (e.g., avoiding highways, preferring
scenic routes), or other user-specific factors that can influence the route generation.

The AI system utilizes the initial state to determine the most suitable path and provide
directions to guide the user from their current location to the desired destination. It considers
factors such as the current traffic conditions, road networks, user preferences, and any other
relevant constraints to generate an optimized route. By incorporating the initial state, the city
navigation AI system can offer personalized and context-aware guidance to the user, taking
into account their specific starting location and preferences. This ensures that the generated
routes and directions are tailored to the individual's needs and provide accurate navigation
instructions for the journey.

36
In city navigation AI, heuristic functions are used to estimate the distance or cost between
different locations within the city. These functions provide a measure of how close or far a
particular location is from the desired destination. Heuristic functions play a crucial role in
search algorithms like A* (A-star) that aim to find optimal or near-optimal routes in a city
navigation context.

3.1.8 Heuristic function

Here are some common heuristic functions used in city navigation AI:

 Straight-Line Distance: Also known as the Euclidean distance, this heuristic


calculates the direct, straight-line distance between two locations in the city. It
assumes that the AI system can travel in a straight path from the current location to
the goal location, disregarding obstacles or road networks. While this heuristic is
simple to compute, it may not accurately represent the actual distance considering the
road layout and obstacles.
 Manhattan Distance: The Manhattan distance, also known as the taxi-cab distance,
calculates the distance between two locations by summing the absolute differences in
their x and y coordinates. It assumes movement only along orthogonal directions, like
the movement of a taxi in a city grid. This heuristic can provide a reasonable estimate
of distance in a city with a grid-like road network.
 Network Distance: This heuristic considers the actual road network and calculates
the distance based on the number of edges or nodes traversed to reach the destination.
It takes into account the layout of the road network, including the presence of
intersections, one-way streets, and other road features. Network distance heuristics
can provide more accurate estimates but require access to detailed road network data.
 Historical Traffic Data: Some navigation AI systems incorporate historical traffic
data to estimate travel times and costs. This heuristic takes into account the average or
expected traffic conditions on different routes at different times of the day

It's important to note that the choice of heuristic function depends on the specific
requirements of the navigation AI system and the available data. The selected heuristic
should balance accuracy and computational efficiency to provide effective and timely
route planning in city navigation scenarios.

37
3.1.8 Description of algorithm

1. Initially by using panda’s module loading all the data from specified files to get road-
segments and gps details and converting them to lists for better accessing. As mentioned,
including the bidirectional condition as well.

 Import the panda’s module


 Load road segments data from a file
 Convert road segments data to a list
 Load GPS details data from a file
 Convert GPS details data to a list
 Create a list to store the time taken for each segment
 Create a dictionary to store bidirectional road segments
 Iterate through road segments and calculate the time taken for each segment

Extract the relevant information for each road segment, calculate the time taken by dividing
the distance by the speed limit, and append it to the `time_taken` list. Additionally, if there is
a bidirectional condition, you store the bidirectional segments in the `bidirectional_segments`
dictionary. The dictionary uses the start node as the key and stores a list of tuples
representing the end node, distance, and speed limit for each bidirectional segment.By
including the bidirectional condition, you account for road segments that allow travel in both
directions, ensuring that the navigation algorithm can consider these segments for route
planning. This process allows you to load the data, calculate the time taken for road
segments, and store bidirectional segments in a dictionary, all while using the panda’s
module for efficient data handling.

38
Fig 11. List

The code uses the pandas module to load the road segments and GPS details data from the
CSV files. It then converts the data into lists for better accessibility using the values.tolist()
method.

Next, the code creates two empty lists: time_taken to store the time taken for each segment
and mistakes to store the mistakes for the delivery cost function.

The code iterates through each road segment and calculates the time taken for the segment by
dividing the distance by the speed limit. It appends the calculated time to the time_taken list.

Then, the code iterates through each GPS detail and retrieves the current location, destination,
and delivery time. It calculates the estimated time for the segment using the time_taken list
based on the current location and destination. It then calculates the mistake for the delivery
cost function by subtracting the estimated time from the delivery time. Finally, it appends the
calculated mistake to the mistakes list.

By performing these calculations and storing the results in lists, you can track the time taken
for each segment and the mistakes for the delivery cost function, which can be used for
further analysis or decision-making in the context of city navigation.

39
Fig.12 Frontier

2. Adding the start city into the frontier (fringe)

 Initialize the frontier as a data structure, such as a queue or priority queue, to store the
cities to be explored.
 Define a function or method to add cities to the frontier. This function will be
responsible for adding cities to the frontier
 Now, when starting the city navigation AI, you need to add the start city to the
frontier before starting the search algorithm. This ensures that the AI starts exploring
from the initial city.

By calling the `add_to_frontier()` function and passing the start city as an argument, you
enqueue the start city into the frontier queue. The frontier serves as a collection of cities that
the AI will explore during the search process. Adding the start city to the frontier ensures that
the AI begins its exploration from the desired initial city.

 Maintain explored routes which is empty at the initial point elaborate it

When the explored routes database is empty at the initial point in a city navigation AI system,
it means that the AI has no prior knowledge of the city's road network or any pre-existing
information about the best routes to various destinations. At the start, the AI relies on other
available data sources and algorithms to determine the initial route. This could involve using
real-time traffic information, calculating shortest paths based on distance or time, or

40
considering user preferences and constraints. As the AI starts navigating through the city, it
begins to explore different routes in real-time. It collects data about the roads it traverses, the
distances traveled, the time taken, and any other relevant information. This information is
then used to update and populate the explored routes database.

For example, if the AI successfully reaches a destination, it records the route taken and the
associated metrics such as travel time, traffic conditions, or any notable landmarks along the
way. This information is stored in the explored routes database for future reference. By
exploring various routes and continuously updating the explored routes database, the AI
gradually builds a repository of knowledge about the city's road network. It starts to learn
which routes are more efficient, which roads are frequently congested, and which paths may
be more scenic or enjoyable. This accumulated knowledge enables the AI to make smarter
navigation decisions in the future. It can leverage the stored information to choose routes that
have proven to be faster, avoid known traffic bottlenecks, or suggest alternate paths based on
previous experiences. Over time, as more routes are explored and data is collected, the
explored routes database becomes more comprehensive and valuable. It serves as a valuable
resource for the AI to draw upon when making navigation decisions, resulting in improved
efficiency, accuracy, and user satisfaction. In summary, when the explored routes database is
empty at the initial point in a city navigation AI system, it means that the AI has no prior
knowledge of the city's road network. Through real-time exploration and continuous updates,
the AI collects data about routes traveled and stores this information in the explored routes
database, enabling it to make more informed navigation decisions in the future.

3. Looping till the frontier is not empty:

 Looping until the frontier is not empty refers to the iterative process of exploring
possible routes or locations until all reachable areas have been considered.
 Start with an initial location or destination as the starting point of exploration.
 Initialize the frontier with the starting point.
 Enter the loop.
 Check if the frontier is empty. If there are still unexplored locations or routes in the
frontier, proceed to the next step. Otherwise, exit the loop.
 Select a location or route from the frontier for further exploration.
 Expand the selected location or route to identify neighboring locations or potential
routes.

41
 Add the newly discovered locations or routes to the frontier.
 Repeat steps 4-7 until the frontier is empty.
 Exit the loop as all reachable areas or potential routes have been explored.

During each iteration of the loop, the AI system selects a location or route from the frontier
and expands it by considering neighboring areas or potential routes. This expansion process
allows the AI to explore new areas and expand its understanding of the city's road network.
By looping until the frontier is not empty, the AI ensures that it explores all reachable
locations and potential routes. This allows the system to consider different options, evaluate
alternative paths, and gather information about the city's road network in a systematic
manner. The exploration process may incorporate various factors, such as real-time traffic
data, user preferences, or constraints, to prioritize certain areas or routes. This helps the AI
make informed decisions about which locations or routes to explore next.

Overall, looping until the frontier is not empty in city navigation AI enables the system to
comprehensively explore the city's road network, identify efficient routes, and gather
valuable information about different areas. This iterative approach ensures a thorough
exploration of the city, resulting in more accurate and efficient navigation recommendations.

42
CHAPTER-4
OBSERVATIONS

Nowadays, ecommerce has changed the way of shopping. It's very easy for us to buy
anything from anywhere. Some of the companies have their own delivery system and some
use courier services. Talking about the shipping charge, every product has a different
shipping charge but why so, that is because products are coming from different places some
are far from your location some are near that’s how shipping charge is calculated. The farther
the place is, the greater the money will be required to deliver it, which includes the charge of
fuel used, delivery charges etc. In one day, a lot of deliveries are there and many times there
are not many delivery people to complete all deliveries, some of them travel with cycles too.
Due to lack of optimal scheduling of deliveries, the delivery people have to travel more.

We have used a simple dataset of North American (though mostly U.S.) major roads.

 The dataset of road-segments.txt has one line per road segment connecting two cities.
The space delimited fields are:
- first city
- second city
- length (in miles)
- speed limit (in miles per hour)
- name of highway

43
Fig.13 Road segment dataset

 The dataset of city-gps.txt contains one line per city, with three fields per line,
delimited by spaces. The first field is the city, followed by the latitude, followed by
the longitude.

Fig.14 City gps dataset

44
4.1 Comparison between DFS, BFS, and IDDFS:

1. Depth-First Search (DFS):

 Approach: DFS explores a graph by traversing as far as possible along each branch
before backtracking.
 Data Structure: It uses a stack to store and retrieve nodes.
 Memory Usage: DFS is memory-efficient as it only needs to store a single path from
the starting node to the current node.
 Completeness: DFS does not guarantee finding a solution if one exists.
 Optimality: DFS does not guarantee finding the shortest path.
 Time Complexity: The time complexity of DFS is O(V + E), where V is the number
of vertices and E is the number of edges in the graph.
 Use Cases: DFS is often used in scenarios where finding any solution is sufficient or
when memory usage is a concern.

2. Breadth-First Search (BFS):

 Approach: BFS explores a graph by systematically visiting all neighbors of a node


before moving to the next level of nodes.
 Data Structure: It uses a queue to store and retrieve nodes.
 Memory Usage: BFS may require more memory as it needs to store all nodes at each
level.
 Completeness: BFS is complete and guarantees finding a solution if one exists.
 Optimality: BFS guarantees finding the shortest path from the starting node to any
other reachable node.
 Time Complexity: The time complexity of BFS is O(V + E), similar to DFS.
 Use Cases: BFS is commonly used when finding the shortest path is a priority or
when the graph has a limited depth.

45
3. Iterative Deepening Depth-First Search (IDDFS):

 Approach: IDDFS is a hybrid algorithm that combines the advantages of DFS and
BFS.
 Data Structure: It uses a stack to store and retrieve nodes, similar to DFS.
 Memory Usage: IDDFS gradually increases the search depth, making it memory-
efficient compared to BFS.
 Completeness: IDDFS is complete and guarantees finding a solution if one exists.
 Optimality: IDDFS can find the shortest path like BFS when the depth of the solution
is known.
 Time Complexity: The time complexity of IDDFS is similar to BFS and DFS but may
require more iteration.
 Use Cases: IDDFS is suitable for large search spaces where memory limitations are a
concern, and the depth of the solution is unknown.

In summary, DFS is memory-efficient but not guaranteed to find the shortest path, BFS
guarantees finding the shortest path but may require more memory, and IDDFS offers a
balance between memory efficiency and optimality. The choice of algorithm depends on
the specific requirements of the problem, the characteristics of the graph, and the trade-
off between memory usage and the desired solution.

46
CHAPTER-5

RESULTS AND DISCUSSION

We have developed a web app that will show the shortest path to the delivery person based
on the selected cost function.

The home page of the web page is shown below:

Fig.15 Home Page

Fig.16 Menu Bar

The menu bar has the following sections:

 Home: showing the welcome page.

47
 About: Showing the introduction of team members.
 Navigate: This is showing the page that displays the result depending on the user’s
query.

The navigation page shows the fields that are to be input by the user as follows:

 The start city


 The end city
 Cost function

Fig.17 Input Fields

In the second step the user will enter the start city, end city and select the cost function.

48
Fig.18 Inputs

Based on the entered values, the algorithm will work and gives the required output as shown below.

Fig.19 Result

49
CHAPTER-6
CONCLUSION AND FUTURE SCOPE

The ACO algorithm is a powerful tool for finding the optimal path for logistics vehicles. The
algorithm can be used to minimize transportation costs by reducing the distance traveled, fuel
consumption, and travel time. The developed algorithm can have practical implications for
logistics companies, enabling them to optimize their resources and improve the quality of
service they offer to their clients. Future research could investigate further optimization of the
algorithm for different contexts, such as multi-objective optimization or incorporating traffic
conditions into the model.

The use of Ant Colony Optimization (ACO) in logistics has gained significant attention in
recent years due to its ability to find optimal paths for vehicles. This project aims to develop
an ACO-based algorithm and software that can identify the shortest path for logistics vehicles
while ensuring that all delivery locations are visited.

6.1 Future Scope


The following are some potential future scope areas for this project:

 Scalability: The current project focuses on finding the optimal path for a single
logistics vehicle. However, in real-world scenarios, logistics companies may have to
optimize the routes for a fleet of vehicles. Therefore, future work could focus on
developing ACO-based algorithms and software that can optimize routes for multiple
vehicles.
 Dynamic Routing: In the logistics industry, delivery locations and routes may change
due to various factors such as traffic congestion or weather conditions. Future work
could focus on developing ACO-based algorithms and software that can adapt to
changes in delivery locations and routes dynamically.
 Integration with IoT: The integration of Internet of Things (IoT) technologies with
logistics can provide real-time information on the location and status of vehicles.
Future work could focus on integrating ACO-based algorithms and software with IoT
technologies to provide more accurate and efficient optimization of logistics routes.

50
 Multi-objective Optimization: The current project focuses on minimizing the
distance traveled by logistics vehicles. However, logistics companies may have to
optimize their routes based on other objectives such as minimizing fuel consumption
or maximizing customer satisfaction. Future work could focus on developing ACO-
based algorithms and software that can perform multi-objective optimization for
logistics routes.
 Real-time Optimization: The optimization of logistics routes usually involves
solving complex optimization problems, which may take a considerable amount of
time. Future work could focus on developing ACO-based algorithms and software
that can perform real-time optimization of logistics routes to provide timely and
efficient delivery of goods.

The future scope of city navigation AI is vast and holds immense potential for advancements
in various areas. Here are some elaborations on the future scope of city navigation AI:

 Enhanced Routing Algorithms: Future city navigation AI systems can incorporate


more advanced routing algorithms that consider multiple factors beyond just distance
and traffic. These factors may include road quality, weather conditions, landmarks,
and user preferences. By considering a wide range of variables, AI algorithms can
generate more optimized and personalized routes for users.
 Integration with Smart Infrastructure: As cities become smarter and more
interconnected, city navigation AI can integrate with smart infrastructure systems.
This integration can include communication with traffic management systems,
parking systems, public transportation networks, and even smart buildings. By
leveraging data from these systems, AI algorithms can provide real-time information
and recommendations that seamlessly integrate with the urban environment.
 Multi-Modal Navigation: The future of city navigation AI lies in providing seamless
multi-modal navigation options. This includes integrating different modes of
transportation, such as walking, cycling, public transportation, and ridesharing, into a
unified navigation experience. AI algorithms can optimize routes that combine
multiple modes of transportation, considering factors like time, cost, convenience, and
environmental impact.
 Predictive Analytics: City navigation AI can leverage predictive analytics to
anticipate traffic patterns and congestion. By analyzing historical data, weather
conditions, and events, AI algorithms can predict traffic congestion and suggest
51
alternative routes or departure times to avoid delays. This proactive approach can
significantly improve the accuracy and efficiency of navigation systems.

 Personalized User Experience: Future city navigation AI systems can provide highly
personalized user experiences. By considering individual preferences, such as favorite
locations, preferred modes of transportation, or specific interests, AI algorithms can
tailor navigation recommendations and provide customized suggestions for places to
visit, events, or attractions that align with the user's preferences.
 Integration with Augmented Reality (AR): Augmented reality technology can
transform the way we navigate cities. By integrating AR into city navigation AI
systems, users can receive real-time visual overlays of navigation instructions, points
of interest, and other relevant information directly in their field of view. This can
enhance situational awareness and make navigation more intuitive and immersive.
 Sustainability and Eco-Friendly Navigation: Future city navigation AI systems can
emphasize sustainability by promoting eco-friendly transportation options. AI
algorithms can provide recommendations for routes that prioritize public
transportation, walking, or cycling, reducing carbon emissions and promoting
healthier and greener modes of travel.
 Social Integration and Crowd-Sourced Data: City navigation AI can tap into
crowd-sourced data and social integration to provide real-time information on traffic,
road conditions, and points of interest. By leveraging user-generated data, AI
algorithms can keep users informed about live events, road closures, accidents, and
other relevant updates, ensuring more accurate and up-to-date navigation information.
 Natural Language Processing (NLP) and Voice Interaction: Future city navigation
AI systems can employ natural language processing and voice interaction capabilities.
Users can interact with the AI system using voice commands, allowing for hands-free
and more intuitive navigation experiences. NLP can also enable the AI system to
understand and respond to more complex queries, making the interaction more
conversational and user-friendly.

52
53
CHAPTER-7
REFERENCES

[1] Dorigo, M., Birattari, M., &Stützle, T. (2006). Ant colony optimization. IEEE
Computational Intelligence Magazine, 1(4), 28-39.
[2] Dorigo, M., & Blum, C. (2005). Ant colony optimization theory: A survey. Theoretical
Computer Science, 344(2-3), 243-278.
[3] Ghiani, G., Laporte, G., & Musmanno, R. (2004). Introduction to logistics systems
planning and control. John Wiley & Sons.
[4] Sweigart, A. (2015). Automate the Boring Stuff with Python: Practical Programming for
Total Beginners. No Starch Press.
[5] Shalev-Shwartz, S., & Ben-David, S. (2014). Understanding Machine Learning: From
Theory to Algorithms. Cambridge University Press.
[6] Laporte, G. (2009). The vehicle routing problem: An overview of exact and approximate
algorithms. European Journal of Operational Research, 192(1), 1-8.
[7] Duckett, J. (2014). HTML and CSS: Design and Build Websites. John Wiley & Sons.
[8] Holovaty, A., & Kaplan-Moss, J. (2009). The Definitive Guide to Django: Web
Development Done Right. Apress.
[9] Solomon, M. M. (1987). Algorithms for the vehicle routing and scheduling problems with
time window constraints. Operations Research, 35(2), 254-265.
[10] Mele, A. (2020). Django for Professionals: Production websites with Python & Django.
Independently published.
[11] Huang, H., & Zhang, K. (2019). An intelligent transportation system with deep learning
techniques: A review. IEEE Access, 7, 77996-780.
[12] Shen, H., & Ye, X. (2020). A deep reinforcement learning approach for intelligent
transportation system: An overview. IEEE Access, 8, 84071-84082.
[13] Park, S., & Kim, J. (2018). Intelligent city navigation using deep learning and visual
recognition techniques. Journal of Advanced Transportation, 2018.
[14] Deng, Y., & Yu, H. (2020). Intelligent transportation systems and artificial intelligence:
A literature review. IEEE Transactions on Intelligent Transportation Systems, 21(2), 803-
819.
[15] Xu, S., & Zhang, K. (2020). AI-based recommendation system for urban transportation:
Challenges and opportunities. IEEE Access, 8, 71376-71389.
[16] Liu, W., & Ma, Z. (2019). A navigation optimization model for smart cities based on
artificial intelligence. IEEE Access, 7, 105092-105103.

54
[17] Li, Y., & Huang, X. (2019). A smart city navigation system based on GPS and real-time
data mining. 2019 3rd IEEE International Conference on Computer and Communication
Systems (ICCCS), Singapore, pp. 388-392.
[18] Kwon, O. W., Kim, J. S., & Lee, S. J. (2020). Deep reinforcement learning-based
intelligent navigation system for smart cities. Sensors, 20(19), 5503.
[19] Chen, D., & Wei, B. (2019). An AI-based city navigation system using natural language
processing and augmented reality. Journal of Advanced Transportation, 2019.
[20] Kim, J., Lim, J., & Park, S. (2019). AI-based autonomous navigation for urban
environments. Journal of Advanced Transportation, 2019.

55

You might also like