This repository contains Python scripts for solving constraint satisfaction problems and pathfinding problems. The scripts are organized into different directories based on their functionality and purpose.
The repository is structured as follows:
enunciado/: Contains various Python scripts for different problems.alumnos.py: Script for solving a constraint satisfaction problem involving students.n-queens.py: Script for solving the N-queens problem using constraint processing.n-queens-fun.py: Modified version ofn-queens.pywith a different approach.sum-words.py: Script for solving a sum-words brain teaser using constraint processing.
parte-1/: Contains scripts and test files for the first part of the project.CSP-calls.sh: Shell script for running tests related to constraint satisfaction problems.CSP-tests/: Directory containing test files for constraint satisfaction problems.CSPMaintenance.py: Python script for solving maintenance scheduling problems using constraint processing.
parte-2/: Contains scripts and test files for the second part of the project.ASTAR-calls.sh: Shell script for running tests related to pathfinding problems.ASTAR-tests/: Directory containing test files for pathfinding problems.ASTARRodaje.py: Python script for solving pathfinding problems using the A* algorithm.
.gitignore: Specifies files and directories to be ignored by Git.requirements.txt: Lists the dependencies required for the project.
To set up the environment and install the dependencies, follow these steps:
-
Clone the repository:
git clone https://github.com/liangjizhu/heuristica.git cd heuristica -
Create a virtual environment:
python3 -m venv .venv source .venv/bin/activate -
Install the dependencies:
pip install -r requirements.txt
To run the constraint satisfaction problem scripts, use the following commands:
-
alumnos.py:python enunciado/alumnos.py
-
n-queens.py:python enunciado/n-queens.py
-
n-queens-fun.py:python enunciado/n-queens-fun.py
-
sum-words.py:python enunciado/sum-words.py
To run the maintenance scheduling problem script, use the following command:
python parte-1/CSPMaintenance.py <ruta_fichero_entrada>To run the pathfinding problem script, use the following command:
python parte-2/ASTARRodaje.py <path mapa.csv> <num-h>To run the tests, use the following commands:
-
Constraint Satisfaction Problem Tests:
bash parte-1/CSP-calls.sh
-
Pathfinding Problem Tests:
bash parte-2/ASTAR-calls.sh