Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
baselines
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flatland
baselines
Commits
b0ec2a2d
Commit
b0ec2a2d
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated training for simpler start
parent
de8a9e08
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
torch_training/multi_agent_training.py
+5
-4
5 additions, 4 deletions
torch_training/multi_agent_training.py
torch_training/training_navigation.py
+2
-2
2 additions, 2 deletions
torch_training/training_navigation.py
with
7 additions
and
6 deletions
torch_training/multi_agent_training.py
+
5
−
4
View file @
b0ec2a2d
...
...
@@ -64,9 +64,9 @@ agent_next_obs = [None] * env.get_num_agents()
agent
=
Agent
(
state_size
,
action_size
,
"
FC
"
,
0
)
agent
.
qnetwork_local
.
load_state_dict
(
torch
.
load
(
'
./Nets/avoid_checkpoint30000.pth
'
))
demo
=
Tru
e
demo
=
Fals
e
record_images
=
False
frame_step
=
0
for
trials
in
range
(
1
,
n_trials
+
1
):
if
trials
%
50
==
0
and
not
demo
:
...
...
@@ -118,10 +118,11 @@ for trials in range(1, n_trials + 1):
# Run episode
for
step
in
range
(
max_steps
):
if
demo
:
env_renderer
.
renderEnv
(
show
=
True
,
show_observations
=
Tru
e
)
env_renderer
.
renderEnv
(
show
=
True
,
show_observations
=
Fals
e
)
# observation_helper.util_print_obs_subtree(obs_original[0])
if
record_images
:
env_renderer
.
gl
.
saveImage
(
"
./Images/flatland_frame_{:04d}.bmp
"
.
format
(
step
))
env_renderer
.
gl
.
saveImage
(
"
./Images/flatland_frame_{:04d}.bmp
"
.
format
(
frame_step
))
frame_step
+=
1
# print(step)
# Action
for
a
in
range
(
env
.
get_num_agents
()):
...
...
This diff is collapsed.
Click to expand it.
torch_training/training_navigation.py
+
2
−
2
View file @
b0ec2a2d
import
random
from
collections
import
deque
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
torch
from
dueling_double_dqn
import
Agent
from
flatland.envs.generators
import
complex_rail_generator
from
flatland.envs.observations
import
TreeObsForRailEnv
from
flatland.envs.rail_env
import
RailEnv
from
flatland.utils.rendertools
import
RenderTool
from
utils.observation_utils
import
norm_obs_clip
,
split_tree
random
.
seed
(
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment