From 3a29593f600ba3fa1b9b74806333bf7934e4303f Mon Sep 17 00:00:00 2001 From: Nick Todd Date: Wed, 5 Feb 2025 11:50:38 +0000 Subject: [PATCH] 3075: Fix bug in notebook helper function. --- ...a-Manipulation-Customising-Red-Agent.ipynb | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb index de6d3fe5..14938c02 100644 --- a/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb +++ b/src/primaite/notebooks/Data-Manipulation-Customising-Red-Agent.ipynb @@ -6,7 +6,7 @@ "source": [ "# Customising UC2 Red Agents\n", "\n", - "© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK\n", + "© Crown-owned copyright 2025, 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", @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -36,13 +36,12 @@ "from primaite.game.agent.interface import AgentHistoryItem\n", "from primaite.session.environment import PrimaiteGymEnv\n", "import yaml\n", - "from pprint import pprint\n", - "from primaite.game.agent.scripted_agents import probabilistic_agent, data_manipulation_bot" + "from pprint import pprint" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -69,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -80,9 +79,7 @@ " if red_action == 'do_nothing':\n", " red_str = 'DO NOTHING'\n", " elif red_action == 'node_application_execute':\n", - " client = \"client 1\" if red_info.parameters['node_name'] == 0 else \"client 2\"\n", - "\n", - " red_str = f\"ATTACK from {client}\"\n", + " red_str = f\"ATTACK from {red_info.parameters['node_name']}\"\n", " return red_str" ] }, @@ -245,7 +242,7 @@ "outputs": [], "source": [ "change = yaml.safe_load(\"\"\"\n", - " possible_start_nodes: [client_1, client_2]\n", + " possible_start_nodes: [client_1]\n", " target_application: DataManipulationBot\n", " start_step: 25\n", " frequency: 20\n", @@ -315,6 +312,10 @@ "outputs": [], "source": [ "change = yaml.safe_load(\"\"\"\n", + " agent_settings:\n", + " possible_start_nodes: [client_1]\n", + " target_application: DataManipulationBot\n", + "\n", " action_space:\n", " action_map:\n", " 0:\n",