Update AINetworkDefense_Competitive/config.py
Browse files
AINetworkDefense_Competitive/config.py
CHANGED
|
@@ -2,30 +2,43 @@ import os
|
|
| 2 |
import tensorflow as tf
|
| 3 |
|
| 4 |
class Config:
|
|
|
|
| 5 |
# Core Environment Framework
|
| 6 |
-
MODE = '
|
| 7 |
USE_GPU = True
|
| 8 |
DEVICE = '/GPU:0' if USE_GPU else '/CPU:0'
|
| 9 |
-
|
| 10 |
-
MAX_STEPS_PER_EPISODE = 2048
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
CHECKPOINT_INTERVAL = 10
|
| 16 |
-
|
| 17 |
-
# Neural Network Topologies
|
| 18 |
ACTOR_LAYERS = (128, 64)
|
| 19 |
CRITIC_LAYERS = (128, 64)
|
| 20 |
-
|
| 21 |
# Reinforcement Learning Core Hyperparameters
|
| 22 |
GAMMA = 0.99
|
| 23 |
BUFFER_MAX_LENGTH = 100000
|
| 24 |
BATCH_SIZE = 64
|
| 25 |
-
TOTAL_EPISODES =
|
| 26 |
|
| 27 |
# Programmable Cyber Range Network Topology
|
| 28 |
-
# 9 Total Node Count but can scale dynamically
|
| 29 |
NETWORK_TOPOLOGY = {
|
| 30 |
"subnets": {
|
| 31 |
"public_dmz": {"num_hosts": 2, "base_vulnerability": 0.7}, # Entry point web targets
|
|
@@ -44,7 +57,7 @@ class Config:
|
|
| 44 |
# Symmetrical Learning Rate Schedulers
|
| 45 |
BASE_LR_RED = 1e-4
|
| 46 |
BASE_LR_BLUE = 1e-4
|
| 47 |
-
|
| 48 |
@classmethod
|
| 49 |
def get_red_lr_schedule(cls):
|
| 50 |
"""Returns an exponential decay scheduler for the Red Agent."""
|
|
|
|
| 2 |
import tensorflow as tf
|
| 3 |
|
| 4 |
class Config:
|
| 5 |
+
|
| 6 |
# Core Environment Framework
|
| 7 |
+
MODE = 'cooperative' # Options: 'competitive' or 'cooperative'
|
| 8 |
USE_GPU = True
|
| 9 |
DEVICE = '/GPU:0' if USE_GPU else '/CPU:0'
|
| 10 |
+
MAX_STEPS_PER_EPISODE = 2048 # Unified trajectory sizing
|
|
|
|
| 11 |
|
| 12 |
+
# DYNAMIC ENVIRONMENT LOGS, CHECKPOINTS & WORKER ALLOCATION
|
| 13 |
+
if str(MODE).lower() == 'competitive':
|
| 14 |
+
NUM_ENVS = 10
|
| 15 |
+
LOG_DIR = "./DefenseAI_Competitive/logs"
|
| 16 |
+
CHECKPOINT_DIR = "./DefenseAI_Competitive/checkpoints"
|
| 17 |
+
elif str(MODE).lower() == 'cooperative':
|
| 18 |
+
NUM_ENVS = 20
|
| 19 |
+
LOG_DIR = "./DefenseAI_Cooperative/logs"
|
| 20 |
+
CHECKPOINT_DIR = "./DefenseAI_Cooperative/checkpoints"
|
| 21 |
+
else:
|
| 22 |
+
print(f"⚠️ Warning: Unrecognized Config.MODE '{MODE}'. Defaulting to 'competitive' mode.") #Or cooperative mode based on your preference
|
| 23 |
+
MODE = 'competitive'
|
| 24 |
+
NUM_ENVS = 12
|
| 25 |
+
LOG_DIR = "./DefenseAI_Fallback/logs"
|
| 26 |
+
CHECKPOINT_DIR = "./DefenseAI_Fallback/checkpoints"
|
| 27 |
+
|
| 28 |
CHECKPOINT_INTERVAL = 10
|
| 29 |
+
|
| 30 |
+
# Neural Network Topologies
|
| 31 |
ACTOR_LAYERS = (128, 64)
|
| 32 |
CRITIC_LAYERS = (128, 64)
|
| 33 |
+
|
| 34 |
# Reinforcement Learning Core Hyperparameters
|
| 35 |
GAMMA = 0.99
|
| 36 |
BUFFER_MAX_LENGTH = 100000
|
| 37 |
BATCH_SIZE = 64
|
| 38 |
+
TOTAL_EPISODES = 6000
|
| 39 |
|
| 40 |
# Programmable Cyber Range Network Topology
|
| 41 |
+
# 9 Total Node Count but can scale dynamically
|
| 42 |
NETWORK_TOPOLOGY = {
|
| 43 |
"subnets": {
|
| 44 |
"public_dmz": {"num_hosts": 2, "base_vulnerability": 0.7}, # Entry point web targets
|
|
|
|
| 57 |
# Symmetrical Learning Rate Schedulers
|
| 58 |
BASE_LR_RED = 1e-4
|
| 59 |
BASE_LR_BLUE = 1e-4
|
| 60 |
+
|
| 61 |
@classmethod
|
| 62 |
def get_red_lr_schedule(cls):
|
| 63 |
"""Returns an exponential decay scheduler for the Red Agent."""
|