Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Thiago P. Bueno <thiago.pbueno@gmail.com>
- Loading branch information
1 parent
d91644a
commit a1b0829
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import rddlgym | ||
|
||
from tfrddlsim.policy import RandomPolicy | ||
from tfrddlsim.simulation.policy_simulator import PolicySimulator | ||
from tfrddlsim.viz import GenericVisualizer | ||
|
||
# parse and compile RDDL | ||
compiler = rddlgym.make('Reservoir-8', mode=rddlgym.SCG) | ||
compiler.init() | ||
|
||
# run simulations | ||
horizon = 40 | ||
batch_size = 128 | ||
policy = RandomPolicy(compiler, batch_size) | ||
simulator = PolicySimulator(compiler, policy, batch_size) | ||
trajectories = simulator.run(horizon) | ||
|
||
# visualize trajectories | ||
viz = GenericVisualizer(compiler, verbose=True) | ||
viz.render(trajectories) |