Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dizys/nyu-ai-lab-1
NYU Artificial Intelligence Course Lab 1: Build a generic hill-climbing solver
https://github.com/dizys/nyu-ai-lab-1
artificial-intelligence hill-climbing nyu python
Last synced: 15 days ago
JSON representation
NYU Artificial Intelligence Course Lab 1: Build a generic hill-climbing solver
- Host: GitHub
- URL: https://github.com/dizys/nyu-ai-lab-1
- Owner: dizys
- License: gpl-3.0
- Created: 2022-02-10T06:14:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-10T23:53:45.000Z (over 2 years ago)
- Last Synced: 2024-12-20T20:03:08.678Z (21 days ago)
- Topics: artificial-intelligence, hill-climbing, nyu, python
- Language: Python
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nyu-ai-lab-1
NYU Artificial Intelligence Course Lab 1: Build a generic hill-climbing solver.
## Prerequisite
- Python 3.8+
## Getting-started
### Switch to Python 3.8 on CIMS machines
The Python version has to at least have Protocol support, thus requiring Python 3.8+.
```bash
module load python-3.8
```If successful, the command `python3 --version` should give you:
```bash
$ python3 --version
Python 3.8.6
```### Script usages
> The main entrance is a python script, not a binary. It is in Shebang style,
> thus can be executed directly.Use `./hill_climb -h` command to see the usage:
```
usage: hill_climb [-h] [-n N] [-k K] [--verbose] [--sideways SIDEWAYS]
[--restarts RESTARTS]A generic hill climbing solver written in Python. Has built-in support
for N-Queens and Knapsack problems.optional arguments:
-h, --help show this help message and exit
-n N N queens problem only: number of queens
-k K Knapsack problem only: input json filename
--verbose verbose output
--sideways SIDEWAYS number of sideways moves allowed
--restarts RESTARTS number of random restarts allowed
```Use `-n N` to use N-Queens solver, or `-k K` to use Knapsack solver.
Examples:
```bash
$ ./hill_climb -n 4
``````bash
$ ./hill_climb -k knapsack.json --verbose
``````bash
$ ./hill_climb -k knapsack.json --verbose --sideways 5
```## Project structure
```
project
├─hill_climbing hill_climbing python module
│ ├─__init__.py Module initialization
│ ├─hill_climbing.py Generic Hill climbing solver and state protocol
│ ├─knapsack.py Knapsack problem state class
│ └─n_queens.py N-Queens problem state class
│
├─hill_climb Main entrance python script (shebang style)
└─README.md The file you're reading
```