This project provides a solution to the Blocks World problem using informed and uninformed search algorithms. The program reads a problem description in PDDL (Planning Domain Definition Language), parses the data, and solves the problem using the specified search algorithm.
To execute the program, use the following command:
java -jar blocksworld.jar <algorithm> <input-file> <output-file>-
Parsing:
- Reads the input
.pddlfile. - Displays:
- The initial state.
- The goal state.
- The parsing time.
- Reads the input
-
SIGAlarm Thread:
- Starts a
SIGAlarmthread to terminate execution if it exceeds 60 seconds.
- Starts a
-
Search Execution:
- Executes the specified search algorithm as per the command-line arguments.
-
Output:
- Displays:
- The time taken to find the solution.
- The sequence of moves (stored in the output file).
- Displays:
-
Completion:
- Terminates the
SIGAlarmthread.
- Terminates the
- Explores all nodes level by level.
- Always finds the optimal solution.
- High memory consumption, making it impractical for large problems.
- Efficient for small problems.
- Struggles with large and complex cases due to memory constraints.
- Problem:
prodBLOCKS.4.0.pddl
- Uses recursion to explore as deep as possible before backtracking.
- Does not guarantee optimal solutions.
- Requires less memory compared to BFS.
- Risk of stack overflow for large problems.
- Use the JVM flag
-Xss128mto increase the stack size for larger problems.
- Fast but often produces suboptimal solutions, especially for complex problems.
- Problem:
prodBLOCKS.7.1.pddl
- A greedy algorithm that expands nodes with the lowest heuristic value.
- Does not guarantee optimal solutions.
- Solved all tested problems up to
probBlocks-60-1.pddl. - Fastest among all algorithms.
- Problem:
prodBLOCKS-60-1.pddl
- Combines path cost and heuristic value to choose the next node.
- Balances between BFS and Best-First Search.
- Slower than Best-First Search but faster than BFS.
- Finds near-optimal solutions but not always the best due to the chosen heuristic function.
- Problem:
prodBLOCKS-45-0.pddl
Special thanks to 0xD10 for the motivation to proceed with this project and for inspiring me to make it even better.