Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
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
yoogottamk
Flatland
Commits
62badcc3
Commit
62badcc3
authored
5 years ago
by
spmohanty
Browse files
Options
Downloads
Patches
Plain Diff
Addresses #76 - implements a simple flatland-demo script to test installation
parent
8b2305c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/cli.py
+41
-7
41 additions, 7 deletions
flatland/cli.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
42 additions
and
8 deletions
flatland/cli.py
+
41
−
7
View file @
62badcc3
...
@@ -2,18 +2,52 @@
...
@@ -2,18 +2,52 @@
"""
Console script for flatland.
"""
"""
Console script for flatland.
"""
import
sys
import
sys
import
click
import
click
import
numpy
as
np
import
time
from
flatland.envs.generators
import
complex_rail_generator
from
flatland.envs.rail_env
import
RailEnv
from
flatland.utils.rendertools
import
RenderTool
@click.command
()
@click.command
()
def
main
(
args
=
None
):
def
demo
(
args
=
None
):
"""
Console script for flatland.
"""
"""
Demo script to check installation
"""
click
.
echo
(
"
Replace this message by putting your code into
"
env
=
RailEnv
(
"
flatland.cli.main
"
)
width
=
15
,
click
.
echo
(
"
See click documentation at http://click.pocoo.org/
"
)
height
=
15
,
rail_generator
=
complex_rail_generator
(
nr_start_goal
=
10
,
nr_extra
=
1
,
min_dist
=
8
,
max_dist
=
99999
),
number_of_agents
=
5
)
env
.
_max_episode_steps
=
int
(
15
*
(
env
.
width
+
env
.
height
))
env_renderer
=
RenderTool
(
env
)
while
True
:
obs
=
env
.
reset
()
_done
=
False
# Run a single episode here
step
=
0
while
not
_done
:
# Compute Action
_action
=
{}
for
_idx
,
_
in
enumerate
(
env
.
agents
):
_action
[
_idx
]
=
np
.
random
.
randint
(
0
,
5
)
obs
,
all_rewards
,
done
,
_
=
env
.
step
(
_action
)
_done
=
done
[
'
__all__
'
]
step
+=
1
env_renderer
.
render_env
(
show
=
True
,
frames
=
False
,
show_observations
=
False
,
show_predictions
=
False
)
time
.
sleep
(
0.3
)
return
0
return
0
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
sys
.
exit
(
main
())
# pragma: no cover
sys
.
exit
(
demo
())
# pragma: no cover
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
62badcc3
...
@@ -62,7 +62,7 @@ setup(
...
@@ -62,7 +62,7 @@ setup(
description
=
"
Multi Agent Reinforcement Learning on Trains
"
,
description
=
"
Multi Agent Reinforcement Learning on Trains
"
,
entry_points
=
{
entry_points
=
{
'
console_scripts
'
:
[
'
console_scripts
'
:
[
'
flatland=flatland.cli:
main
'
,
'
flatland
-demo
=flatland.cli:
demo
'
,
],
],
},
},
install_requires
=
requirements
,
install_requires
=
requirements
,
...
...
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