Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix_stopping_game #365

Merged
merged 3 commits into from
May 30, 2024
Merged

fix_stopping_game #365

merged 3 commits into from
May 30, 2024

Conversation

Yuhu-kth
Copy link
Collaborator

@Yuhu-kth Yuhu-kth commented May 30, 2024

Hi,
I tried to write the test_step function for stopping_game_env and stopping_game_mdp.
But its different from pomdp, I didn't really understand how it works.
For example, in stopping_game_env, the action_profie, I don't know how to initialize it.
Also, in stopping_game_mdp, param pi2 is attacker stage policy, I called the function calculate_stage_policy to get it, but it seems not right.
Screenshot 2024-05-30 at 11 43 49

@Limmen
Copy link
Owner

Limmen commented May 30, 2024

@Yuhu-kth
I see, change it to this:

from csle_common.dao.simulation_config.action import Action
defender_actions = list(map(lambda x: Action(id=x, descr=""), self.config.A1))
defender_strategy = RandomPolicy(actions=defender_actions, player_type=PlayerType.DEFENDER,
                                         stage_policy_tensor=list(defender_stage_strategy))

But move the import statement to the top of the file instead.
Also, I think there is a bug in the test_step of test_stopping_game_pomdp, where the actions should be defined in this way as well, you can fix that also.

Let me know if it works

@Yuhu-kth
Copy link
Collaborator Author

@Yuhu-kth I see, change it to this:

from csle_common.dao.simulation_config.action import Action
defender_actions = list(map(lambda x: Action(id=x, descr=""), self.config.A1))
defender_strategy = RandomPolicy(actions=defender_actions, player_type=PlayerType.DEFENDER,
                                         stage_policy_tensor=list(defender_stage_strategy))

But move the import statement to the top of the file instead. Also, I think there is a bug in the test_step of test_stopping_game_pomdp, where the actions should be defined in this way as well, you can fix that also.

Let me know if it works

Thanks, it works, fixed the issue and ran flake8&mypy, pushed the code.

@Limmen Limmen merged commit 92d12d8 into master May 30, 2024
@Limmen Limmen deleted the fix_stopping_tests branch June 4, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants