In this project, we utilize simple Python functions to generate logical sentences describing Pacman physics (pacphysics) and employ a SAT solver, pycosat, to solve various logical inference tasks. These tasks include:
- Planning: Generating action sequences for Pacman to reach goal locations and eat all the dots.
- Localization: Determining Pacman's location on the map given a local sensor model.
- Mapping: Building the map from scratch.
- SLAM: Simultaneous localization and mapping.
The assignment includes an autograder to facilitate grading answers locally. Use the command:
python autograder.py
logicPlan.py
: Main file where logical agent code is implemented.
logic.py
: Contains propositional logic code with utility functions.logicAgents.py
: Defines logical planning problems for Pacman.pycosat_test.py
: Tests pycosat module installation.game.py
: Simulator code for Pacman world, particularly theGrid
class.
pacman.py
: Main file for running Pacman games.logic_util.py
: Utility functions forlogic.py
.util.py
: General utility functions.logic_planTestClasses.py
: Project-specific autograding test classes.graphicsDisplay.py
: Graphics for Pacman.graphicsUtils.py
: Support for Pacman graphics.textDisplay.py
: ASCII graphics for Pacman.ghostAgents.py
: Agents controlling ghosts.keyboardAgents.py
: Keyboard interface to control Pacman.layout.py
: Code for reading and storing layout files.autograder.py
: Project autograder.testParser.py
: Parses autograder test and solution files.testClasses.py
: General autograding test classes.
Your code will be autograded for technical correctness. Adhere to function and class naming conventions to avoid autograder issues. Your implementation's correctness will ultimately determine your score.
Submit original work. We will use code similarity detection tools to identify plagiarism.
Utilize course resources, including office hours, section, and discussion forums for support.
The project score totals 100 points. Each section's score is multiplied by 4, with the last question offering 2 extra credit points.
- sentence1(): Represents a conjunction of three given sentences.
- sentence2(): Represents a conjunction of four given sentences.
- sentence3(): Creates symbols and an expression encoding three English sentences as propositional logic.
- findModelCheck(): Mimics
findModel
output. - entails(premise, conclusion): Determines if the premise entails the conclusion.
- plTrueInverse(assignments, inverse_statement): Evaluates the inverse statement given assignments.
- atLeastOne(literals): Returns an expression true if at least one literal is true.
- atMostOne(literals): Returns an expression true if at most one literal is true.
- exactlyOne(literals): Returns an expression true if exactly one literal is true.
- pacmanSuccessorAxiomSingle: Defines conditions for Pacman’s location at time t.
- pacphysicsAxioms: Generates pacphysics axioms.
- checkLocationSatisfiability: Returns models proving Pacman's possible and impossible locations.
- positionLogicPlan(problem): Generates action sequences to reach the goal.
- foodLogicPlan(problem): Generates action sequences to eat all the food.
- localization(problem, agent): Yields possible locations at each timestep.
- mapping(problem, agent): Yields map knowledge at each timestep.
- slam(problem, agent): Yields map knowledge and possible locations at each timestep.
To install the required pycosat
module:
- Activate your conda environment:
conda activate cap4621
- Install pycosat:
pip install pycosat
or
conda install -c anaconda pycosat
Test installation:
python pycosat_test.py