Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaiswalchitransh/ucs-with-best-first-search
Implementation of UCS on Romania to find shortest distance from Arad to Bucharest based on best-first search algorithm. It uses a dictionary that stores current city mapped to (parent city, current best distance), and frontier is a priority queue to process nodes containing (node id, current city, priority value).
https://github.com/jaiswalchitransh/ucs-with-best-first-search
artificial-intelligence best-first-search heuristic-search-algorithms heuristics project python python-3 python3 searching-algorithms ucs uniform-cost-search
Last synced: 24 days ago
JSON representation
Implementation of UCS on Romania to find shortest distance from Arad to Bucharest based on best-first search algorithm. It uses a dictionary that stores current city mapped to (parent city, current best distance), and frontier is a priority queue to process nodes containing (node id, current city, priority value).
- Host: GitHub
- URL: https://github.com/jaiswalchitransh/ucs-with-best-first-search
- Owner: jaiswalchitransh
- Created: 2024-02-06T18:17:39.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-08-28T20:39:52.000Z (5 months ago)
- Last Synced: 2024-11-05T22:42:27.981Z (2 months ago)
- Topics: artificial-intelligence, best-first-search, heuristic-search-algorithms, heuristics, project, python, python-3, python3, searching-algorithms, ucs, uniform-cost-search
- Language: Python
- Homepage:
- Size: 241 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# UCS with Best-First Search
## Table of Contents
- [Project Overview](#project-overview)
- [Installation](#installation)
- [Usage](#usage)
- [Features](#features)
- [Contribution](#contribution)## Project Overview
This Python script implements Uniform Cost Search (UCS) with Best-First Search to find the shortest path from the city of Arad to Bucharest in Romania. It utilizes classes and functions to represent nodes, the problem, and search algorithms.
The `Node` class represents a node in the search tree with attributes such as state, depth, parent, id, path cost, and cumulative distance. It includes an `expand()` method to generate child nodes based on the problem's successor function.
The `Problem` class initializes the problem with the initial state (Arad) and the goal state (Bucharest). It includes methods `goal_test()` to check if a state is the goal state and `get_successors()` to provide successors for a given state based on the map of Romania.## Installation
This project requires Python 3.12.1 or later.
To set up the project:
1. Ensure Python 3.12.1 or a later version is installed on your system. You can download Python from [python.org](https://www.python.org/downloads/).
2. Clone or download the repository to your local machine.git clone https://github.com/jaiswalchitransh/UCS-with-Best-First-Search.git
3. Open the project in your preferred Python environment (e.g., IDE or terminal).
4. Run the script (`UCS.py`) and observe the output to see the valid coloring of regions.## Usage
Run the script:python UCS.py
This executes the UCS with Best-First Search algorithm to find the shortest path from Arad to Bucharest in the Romania map graph.## Features
- **Implementation**: Implements UCS using Best-First Search for optimal pathfinding.
- **Output**: Outputs the shortest path and distance from Arad to Bucharest.
- **Demonstration**: Utilizes a priority queue for managing frontier nodes efficiently.## Contribution
I, **[Chitransh Jaiswal](https://www.linkedin.com/in/jaiswalchitransh/)** developed this Project Individually. I was responsible for all aspects of the project, including design, development, testing, and documentation.
Contributions to improve the efficiency, readability, or functionality of the code are welcome. To contribute:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature/your-feature`).
3. Make your changes.
4. Commit your changes (`git commit -am 'Add some feature'`).
5. Push to the branch (`git push origin feature/your-feature`).
6. Create a new Pull Request.Please ensure your contributions adhere to the coding standards and follow the existing style and structure.
---
Thank you for your interest in the UCS with Best-First Search!