Skip to content

Commit

Permalink
Switching to MPL 2.0 license
Browse files Browse the repository at this point in the history
  • Loading branch information
Biological Compatibility Benchmarks committed Nov 11, 2024
1 parent aad5536 commit fbfb906
Show file tree
Hide file tree
Showing 52 changed files with 676 additions and 681 deletions.
1,047 changes: 373 additions & 674 deletions LICENSE.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Aintelope code base is compatible with Windows. No extra steps needed. GPU compu

# License

This project is licensed under the GNU General Public License v3.0 (GPLv3). You are free to use, modify, and distribute this code under the terms of this license.
This project is licensed under the Mozilla Public License 2.0. You are free to use, modify, and distribute this code under the terms of this license.

**Attribution Requirement**: If you use this benchmark suite, please cite the source as follows:

Roland Pihlakas and Joel Pyykkö. From homeostasis to resource sharing: Biologically and economically compatible multi-objective multi-agent AI safety benchmarks. Arxiv, a working paper, September 2024.
Roland Pihlakas and Joel Pyykkö. From homeostasis to resource sharing: Biologically and economically compatible multi-objective multi-agent AI safety benchmarks. Arxiv, a working paper, September 2024 (https://arxiv.org/abs/2410.00081).

**Use of Entire Suite**: We encourage the inclusion of the entire benchmark suite in derivative works to maintain the integrity and comprehensiveness of AI safety assessments.

Expand Down
5 changes: 5 additions & 0 deletions aintelope/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks
6 changes: 6 additions & 0 deletions aintelope/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import os
import copy
import logging
Expand Down
6 changes: 6 additions & 0 deletions aintelope/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from typing import Mapping, Type
from aintelope.agents.abstract_agent import Agent
from aintelope.agents.example_agent import ExampleAgent
Expand Down
6 changes: 6 additions & 0 deletions aintelope/agents/abstract_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from abc import ABC, abstractmethod
from typing import Optional, Tuple, Union
import numpy.typing as npt
Expand Down
6 changes: 6 additions & 0 deletions aintelope/agents/example_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import csv
import logging
from typing import List, Optional, Tuple
Expand Down
6 changes: 6 additions & 0 deletions aintelope/agents/q_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import logging
from typing import List, NamedTuple, Optional, Tuple
from gymnasium.spaces import Discrete
Expand Down
6 changes: 6 additions & 0 deletions aintelope/aintelope_typing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from typing import Dict, Union

import gymnasium as gym
Expand Down
6 changes: 6 additions & 0 deletions aintelope/analytics/gridsearch_analytics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import os
import sys
import copy
Expand Down
6 changes: 6 additions & 0 deletions aintelope/analytics/merge_gridsearch_result_files.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import os
import copy
import json
Expand Down
6 changes: 6 additions & 0 deletions aintelope/analytics/plotting.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import os

from typing import Optional
Expand Down
6 changes: 6 additions & 0 deletions aintelope/analytics/recalculate_gridsearch_sfella_scores.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import os
import copy
import json
Expand Down
6 changes: 6 additions & 0 deletions aintelope/analytics/recording.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import csv
import logging
import os
Expand Down
6 changes: 6 additions & 0 deletions aintelope/analytics/remove_trials_from_results.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import os
import copy
import json
Expand Down
5 changes: 5 additions & 0 deletions aintelope/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks
6 changes: 6 additions & 0 deletions aintelope/config/config_experiment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

timestamp: ${now:%Y%m%d%H%M%S} # TODO: currently this applies only to log_dir name, not to checkpoint filename. Checkpoint filename timestamp format is hardcoded in dqn_training.py
timestamp_pid_uuid: ${append_pid_and_uuid:${timestamp}}
experiment_name: experiment
Expand Down
8 changes: 7 additions & 1 deletion aintelope/config/config_experiment_exampleagent.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

timestamp: ${now:%Y%m%d%H%M%S} # TODO: currently this applies only to log_dir name, not to checkpoint filename. Checkpoint filename timestamp format is hardcoded in dqn_training.py
timestamp_pid_uuid: ${append_pid_and_uuid:${timestamp}}
experiment_name: experiment
Expand Down Expand Up @@ -42,7 +48,7 @@ hparams:
num_iters: 400 # duration of a single episode. NB! warm_start_steps will be subtracted from this value
env_experiment: ai_safety_gridworlds.aintelope_savanna
level: 0
map_max: 7 # used for old AIntelope environment
map_max: 7
map_width: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_width - 2.
map_height: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_height - 2.
#
Expand Down
6 changes: 6 additions & 0 deletions aintelope/config/config_experiment_random.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

timestamp: ${now:%Y%m%d%H%M%S} # TODO: currently this applies only to log_dir name, not to checkpoint filename. Checkpoint filename timestamp format is hardcoded in dqn_training.py
timestamp_pid_uuid: ${append_pid_and_uuid:${timestamp}}
experiment_name: experiment
Expand Down
8 changes: 7 additions & 1 deletion aintelope/config/config_gridsearch_exampleagent.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

hparams:
gridsearch_trial_no: ${range:0,100} # used just to repeat same experiment multiple times
params_set_title: "exampleagent"
Expand All @@ -9,7 +15,7 @@ hparams:
test_episodes: 10 # will be added to train episodes
env_params:
num_iters: [300, 400] # duration of a single episode. NB! warm_start_steps will be subtracted from this value
map_max: [7, 9] # used for old AIntelope environment
map_max: [7, 9]
map_width: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_width - 2.
map_height: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_height - 2.
#
Expand Down
6 changes: 6 additions & 0 deletions aintelope/config/config_gridsearch_random.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

hparams:
gridsearch_trial_no: ${range:0,100} # used just to repeat same experiment multiple times
params_set_title: "random"
Expand Down
6 changes: 6 additions & 0 deletions aintelope/config/config_pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

e_1_food_unbounded:
env_params:
env_experiment: "ai_safety_gridworlds.aintelope_savanna"
Expand Down
6 changes: 5 additions & 1 deletion aintelope/config/config_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

food_5x5:
env_params:
Expand Down
8 changes: 7 additions & 1 deletion aintelope/config/config_trials_random.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

hparams:
gridsearch_trial_no: ${range:0,100} # used just to repeat same experiment multiple times
params_set_title: "random"
Expand Down Expand Up @@ -27,7 +33,7 @@ hparams:
test_episodes: 10 # will be added to train episodes
env_params:
num_iters: 400 # [300, 400] # duration of a single episode. NB! warm_start_steps will be subtracted from this value
map_max: 7 # [7, 9] # used for old AIntelope environment
map_max: 7 # [7, 9]
map_width: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_width - 2.
map_height: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_height - 2.
#
Expand Down
8 changes: 7 additions & 1 deletion aintelope/config/config_trials_score.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

hparams:
gridsearch_trial_no: ${range:10,100} # used just to repeat same experiment multiple times
params_set_title: "score"
Expand Down Expand Up @@ -27,7 +33,7 @@ hparams:
test_episodes: 10 # 2 # will be added to train episodes
env_params:
num_iters: null # [300, 400] # duration of a single episode. NB! warm_start_steps will be subtracted from this value
map_max: 7 # [7, 9] # used for old AIntelope environment
map_max: 7 # [7, 9]
map_width: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_width - 2.
map_height: ${hparams.env_params.map_max} # NB! here it is exclusive max, used for Gridworld environments. Also, this width includes the walls at the border of the game, so 2 units of walls. Therefore, interior is map_height - 2.
#
Expand Down
6 changes: 6 additions & 0 deletions aintelope/config/config_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

import copy
from ast import literal_eval
from pathlib import Path
Expand Down
6 changes: 6 additions & 0 deletions aintelope/environments/demos/gridworlds/base_config_demo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
6 changes: 6 additions & 0 deletions aintelope/environments/demos/gridworlds/danger_tiles.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
6 changes: 6 additions & 0 deletions aintelope/environments/demos/gridworlds/food_homeostasis.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
6 changes: 6 additions & 0 deletions aintelope/environments/demos/gridworlds/food_sharing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
6 changes: 6 additions & 0 deletions aintelope/environments/demos/gridworlds/food_unbounded.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from __future__ import absolute_import, division, print_function

import os
Expand Down
6 changes: 6 additions & 0 deletions aintelope/environments/demos/gridworlds/predators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Repository: https://github.com/aintelope/biological-compatibility-benchmarks

from aintelope.environments.demos.gridworlds.helpers.pipeline_env_demo_common import *

if __name__ == "__main__":
Expand Down
Loading

0 comments on commit fbfb906

Please sign in to comment.