From 18e68863810a92b0ec6526d5ffef31857549ab43 Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Mon, 3 Jun 2024 15:51:14 +0100 Subject: [PATCH 01/10] User guide updates --- docs/source/varying_config_files.rst | 2 +- .../Data-Manipulation-Customising-Red-Agent.ipynb | 8 +++++--- .../notebooks/Data-Manipulation-E2E-Demonstration.ipynb | 8 +++++--- .../notebooks/Getting-Information-Out-Of-PrimAITE.ipynb | 4 +++- src/primaite/notebooks/Requests-and-Responses.ipynb | 4 +++- .../notebooks/Training-an-RLLIB-MARL-System.ipynb | 6 ++++-- src/primaite/notebooks/Training-an-RLLib-Agent.ipynb | 5 ++++- src/primaite/notebooks/Training-an-SB3-Agent.ipynb | 4 +++- src/primaite/notebooks/Using-Episode-Schedules.ipynb | 4 +++- src/primaite/notebooks/multi-processing.ipynb | 6 +++++- 10 files changed, 36 insertions(+), 15 deletions(-) diff --git a/docs/source/varying_config_files.rst b/docs/source/varying_config_files.rst index 34b83895..285653c6 100644 --- a/docs/source/varying_config_files.rst +++ b/docs/source/varying_config_files.rst @@ -24,7 +24,7 @@ For each variation that could be used in a placeholder, there is a separate yaml The data that fills the placeholder is defined as a YAML Anchor in a separate file, denoted by an ampersand ``&anchor``. -Learn more about YAML Aliases and Anchors here. +Learn more about YAML Aliases and Anchors `here `_. Schedule ******** diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index 21d67bab..2f831148 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -4,13 +4,15 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Customising red agents\n", + "# Customising UC2 Data Manipulation Red Agent\n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", "This notebook will go over some examples of how red agent behaviour can be varied by changing its configuration parameters.\n", "\n", "First, let's load the standard Data Manipulation config file, and see what the red agent does.\n", "\n", - "*(For a full explanation of the Data Manipulation scenario, check out the notebook `Data-Manipulation-E2E-Demonstration.ipynb`)*" + "*(For a full explanation of the Data Manipulation scenario, check out the notebook Data Manipulation Scearnio notebook)*" ] }, { @@ -456,7 +458,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Data-Manipulation-E2E-Demonstration.ipynb b/src/primaite/notebooks/Data-Manipulation-E2E-Demonstration.ipynb index e0f79795..b3a90cc0 100644 --- a/src/primaite/notebooks/Data-Manipulation-E2E-Demonstration.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-E2E-Demonstration.ipynb @@ -4,7 +4,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Data Manipulation Scenario\n" + "# Data Manipulation Scenario\n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK" ] }, { @@ -79,7 +81,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Reinforcement learning details" + "## Reinforcement learning details" ] }, { @@ -692,7 +694,7 @@ ], "metadata": { "kernelspec": { - "display_name": "venv", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb b/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb index 25dec889..c3f97965 100644 --- a/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb +++ b/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb @@ -4,7 +4,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Getting information out of PrimAITE" + "# Getting information out of PrimAITE\n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK" ] }, { diff --git a/src/primaite/notebooks/Requests-and-Responses.ipynb b/src/primaite/notebooks/Requests-and-Responses.ipynb index aa3fddf9..54669146 100644 --- a/src/primaite/notebooks/Requests-and-Responses.ipynb +++ b/src/primaite/notebooks/Requests-and-Responses.ipynb @@ -6,7 +6,9 @@ "source": [ "# Requests and Responses\n", "\n", - "Agents interact with the PrimAITE simulation via the Request system.\n" + "Agents interact with the PrimAITE simulation via the Request system.\n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK" ] }, { diff --git a/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb b/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb index 5ffb19ad..307b4a7e 100644 --- a/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb +++ b/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb @@ -4,7 +4,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Train a Multi agent system using RLLIB\n", + "# Train a Multi agent system using RLLIB\n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", "This notebook will demonstrate how to use the `PrimaiteRayMARLEnv` to train a very basic system with two PPO agents." ] @@ -106,7 +108,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.8" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb b/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb index fbc5f4c6..ac64689f 100644 --- a/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb +++ b/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb @@ -5,6 +5,9 @@ "metadata": {}, "source": [ "## Train a Single agent system using RLLib\n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "\n", "This notebook will demonstrate how to use PrimaiteRayEnv to train a basic PPO agent." ] }, @@ -96,7 +99,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.8" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Training-an-SB3-Agent.ipynb b/src/primaite/notebooks/Training-an-SB3-Agent.ipynb index 1e247e81..8a5b852b 100644 --- a/src/primaite/notebooks/Training-an-SB3-Agent.ipynb +++ b/src/primaite/notebooks/Training-an-SB3-Agent.ipynb @@ -6,6 +6,8 @@ "source": [ "# Training an SB3 Agent\n", "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "\n", "This notebook will demonstrate how to use primaite to create and train a PPO agent, using a pre-defined configuration file." ] }, @@ -180,7 +182,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.8" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Using-Episode-Schedules.ipynb b/src/primaite/notebooks/Using-Episode-Schedules.ipynb index fc9e04f7..692a52b3 100644 --- a/src/primaite/notebooks/Using-Episode-Schedules.ipynb +++ b/src/primaite/notebooks/Using-Episode-Schedules.ipynb @@ -6,6 +6,8 @@ "source": [ "# Using Episode Schedules\n", "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "\n", "PrimAITE supports the ability to use different variations on a scenario at different episodes. This can be used to increase \n", "domain randomisation to prevent overfitting, or to set up curriculum learning to train agents to perform more complicated tasks.\n", "\n", @@ -326,7 +328,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/multi-processing.ipynb b/src/primaite/notebooks/multi-processing.ipynb index 2b806e7c..4880b48c 100644 --- a/src/primaite/notebooks/multi-processing.ipynb +++ b/src/primaite/notebooks/multi-processing.ipynb @@ -4,7 +4,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Simple multi-processing demo using SubprocVecEnv from SB3" + "# Simple Multi-processing demonstration \n", + "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "\n", + "This note book uses SubprocVecEnv from SB3 for multi-processing." ] }, { From 29d42a88dcd9584c1432b00977ba1cc58dc29d35 Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Fri, 7 Jun 2024 14:48:22 +0100 Subject: [PATCH 02/10] Core user guide updated to reflect changes made down stream. --- .../notebooks/Data-Manipulation-Customising-Red-Agent.ipynb | 2 +- .../simulator/_package_data/create-simulation_demo.ipynb | 2 ++ .../simulator/_package_data/network_simulator_demo.ipynb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index 2f831148..2f4c58e7 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -12,7 +12,7 @@ "\n", "First, let's load the standard Data Manipulation config file, and see what the red agent does.\n", "\n", - "*(For a full explanation of the Data Manipulation scenario, check out the notebook Data Manipulation Scearnio notebook)*" + "*(For a full explanation of the scenario, check out the data manipulation scenario notebook)*" ] }, { diff --git a/src/primaite/simulator/_package_data/create-simulation_demo.ipynb b/src/primaite/simulator/_package_data/create-simulation_demo.ipynb index 31173022..6786125b 100644 --- a/src/primaite/simulator/_package_data/create-simulation_demo.ipynb +++ b/src/primaite/simulator/_package_data/create-simulation_demo.ipynb @@ -6,6 +6,8 @@ "source": [ "# Build a simulation using the Python API\n", "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "\n", "Currently, this notebook manipulates the simulation by directly placing objects inside of the attributes of the network and domain. It should be refactored when proper methods exist for adding these objects.\n" ] }, diff --git a/src/primaite/simulator/_package_data/network_simulator_demo.ipynb b/src/primaite/simulator/_package_data/network_simulator_demo.ipynb index 22fdf7ce..17a0f796 100644 --- a/src/primaite/simulator/_package_data/network_simulator_demo.ipynb +++ b/src/primaite/simulator/_package_data/network_simulator_demo.ipynb @@ -7,6 +7,8 @@ "source": [ "# PrimAITE Router Simulation Demo\n", "\n", + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "\n", "This demo uses a modified version of the ARCD Use Case 2 Network (seen below) to demonstrate the capabilities of the Network simulator in PrimAITE." ] }, From 2954ca966f1f655f0927b161ff67306294a4b676 Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Fri, 7 Jun 2024 16:35:33 +0100 Subject: [PATCH 03/10] Updated core user guide to match exactly that of 3.0.0/internal. --- docs/index.rst | 2 +- docs/source/example_notebooks.rst | 2 +- .../notebooks/Data-Manipulation-Customising-Red-Agent.ipynb | 2 +- src/primaite/notebooks/multi-processing.ipynb | 2 +- .../simulator/_package_data/create-simulation_demo.ipynb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 729cdc17..289d05cf 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,7 +54,7 @@ It is agnostic to the number of agents, their action / observation spaces, and t It presents a public API providing a method for describing the current state of the simulation, a method that accepts action requests and provides responses, and a method that triggers a timestep advancement. The Game Layer converts the simulation into a playable game for the agent(s). -it translates between simulation state and Gymnasium.Spaces to pass action / observation data between the agent(s) and the simulation. It is responsible for calculating rewards, managing Multi-Agent RL (MARL) action turns, and via a single agent interface can interact with Blue, Red and Green agents. +It translates between simulation state and Gymnasium.Spaces to pass action / observation data between the agent(s) and the simulation. It is responsible for calculating rewards, managing Multi-Agent RL (MARL) action turns, and via a single agent interface can interact with Blue, Red and Green agents. Agents can either generate their own scripted behaviour or accept input behaviour from an RL agent. diff --git a/docs/source/example_notebooks.rst b/docs/source/example_notebooks.rst index f207c601..e961da73 100644 --- a/docs/source/example_notebooks.rst +++ b/docs/source/example_notebooks.rst @@ -77,6 +77,6 @@ The following extensions should now be installed :width: 300 :align: center -VSCode will then ask for a Python environment version to use. PrimAITE is compatible with Python versions 3.8 - 3.10 +VSCode will then ask for a Python environment version to use. PrimAITE is compatible with Python versions 3.8 - 3.11 You should now be able to interact with the notebook. diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index 2f4c58e7..35cc4f58 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -12,7 +12,7 @@ "\n", "First, let's load the standard Data Manipulation config file, and see what the red agent does.\n", "\n", - "*(For a full explanation of the scenario, check out the data manipulation scenario notebook)*" + "*(For a full explanation of the Data Manipulation scenario, check out the data manipulation scenario notebook)*" ] }, { diff --git a/src/primaite/notebooks/multi-processing.ipynb b/src/primaite/notebooks/multi-processing.ipynb index 4880b48c..dd996901 100644 --- a/src/primaite/notebooks/multi-processing.ipynb +++ b/src/primaite/notebooks/multi-processing.ipynb @@ -8,7 +8,7 @@ "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", - "This note book uses SubprocVecEnv from SB3 for multi-processing." + "This notebook uses SubprocVecEnv from SB3" ] }, { diff --git a/src/primaite/simulator/_package_data/create-simulation_demo.ipynb b/src/primaite/simulator/_package_data/create-simulation_demo.ipynb index 6786125b..9f4abbf3 100644 --- a/src/primaite/simulator/_package_data/create-simulation_demo.ipynb +++ b/src/primaite/simulator/_package_data/create-simulation_demo.ipynb @@ -8,7 +8,7 @@ "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", - "Currently, this notebook manipulates the simulation by directly placing objects inside of the attributes of the network and domain. It should be refactored when proper methods exist for adding these objects.\n" + "Currently, this notebook manipulates the simulation by directly placing objects inside of the attributes of the network and domain. It should be refactored when proper methods exist for adding these objects." ] }, { From 146afea44fa6054477883420b2538b606de3628c Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Fri, 7 Jun 2024 16:44:33 +0100 Subject: [PATCH 04/10] Updated copyright clause on .rst --- docs/index.rst | 2 +- docs/source/about.rst | 2 +- docs/source/config.rst | 2 +- docs/source/dependencies.rst | 2 +- docs/source/developer_tools.rst | 2 +- docs/source/example_notebooks.rst | 2 +- docs/source/getting_started.rst | 2 +- docs/source/glossary.rst | 2 +- docs/source/request_system.rst | 2 +- docs/source/simulation.rst | 2 +- docs/source/simulation_structure.rst | 2 +- docs/source/state_system.rst | 2 +- docs/source/varying_config_files.rst | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 289d05cf..5749ad56 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Welcome to PrimAITE's documentation ==================================== diff --git a/docs/source/about.rst b/docs/source/about.rst index 782103d6..cc247623 100644 --- a/docs/source/about.rst +++ b/docs/source/about.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK .. _about: diff --git a/docs/source/config.rst b/docs/source/config.rst index 57948ae2..eb0b9906 100644 --- a/docs/source/config.rst +++ b/docs/source/config.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK PrimAITE |VERSION| Configuration ******************************** diff --git a/docs/source/dependencies.rst b/docs/source/dependencies.rst index ddea27fa..74f3cd14 100644 --- a/docs/source/dependencies.rst +++ b/docs/source/dependencies.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK .. role:: raw-html(raw) :format: html diff --git a/docs/source/developer_tools.rst b/docs/source/developer_tools.rst index fcb52443..3d781e1d 100644 --- a/docs/source/developer_tools.rst +++ b/docs/source/developer_tools.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK .. _Developer Tools: diff --git a/docs/source/example_notebooks.rst b/docs/source/example_notebooks.rst index e961da73..731ea566 100644 --- a/docs/source/example_notebooks.rst +++ b/docs/source/example_notebooks.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Example Jupyter Notebooks ========================= diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 150c3a1d..28630cb4 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK .. _getting-started: diff --git a/docs/source/glossary.rst b/docs/source/glossary.rst index f253d10e..8fff0ea3 100644 --- a/docs/source/glossary.rst +++ b/docs/source/glossary.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Glossary ============= diff --git a/docs/source/request_system.rst b/docs/source/request_system.rst index 67a84818..cc784cd4 100644 --- a/docs/source/request_system.rst +++ b/docs/source/request_system.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Request System ************** diff --git a/docs/source/simulation.rst b/docs/source/simulation.rst index fe494453..a8870cb4 100644 --- a/docs/source/simulation.rst +++ b/docs/source/simulation.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Simulation diff --git a/docs/source/simulation_structure.rst b/docs/source/simulation_structure.rst index f9a69b26..2804593a 100644 --- a/docs/source/simulation_structure.rst +++ b/docs/source/simulation_structure.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Simulation Structure diff --git a/docs/source/state_system.rst b/docs/source/state_system.rst index 5fc12c23..e31474ea 100644 --- a/docs/source/state_system.rst +++ b/docs/source/state_system.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Simulation State ================ diff --git a/docs/source/varying_config_files.rst b/docs/source/varying_config_files.rst index 42997093..d8f77f64 100644 --- a/docs/source/varying_config_files.rst +++ b/docs/source/varying_config_files.rst @@ -1,6 +1,6 @@ .. only:: comment - © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK + © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK Defining variations in the config files ================ From ae242694f376d838289b5c204ffd760e03ae1017 Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Fri, 7 Jun 2024 17:13:21 +0100 Subject: [PATCH 05/10] Minor change to title to prevent merge conflicts. --- .../notebooks/Data-Manipulation-Customising-Red-Agent.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index 35cc4f58..33091c3f 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Customising UC2 Data Manipulation Red Agent\n", + "# Customising red agents\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", From af0e67a61a41c82dddff8702f79c53bdfd241995 Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Mon, 10 Jun 2024 10:41:05 +0100 Subject: [PATCH 06/10] User-Guide update: Very minor changes to notebook code cells to match release version identically. --- .../notebooks/Data-Manipulation-Customising-Red-Agent.ipynb | 2 +- .../notebooks/Getting-Information-Out-Of-PrimAITE.ipynb | 4 ++-- src/primaite/notebooks/Requests-and-Responses.ipynb | 2 +- src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb | 2 +- src/primaite/notebooks/multi-processing.ipynb | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index 33091c3f..dd5def9e 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Customising red agents\n", + "# Customising UC2 Red Agents\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", diff --git a/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb b/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb index c3f97965..a832f3cc 100644 --- a/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb +++ b/src/primaite/notebooks/Getting-Information-Out-Of-PrimAITE.ipynb @@ -6,7 +6,7 @@ "source": [ "# Getting information out of PrimAITE\n", "\n", - "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK" + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n" ] }, { @@ -162,7 +162,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.10.8" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Requests-and-Responses.ipynb b/src/primaite/notebooks/Requests-and-Responses.ipynb index 54669146..ca9f02f5 100644 --- a/src/primaite/notebooks/Requests-and-Responses.ipynb +++ b/src/primaite/notebooks/Requests-and-Responses.ipynb @@ -8,7 +8,7 @@ "\n", "Agents interact with the PrimAITE simulation via the Request system.\n", "\n", - "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK" + "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n" ] }, { diff --git a/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb b/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb index 307b4a7e..96ee8e5d 100644 --- a/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb +++ b/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Train a Multi agent system using RLLIB\n", + "## Train a Multi agent system using RLLIB\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", diff --git a/src/primaite/notebooks/multi-processing.ipynb b/src/primaite/notebooks/multi-processing.ipynb index dd996901..7085e4b6 100644 --- a/src/primaite/notebooks/multi-processing.ipynb +++ b/src/primaite/notebooks/multi-processing.ipynb @@ -4,11 +4,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Simple Multi-processing demonstration \n", + "## Simple multi-processing demonstration \n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", - "This notebook uses SubprocVecEnv from SB3" + "This notebook uses SubprocVecEnv from SB3." ] }, { From 2a6a16b2229cb1cd24af4542a5ced9da444cf8c4 Mon Sep 17 00:00:00 2001 From: "Archer.Bowen" Date: Mon, 10 Jun 2024 10:50:58 +0100 Subject: [PATCH 07/10] Space inbetween title to prevent merge conflicts. --- src/primaite/notebooks/multi-processing.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primaite/notebooks/multi-processing.ipynb b/src/primaite/notebooks/multi-processing.ipynb index 7085e4b6..1807d39c 100644 --- a/src/primaite/notebooks/multi-processing.ipynb +++ b/src/primaite/notebooks/multi-processing.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Simple multi-processing demonstration \n", + "## Simple multi-processing demonstration\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", From c538aee022dcba2c744d1328aa7e66da6109a46d Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Mon, 10 Jun 2024 12:58:07 +0100 Subject: [PATCH 08/10] Rename benchmark variables and add h1 to notebooks --- .../Data-Manipulation-Customising-Red-Agent.ipynb | 2 +- .../notebooks/Training-an-RLLIB-MARL-System.ipynb | 4 ++-- src/primaite/notebooks/Training-an-RLLib-Agent.ipynb | 4 ++-- src/primaite/notebooks/Using-Episode-Schedules.ipynb | 2 +- src/primaite/notebooks/multi-processing.ipynb | 4 ++-- src/primaite/session/environment.py | 4 ++-- src/primaite/utils/session_output_reader.py | 6 +++--- src/primaite/utils/session_output_writer.py | 10 +++++----- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index dd5def9e..33d56fb0 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -458,7 +458,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb b/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb index 96ee8e5d..c185b8b5 100644 --- a/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb +++ b/src/primaite/notebooks/Training-an-RLLIB-MARL-System.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Train a Multi agent system using RLLIB\n", + "# Train a Multi agent system using RLLIB\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", @@ -108,7 +108,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.8" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb b/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb index ac64689f..bdd60f36 100644 --- a/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb +++ b/src/primaite/notebooks/Training-an-RLLib-Agent.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Train a Single agent system using RLLib\n", + "# Train a Single agent system using RLLib\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", @@ -99,7 +99,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.8" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/Using-Episode-Schedules.ipynb b/src/primaite/notebooks/Using-Episode-Schedules.ipynb index 692a52b3..0d0f1a4a 100644 --- a/src/primaite/notebooks/Using-Episode-Schedules.ipynb +++ b/src/primaite/notebooks/Using-Episode-Schedules.ipynb @@ -328,7 +328,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/src/primaite/notebooks/multi-processing.ipynb b/src/primaite/notebooks/multi-processing.ipynb index 1807d39c..86b549a7 100644 --- a/src/primaite/notebooks/multi-processing.ipynb +++ b/src/primaite/notebooks/multi-processing.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Simple multi-processing demonstration\n", + "# Simple multi-processing demonstration\n", "\n", "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", "\n", @@ -143,7 +143,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.11" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/src/primaite/session/environment.py b/src/primaite/session/environment.py index 1c605f59..8fd39f40 100644 --- a/src/primaite/session/environment.py +++ b/src/primaite/session/environment.py @@ -37,7 +37,7 @@ class PrimaiteGymEnv(gymnasium.Env): """Name of the RL agent. Since there should only be one RL agent we can just pull the first and only key.""" self.episode_counter: int = 0 """Current episode number.""" - self.average_reward_per_episode: Dict[int, float] = {} + self.total_reward_per_episode: Dict[int, float] = {} """Average rewards of agents per episode.""" @property @@ -91,7 +91,7 @@ class PrimaiteGymEnv(gymnasium.Env): f"Resetting environment, episode {self.episode_counter}, " f"avg. reward: {self.agent.reward_function.total_reward}" ) - self.average_reward_per_episode[self.episode_counter] = self.agent.reward_function.total_reward + self.total_reward_per_episode[self.episode_counter] = self.agent.reward_function.total_reward if self.io.settings.save_agent_actions: all_agent_actions = {name: agent.history for name, agent in self.game.agents.items()} diff --git a/src/primaite/utils/session_output_reader.py b/src/primaite/utils/session_output_reader.py index 322b3b8d..c3088870 100644 --- a/src/primaite/utils/session_output_reader.py +++ b/src/primaite/utils/session_output_reader.py @@ -11,16 +11,16 @@ from typing import Any, Dict, Tuple, Union import polars as pl -def av_rewards_dict(av_rewards_csv_file: Union[str, Path]) -> Dict[int, float]: +def total_rewards_dict(total_rewards_csv_file: Union[str, Path]) -> Dict[int, float]: """ Read an average rewards per episode csv file and return as a dict. The dictionary keys are the episode number, and the values are the mean reward that episode. - :param av_rewards_csv_file: The average rewards per episode csv file path. + :param total_rewards_csv_file: The average rewards per episode csv file path. :return: The average rewards per episode csv as a dict. """ - df_dict = pl.read_csv(av_rewards_csv_file).to_dict() + df_dict = pl.read_csv(total_rewards_csv_file).to_dict() return {int(v): df_dict["Average Reward"][i] for i, v in enumerate(df_dict["Episode"])} diff --git a/src/primaite/utils/session_output_writer.py b/src/primaite/utils/session_output_writer.py index 9253147a..bdcf2b35 100644 --- a/src/primaite/utils/session_output_writer.py +++ b/src/primaite/utils/session_output_writer.py @@ -26,9 +26,9 @@ class SessionOutputWriter: Is used to write session outputs to csv file. """ - _AV_REWARD_PER_EPISODE_HEADER: Final[List[str]] = [ + _TOTAL_REWARD_PER_EPISODE_HEADER: Final[List[str]] = [ "Episode", - "Average Reward", + "Total Reward", ] def __init__( @@ -43,7 +43,7 @@ class SessionOutputWriter: :param env: PrimAITE gym environment. :type env: Primaite :param transaction_writer: If `true`, this will output a full account of every transaction taken by the agent. - If `false` it will output the average reward per episode, defaults to False + If `false` it will output the total reward per episode, defaults to False :type transaction_writer: bool, optional :param learning_session: Set to `true` to indicate that the current session is a training session. This determines the name of the folder which contains the final output csv. Defaults to True @@ -56,7 +56,7 @@ class SessionOutputWriter: if self.transaction_writer: fn = f"all_transactions_{self._env.timestamp_str}.csv" else: - fn = f"average_reward_per_episode_{self._env.timestamp_str}.csv" + fn = f"total_reward_per_episode_{self._env.timestamp_str}.csv" self._csv_file_path: "Path" if self.learning_session: @@ -94,7 +94,7 @@ class SessionOutputWriter: if isinstance(data, Transaction): header, data = data.as_csv_data() else: - header = self._AV_REWARD_PER_EPISODE_HEADER + header = self._TOTAL_REWARD_PER_EPISODE_HEADER if self._first_write: self._init_csv_writer() From 2d54d482a031416bae75419795a4ed25e0d10a91 Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Mon, 10 Jun 2024 14:45:56 +0000 Subject: [PATCH 09/10] Updated session_output_reader.py --- src/primaite/utils/session_output_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primaite/utils/session_output_reader.py b/src/primaite/utils/session_output_reader.py index c3088870..c6eb2f7b 100644 --- a/src/primaite/utils/session_output_reader.py +++ b/src/primaite/utils/session_output_reader.py @@ -2,7 +2,7 @@ raise DeprecationWarning( "Benchmarking depends on deprecated functionality and it has not been updated to primaite v3 yet." ) -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK +# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK from pathlib import Path from typing import Any, Dict, Tuple, Union From d1bbab71b7bce2694cfe07f1ac0109aa9f27bdf4 Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Mon, 10 Jun 2024 14:46:06 +0000 Subject: [PATCH 10/10] Updated session_output_writer.py --- src/primaite/utils/session_output_writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primaite/utils/session_output_writer.py b/src/primaite/utils/session_output_writer.py index bdcf2b35..a5acdee6 100644 --- a/src/primaite/utils/session_output_writer.py +++ b/src/primaite/utils/session_output_writer.py @@ -2,7 +2,7 @@ raise DeprecationWarning( "Benchmarking depends on deprecated functionality and it has not been updated to primaite v3 yet." ) -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK +# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK import csv from logging import Logger from typing import Final, List, Tuple, TYPE_CHECKING, Union