#2523 - Minor typos/corrections to make things run locally. Added one logging line to record Blue agent reward per step in environment.py
This commit is contained in:
@@ -404,7 +404,7 @@
|
|||||||
" # don't flatten observations so that we can see what is going on\n",
|
" # don't flatten observations so that we can see what is going on\n",
|
||||||
" cfg['agents'][3]['agent_settings']['flatten_obs'] = False\n",
|
" cfg['agents'][3]['agent_settings']['flatten_obs'] = False\n",
|
||||||
"\n",
|
"\n",
|
||||||
"env = PrimaiteGymEnv(game_config = cfg)\n",
|
"env = PrimaiteGymEnv(env_config = cfg)\n",
|
||||||
"obs, info = env.reset()\n",
|
"obs, info = env.reset()\n",
|
||||||
"print('env created successfully')\n",
|
"print('env created successfully')\n",
|
||||||
"pprint(obs)"
|
"pprint(obs)"
|
||||||
@@ -476,7 +476,9 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"obs, reward, terminated, truncated, info = env.step(9) # scan database file\n",
|
"obs, reward, terminated, truncated, info = env.step(9) # scan database file\n",
|
||||||
|
"print(info)\n",
|
||||||
"obs, reward, terminated, truncated, info = env.step(1) # scan webapp service\n",
|
"obs, reward, terminated, truncated, info = env.step(1) # scan webapp service\n",
|
||||||
|
"print(info)\n",
|
||||||
"pprint(obs['NODES'])"
|
"pprint(obs['NODES'])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -693,7 +695,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.12"
|
"version": "3.10.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class PrimaiteGymEnv(gymnasium.Env):
|
|||||||
|
|
||||||
next_obs = self._get_obs() # this doesn't update observation, just gets the current observation
|
next_obs = self._get_obs() # this doesn't update observation, just gets the current observation
|
||||||
reward = self.agent.reward_function.current_reward
|
reward = self.agent.reward_function.current_reward
|
||||||
|
_LOGGER.info(f"step: {self.game.step_counter}, Blue reward: {reward}")
|
||||||
terminated = False
|
terminated = False
|
||||||
truncated = self.game.calculate_truncated()
|
truncated = self.game.calculate_truncated()
|
||||||
info = {
|
info = {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from pydantic import BaseModel, ConfigDict
|
|||||||
|
|
||||||
from primaite import getLogger, PRIMAITE_PATHS
|
from primaite import getLogger, PRIMAITE_PATHS
|
||||||
from primaite.simulator import LogLevel, SIM_OUTPUT
|
from primaite.simulator import LogLevel, SIM_OUTPUT
|
||||||
from src.primaite.utils.primaite_config_utils import is_dev_mode
|
from primaite.utils.primaite_config_utils import is_dev_mode
|
||||||
|
|
||||||
_LOGGER = getLogger(__name__)
|
_LOGGER = getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user