https://github.com/thebutlah/projectmars
An AI simulation to plan infrastructure for a growing human population.
https://github.com/thebutlah/projectmars
artificial-intelligence clustering deep-q-network neural-network q-map-network reinforcement-learning
Last synced: about 1 month ago
JSON representation
An AI simulation to plan infrastructure for a growing human population.
- Host: GitHub
- URL: https://github.com/thebutlah/projectmars
- Owner: TheButlah
- Created: 2018-02-13T02:14:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-08T00:10:17.000Z (about 7 years ago)
- Last Synced: 2025-08-31T21:57:52.035Z (10 months ago)
- Topics: artificial-intelligence, clustering, deep-q-network, neural-network, q-map-network, reinforcement-learning
- Language: C++
- Homepage:
- Size: 1.47 MB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: licenses/LICENSE-INIReader.txt
Awesome Lists containing this project
README
# Project MARS
Project MARS is an exploration of near-optimally designing electricity grids amidst a growing population of people. The algorithms used include Deep Q Learning, K-Means and K-Medians clustering, and a custom population growth model. We also simulate several growth patterns for people spreading across a terrain, and hope to learn how to place power stations to support the population. We factor in population density, financial constraints, power station supply constraints, and consumer preference to model the economics and social benefit behind how power stations are built in the real world.
## Installing SDL2 (tested on Windows 10)
We use SDL2 to display our graphics. For now, we do a sort of "manual" install of the development library since this has only been tested on Windows 10.
1. At the [site](https://www.libsdl.org/download-2.0.php), go to the "Development Libraries" section.
2. Download and unzip `SDL2-devel-2.0.8-mingw.tar.gz` completely.
3. In it there's a folder called `x86_64-w64-mingw32`, drag it into this project and rename it to `sdl`.
4. You should be able to build our SDL executable using the instructions below.
## Requirements
You will need a C++ compiler, such as `g++` or `clang++`, that supports C++11. You will also need CMake (`cmake`) installed.
If you wish to use the Deep Q Network, you will also need to install Python3, TensorFlow, NumPy, xxhash, and pybind11.
## Build
We use CMake for our build system. As such, you will need to create a `build` directory from which to run CMake and build executables.
If you are only interested in the reinforcement learning agent however, you should invodke `python setup.py install` and then run `main.py`.
After cloning, create the `build` directory.
```
mkdir build
```
And create a basic configuration for running the simulator as a CLI.
```
cp config.ini.in config.ini
```
## Running the CLI
When running the command line interface, we must pass in a configuration file as an argument to the program. If you created the configuration file as described by the Build section, and you compiled the `cli` program in the `build` directory, then running the CLI should be as simple as:
```
./cli ../config.ini
```
## macOS and Linux
The steps to build on macOS and Linux are the simplest. Run the following commands:
```
cd build # Assuming you're at the root of the project.
cmake .. # Run CMake, and tell it to look for a CMakeLists.txt in the directory above.
make # CMake generates Makefiles for use to make.
```
## Windows 10 + MinGW (no Git Bash)
On Windows 10 with MinGW *but no Git Bash*, CMake must be told to use the MinGW generator so it can take advantage of the MinGW toolset. The formal commands:
```
cmake .. -G "MinGW Makefiles"
```
which has been placed in `build-mingw.bat` for convenience.
```
cd build # Assuming you're at the root of the project
..\build-mingw.bat # Run CMake, and specify that we need MinGW-compatible makefiles
mingw32-make # Use MinGW's make tool, which is called mingw32-make. Why? Lord knows.
```
## Windows 10 + MinGW + Git Bash
On Windows 10 with MinGW and Git Bash, CMake will complain about how `sh.exe` is on the path when running the previous commands. We need to use the MSYS generator for CMake, but specify the `make` tool manually for CMake. Sounds overcomplicated? I agree.
The command is:
```
cmake .. -DCMAKE_MAKE_PROGRAM=mingw32-make -G "MSYS Makefiles"
```
which has been placed in `build-mingw-sh.bat` for convenience
```
cd build # Assuming you're at the root of the project
..\build-mingw-sh.bat # This is much shorter than above :D
mingw32-make # Use MinGW's make tool
```