Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 197 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

8 changes: 0 additions & 8 deletions .idea/Rover-Domain.iml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

109 changes: 74 additions & 35 deletions AADI_RoverDomain/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This file contains all constant test parameters which may be altered from this single
location for convenience.
"""
import yaml


class Parameters:
Expand All @@ -10,38 +11,76 @@ class Parameters:
TODO: Heterogeneous rover domain code currently not implemented
"""

# Run Parameters
stat_runs = 10
generations = 1000 # Number of generations for CCEA in each stat run
new_world_config = False # False -> Reuse existing world config, True -> Use new world config

# Visualizer
running = False # True keeps visualizer from closing until you 'X' out of window

# Domain parameters
team_types = 'homogeneous' # Switch between 'homogeneous' and 'heterogeneous' rover domains
num_rovers = 12 # Number of rovers on map (GETS MULTIPLIED BY NUMBER OF TYPES)
coupling = 3 # Number of rovers required to view a POI for credit
num_pois = 10 # Number of POIs on map
num_steps = 20 # Number of steps rovers take each episode
min_distance = 1.0 # Minimum distance which may appear in the denominator of credit eval functions
x_dim = 30 # X-Dimension of the rover map
y_dim = 30 # Y-Dimension of the rover map
min_observation_dist = 3.0 # Minimum distance rovers must be to observe POIs
angle_resolution = 90 # Resolution of sensors (determines number of sectors)
sensor_model = "summed" # Should either be "density" or "closest" or "summed"

# Neural network parameters
num_inputs = 8
num_nodes = 9
num_outputs = 2

# CCEA parameters
mutation_rate = 0.1 # Probability that a member of the offspring population will be mutated
percentage_mut = 0.01 # Percentage of bits which get flipped in an individual
epsilon = 0.1 # For e-greedy selection in CCEA
parent_pop_size = 20
offspring_pop_size = 5

# User specific parameters
reward_type = "SDPP" # Switch between reward functions "Global" "Difference" "DPP" "SDPP"
def __init__(self):
# Run Parameters
self.stat_runs = 10
self.generations = 1000 # Number of generations for CCEA in each stat run
self.new_world_config = False # False -> Reuse existing world config, True -> Use new world config

# Visualizer
self.running = False # True keeps visualizer from closing until you 'X' out of window

# Domain parameters
self.team_types = 'homogeneous' # Switch between 'homogeneous' and 'heterogeneous' rover domains
self.num_rovers = 12 # Number of rovers on map (GETS MULTIPLIED BY NUMBER OF TYPES)
self.coupling = 3 # Number of rovers required to view a POI for credit
self.num_pois = 10 # Number of POIs on map
self.num_steps = 20 # Number of steps rovers take each episode
self.min_distance = 1.0 # Minimum distance which may appear in the denominator of credit eval functions
self.x_dim = 30 # X-Dimension of the rover map
self.y_dim = 30 # Y-Dimension of the rover map
self.min_observation_dist = 3.0 # Minimum distance rovers must be to observe POIs
self.angle_resolution = 90 # Resolution of sensors (determines number of sectors)
self.sensor_model = "summed" # Should either be "density" or "closest" or "summed"

# Neural network parameters
self.num_inputs = 8
self.num_nodes = 9
self.num_outputs = 2

# CCEA parameters
self.mutation_rate = 0.1 # Probability that a member of the offspring population will be mutated
self.percentage_mut = 0.01 # Percentage of bits which get flipped in an individual
self.epsilon = 0.1 # For e-greedy selection in CCEA
self.parent_pop_size = 20
self.offspring_pop_size = 5

# User specific parameters
self.reward_type = "SDPP" # Switch between reward functions "Global" "Difference" "DPP" "SDPP"

def load_yaml(self, filename):
"""
loads a set of parameters into this object with setattr
Does not require that all parameters are set, i.e. you can optionally set a specific set of parameters
:param filename:
:return:
"""
with open(file=filename) as f:
params = yaml.load(f)
for key in params:
setattr(self, key, params[key])

def save_yaml(self, filename):
"""
Saves ALL the parameters into a yaml file, not just the optionally set ones
:param filename:
:return:
"""
with open(file=filename, mode='w') as f:
yaml.dump(vars(self), f)

if __name__ == '__main__':
with open("/tmp/param_tests.yaml", 'w') as f:
f.write("""
test_a: 10
stat_runs: 100
""")
parameters = Parameters()
print("Before load")
print(parameters.stat_runs)
parameters.load_yaml("/tmp/param_tests.yaml")
print("After load")
print(parameters.test_a)
print(parameters.stat_runs)
parameters.save_yaml("/tmp/param_tests_out.yaml")