|
|
|
|
|
|
from unittest import mock |
|
|
|
import pytest |
|
|
|
|
|
|
|
import numpy as np |
|
|
|
|
|
|
|
from mlagents_envs.environment import UnityEnvironment |
|
|
|
from mlagents_envs.base_env import DecisionSteps, TerminalSteps |
|
|
|
from mlagents_envs.exception import UnityEnvironmentException, UnityActionException |
|
|
|
|
|
|
env.step() |
|
|
|
decision_steps, terminal_steps = env.get_steps("RealFakeBrain") |
|
|
|
n_agents = len(decision_steps) |
|
|
|
env.set_actions( |
|
|
|
"RealFakeBrain", np.zeros((n_agents, spec.action_spec.size), dtype=np.float32) |
|
|
|
) |
|
|
|
env.set_actions("RealFakeBrain", spec.action_spec.create_empty(n_agents)) |
|
|
|
env.set_actions( |
|
|
|
"RealFakeBrain", |
|
|
|
np.zeros((n_agents - 1, spec.action_spec.size), dtype=np.float32), |
|
|
|
) |
|
|
|
env.set_actions("RealFakeBrain", spec.action_spec.create_empty(n_agents - 1)) |
|
|
|
env.set_actions( |
|
|
|
"RealFakeBrain", |
|
|
|
-1 * np.ones((n_agents, spec.action_spec.size), dtype=np.float32), |
|
|
|
) |
|
|
|
env.set_actions("RealFakeBrain", spec.action_spec.create_empty(n_agents) - 1) |
|
|
|
env.step() |
|
|
|
|
|
|
|
env.close() |
|
|
|