-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
- Grid2op version:
dev_multiagentbranch - System:
windows - python 3.12
Bug description
Text doesn't match expected output in the script examples/multiagent/some_differeces.py.
How to reproduce
Run examples/multiagent/some_differeces.py
or copy the following code:
import grid2op
from grid2op.multi_agent import MultiAgentEnv
from grid2op.gym_compat import DiscreteActSpace
if __name__ == "__main__":
env_name = "l2rpn_case14_sandbox"
centralized_env = grid2op.make(env_name)
centralized_discrete = DiscreteActSpace(centralized_env.action_space, attr_to_keep=["set_bus"])
ACTION_DOMAINS = {
'agent_0' : [0, 1, 2, 3, 4],
'agent_1' : [5, 6, 7, 8, 9, 10, 11, 12, 13]
}
ma_env = MultiAgentEnv(centralized_env, ACTION_DOMAINS)
ma_discrete = {ag_id: DiscreteActSpace(ma_env.action_spaces[ag_id], attr_to_keep=["set_bus"]) for ag_id in ma_env.agents}
print(f"There are {centralized_discrete.n} total unary actions on the centralized environment, but "
f"(due to some lacking features) only {sum([el.n for el in ma_discrete.values()])} "
f"for the decentralized version. "
f"Basically, you cannot act on the \"interco\" at the moment")
for sub_id in range(centralized_env.n_sub):
agent_id = "agent_0"
if sub_id in ACTION_DOMAINS["agent_1"]:
agent_id = "agent_1"
nb_cent = len(centralized_discrete.action_space.get_all_unitary_topologies_set(centralized_discrete.action_space, sub_id))
loc_sub_id = ACTION_DOMAINS[agent_id].index(sub_id)
nb_ma = len(ma_discrete[agent_id].action_space.get_all_unitary_topologies_set(ma_discrete[agent_id].action_space, loc_sub_id))
print(f"sub_id {sub_id}: {nb_cent} vs {nb_ma}")
Current output
There are ##179## total unary actions on the centralized environment, but (due to some lacking features) only ##180## for the decentralized version. Basically, you cannot act on the "interco" at the moment
sub_id 0: 3 vs 3
sub_id 1: 29 vs 29
sub_id 2: 5 vs 5
sub_id 3: 31 vs 31
sub_id 4: 15 vs 15
sub_id 5: 57 vs 57
sub_id 6: 4 vs 4
sub_id 7: 0 vs 0
sub_id 8: 15 vs 15
sub_id 9: 3 vs 3
sub_id 10: 3 vs 3
sub_id 11: 3 vs 3
sub_id 12: 7 vs 7
sub_id 13: 3 vs 3
Have a look at the numbers between ##
Expected output
There are ##179## total unary actions on the centralized environment, but (due to some lacking features) only ##N## for the decentralized version. Basically, you cannot act on the "interco" at the moment
sub_id 0: 3 vs n0
...
sub_id 13: 3 vs n13
We should have N < 179 and not N = 180 > 179
A lead: I think the do nothing action is counted twice when counting the multi-agent environment's actions.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working