Skip to content

Commit 1f45306

Browse files
authored
Merge pull request #506 from stratosphereips/ondra-fix-icons
Ondra fix icons
2 parents 802a3bb + 2ccb3b6 commit 1f45306

6 files changed

Lines changed: 22 additions & 17 deletions

File tree

docs/assets/network_intel_node.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

docs/base_agent.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ The `BaseAgent` class provides the foundational interface for all agents interac
33

44
All custom agents should extend this class and implement their decision-making logic by overriding a method like `choose_action` (see [Getting Started](getting_started.md#creating-your-first-agent) for an example).
55

6-
::: netsecgame.agents.base_agent.BaseAgent
7-
::: netsecgame.agents.parallel_base_agent.ParallelBaseAgent
6+
::: netsecgame.agents.base_agent.BaseAgent

docs/parallel_base_agent.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Parallel Base Agent
2+
3+
The `ParallelBaseAgent` class extends the concepts of the base agent to manage connections to multiple NetSecGame server instances simultaneously, enabling parallel environment interaction.
4+
5+
Unlike `BaseAgent` (which manages a single socket), this class maintains one TCP socket per environment and exposes vectorized versions of methods like `register()`, `make_step()`, and `request_game_reset()` that operate on lists of actions and observations.
6+
7+
::: netsecgame.agents.parallel_base_agent.ParallelBaseAgent

mkdocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ site_name: Network Security Game
22
theme:
33
name: material
44
user_color_mode_toggle: true
5+
favicon: assets/network_intel_node.svg
6+
logo: assets/network_intel_node_white.svg
57

68
nav:
79
- Home: index.md
@@ -11,7 +13,9 @@ nav:
1113
- Global Defender: global_defender.md
1214
- API Reference:
1315
- Game Components: game_components.md
14-
- Base Agent: base_agent.md
16+
- Agents:
17+
- Base Agent: base_agent.md
18+
- Parallel Base Agent: parallel_base_agent.md
1519
- Agent Server: agent_server.md
1620
- Game Coordinator: game_coordinator.md
1721
- Configuration Manager: configuration_manager.md

netsecgame/agents/parallel_base_agent.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ def _run_parallel(
322322
args_per_env: Optional extra positional args per env index.
323323
324324
Returns:
325-
List of results, one per ``self._num_envs``. Indices not included
326-
in *env_indices* get ``None``.
325+
List of results, one per ``self._num_envs``. Indices not included in *env_indices* get ``None``.
327326
"""
328327
if env_indices is None:
329328
env_indices = [i for i in range(self._num_envs) if self._sockets[i] is not None]
@@ -367,9 +366,7 @@ def register(self) -> "Observation | None | List[Optional[Observation]]":
367366
"""Register in all connected environments in parallel.
368367
369368
Returns:
370-
In single-env mode: the initial ``Observation`` (or ``None``).
371-
In multi-env mode: list of initial observations, positionally
372-
aligned with ``game_ports``.
369+
The initial ``Observation`` (or ``None``) in single-env mode, or a list of initial observations positionally aligned with ``game_ports`` in multi-env mode.
373370
"""
374371
results = self._run_parallel(self._register_single)
375372
# Re-initialise done mask: failed envs stay done
@@ -383,19 +380,17 @@ def make_step(
383380
) -> "Observation | None | List[Optional[Observation]]":
384381
"""Execute one step in every **active** environment in parallel.
385382
383+
*Note: If you need to access the boolean done statuses across
384+
all environments, you can use the `self.done_mask` property.*
385+
386386
Args:
387387
actions: In single-env mode a single ``Action``; in multi-env
388388
mode a list of ``Action`` objects (one per environment).
389389
Actions at indices where the done mask is ``True`` are
390390
**ignored** (no message is sent to that env).
391391
392392
Returns:
393-
In single-env mode: a single ``Observation | None``.
394-
In multi-env mode: list of observations positionally aligned
395-
with ``game_ports``.
396-
397-
*Note: If you need to access the boolean done statuses across
398-
all environments, you can use the `self.done_mask` property.*
393+
A single ``Observation | None`` in single-env mode, or a list of observations positionally aligned with ``game_ports`` in multi-env mode.
399394
400395
Raises:
401396
ValueError: If the number of actions doesn't match ``num_envs``.
@@ -444,9 +439,7 @@ def request_game_reset(
444439
seed: RNG seed. Required when ``randomize_topology`` is True.
445440
446441
Returns:
447-
In single-env mode: the initial ``Observation`` (or ``None``).
448-
In multi-env mode: list of initial observations, positionally
449-
aligned with ``game_ports``.
442+
The initial ``Observation`` (or ``None``) in single-env mode, or a list of initial observations positionally aligned with ``game_ports`` in multi-env mode.
450443
"""
451444
if seed is None and randomize_topology:
452445
raise ValueError(

0 commit comments

Comments
 (0)