Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Smart Flower Exhibition Planner

Smart Flower Exhibition Planner is a modular rule-based expert system that uses Experta and A* search to plan robot movement, bouquet loading, unloading, and delivery inside a flower exhibition grid.

The system models a robot that starts from an initial position, visits a warehouse to load flower bouquets, moves through a grid, and delivers the required bouquets to multiple pavilions while respecting loading, capacity, and unloading constraints. The final output is minimal and clean: the optimal sequence of actions and the total path cost.


Overview

The project solves a knowledge-based planning problem using a clean expert-system architecture.

The robot can:

  • Move right, left, up, and down inside the grid.

  • Load bouquets only at the warehouse.

  • Respect loading constraints:

    • Same flower type with different colors.
    • Same color with different flower types.
  • Unload only bouquets that match pavilion requirements.

  • Perform full or partial pavilion deliveries.

  • Search for an optimal path using A* with an admissible heuristic.

  • Print only the final solution path and total cost.


Features

  • Rule-based expert system using Experta.

  • A* search with g(n) + h(n) cost evaluation.

  • Modular and SOLID-compliant project structure.

  • Compact state representation for faster duplicate detection.

  • Dominance pruning for unnecessary state elimination.

  • Optimized load and unload generation.

  • Clean separation between:

    • Domain models
    • Core search services
    • Experta engine
    • Rule definitions
  • Minimal final output:

    • Solution path
    • Total path cost

Folder Structure

smart_flower_project/
│
├── app.py
├── requirements.txt
│
└── smart_flower/
    ├── __init__.py
    ├── compatibility.py
    │
    ├── domain/
    │   ├── __init__.py
    │   ├── models.py
    │   ├── problem_factory.py
    │   └── utils.py
    │
    ├── core/
    │   ├── __init__.py
    │   ├── services.py
    │   └── state_manager.py
    │
    ├── engine/
    │   ├── __init__.py
    │   ├── facts.py
    │   └── planner.py
    │
    └── rules/
        ├── __init__.py
        ├── actions.py
        ├── initialization.py
        ├── search_control.py
        └── validation.py

Architecture

The project follows a layered, modular architecture:

domain/

Contains pure data models and utility functions.

Examples:

  • SmartFlowerProblem
  • PavilionSpec
  • StateData
  • Vector and distance utilities

core/

Contains reusable search and planning services.

Examples:

  • Problem indexing
  • Heuristic calculation
  • Feasibility checking
  • Load/unload generation
  • State management
  • Duplicate and dominance pruning

engine/

Contains the main Experta engine composition and fact definitions.

Examples:

  • Experta facts
  • Planner engine
  • Integration between rules and core services

rules/

Contains Experta rule mixins.

Examples:

  • Initialization rules
  • Movement rules
  • Load rules
  • Unload rules
  • Validation rules
  • A* search control rules

Installation

Clone the repository:

git clone https://github.com/YOUR_USERNAME/smart-flower-exhibition-planner.git
cd smart-flower-exhibition-planner

Install dependencies:

pip install -r requirements.txt

Requirements

The project requires Python and Experta.

experta

If you are using Python 3.10 or newer, the project includes a compatibility patch for Experta dependencies that still reference older collections imports.


How to Run

Run the project from the root directory:

python app.py

Example Output

Solution path:
1. move_left
2. move_down
3. load [Rose:Redx2, Rose:Pinkx1, Rose:Whitex1]
4. move_down
5. move_down
6. unload_full P1 [Rose:Redx2, Rose:Pinkx1, Rose:Whitex1]
...
Total cost: 23

The exact output may vary depending on the problem configuration and heuristic tie-breaking, but the system prints only:

  • The final action sequence.
  • The total final g cost.

Main Technologies

  • Python
  • Experta
  • A* Search
  • Rule-Based Systems
  • Knowledge-Based Systems
  • Heuristic Search

Project Purpose

This project was developed as a knowledge-based systems assignment to demonstrate how rule-based reasoning can be combined with search algorithms to solve planning and optimization problems.

The main objective is to generate an optimal delivery plan for a robot operating in a flower exhibition grid while satisfying all pavilion bouquet requirements with minimum total cost.


License

This project is intended for academic and educational use.

About

A modular rule-based expert system using Experta and A* search to plan optimal robot delivery paths in a smart flower exhibition grid.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages