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.
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.
-
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
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
The project follows a layered, modular architecture:
Contains pure data models and utility functions.
Examples:
SmartFlowerProblemPavilionSpecStateData- Vector and distance utilities
Contains reusable search and planning services.
Examples:
- Problem indexing
- Heuristic calculation
- Feasibility checking
- Load/unload generation
- State management
- Duplicate and dominance pruning
Contains the main Experta engine composition and fact definitions.
Examples:
- Experta facts
- Planner engine
- Integration between rules and core services
Contains Experta rule mixins.
Examples:
- Initialization rules
- Movement rules
- Load rules
- Unload rules
- Validation rules
- A* search control rules
Clone the repository:
git clone https://github.com/YOUR_USERNAME/smart-flower-exhibition-planner.git
cd smart-flower-exhibition-plannerInstall dependencies:
pip install -r requirements.txtThe 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.
Run the project from the root directory:
python app.pySolution 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
gcost.
- Python
- Experta
- A* Search
- Rule-Based Systems
- Knowledge-Based Systems
- Heuristic Search
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.
This project is intended for academic and educational use.