2021-03-29 14:52:44 +02:00
|
|
|
from alr_envs.mujoco.ball_in_a_cup.utils import make_env
|
2021-02-15 09:03:19 +01:00
|
|
|
from alr_envs.utils.dmp_async_vec_env import DmpAsyncVectorEnv
|
2021-02-05 17:10:03 +01:00
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
2021-03-29 14:52:44 +02:00
|
|
|
dim = 35
|
2021-02-15 09:03:19 +01:00
|
|
|
n_cpus = 4
|
2021-02-11 10:49:57 +01:00
|
|
|
|
2021-03-26 14:30:58 +01:00
|
|
|
# n_samples = 10
|
2021-02-15 09:03:19 +01:00
|
|
|
#
|
2021-03-26 14:30:58 +01:00
|
|
|
# vec_env = DmpAsyncVectorEnv([make_simple_env(i) for i in range(n_cpus)],
|
|
|
|
# n_samples=n_samples)
|
2021-02-15 09:03:19 +01:00
|
|
|
#
|
2021-03-26 14:30:58 +01:00
|
|
|
# params = np.tile(1 * np.random.randn(n_samples, dim), (10, 1))
|
|
|
|
#
|
|
|
|
# rewards, infos = vec_env(params)
|
|
|
|
# print(rewards)
|
|
|
|
#
|
2021-03-29 14:52:44 +02:00
|
|
|
non_vec_env = make_env(0, 0)()
|
2021-03-26 14:30:58 +01:00
|
|
|
|
2021-03-29 14:52:44 +02:00
|
|
|
params = 0.5 * np.random.randn(dim)
|
2021-02-05 17:10:03 +01:00
|
|
|
|
2021-03-26 14:30:58 +01:00
|
|
|
out2 = non_vec_env.rollout(params, render=True)
|
2021-02-05 17:10:03 +01:00
|
|
|
|
2021-03-26 14:30:58 +01:00
|
|
|
print(out2)
|