Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LearningEnvironment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Co
LearningEnvironment
Commits
fade62f0
Commit
fade62f0
authored
4 years ago
by
Armin Co
Browse files
Options
Downloads
Patches
Plain Diff
Benchmarks for the OpenAiGym environment.
parent
6a28131a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
run_scripts/benchmarks.py
+125
-0
125 additions, 0 deletions
run_scripts/benchmarks.py
run_scripts/cartpole.py
+20
-0
20 additions, 0 deletions
run_scripts/cartpole.py
with
145 additions
and
0 deletions
run_scripts/benchmarks.py
0 → 100644
+
125
−
0
View file @
fade62f0
import
main
import
environment_wrapper
as
ew
import
gym
import
copy
import
threading
from
agents
import
QAgent
,
DQAgent
c
=
ew
.
Config
()
c
.
name
=
'
Base
'
c
.
render
=
False
c
.
env
=
gym
.
make
(
'
LunarLander-v2
'
)
c
.
env_type
=
'
Lunar
'
c
.
net_layout
=
[
256
,
128
]
c
.
eps_decay
=
0.9996
c
.
learn_rate
=
0.001
c
.
run_episodes
=
300
c
.
save_to
=
'
benchmarks/
'
smallNet
=
copy
.
deepcopy
(
c
)
smallNet
.
name
=
'
SmallNet
'
smallNet
.
net_layout
=
[
128
,
32
]
smallNet
.
conf_to_name
()
# smallNet.agent = QAgent(smallNet)
smallNetDeep
=
copy
.
deepcopy
(
c
)
smallNetDeep
.
name
=
'
SmallNetDeep
'
smallNetDeep
.
net_layout
=
[
128
,
32
,
32
]
smallNetDeep
.
conf_to_name
()
smallNetDeepSlowLearn
=
copy
.
deepcopy
(
c
)
smallNetDeepSlowLearn
.
name
=
'
SmallNetDeep
'
smallNetDeepSlowLearn
.
net_layout
=
[
128
,
32
,
32
]
smallNetDeepSlowLearn
.
learn_rate
=
0.0005
smallNetDeepSlowLearn
.
conf_to_name
()
normalNet
=
copy
.
deepcopy
(
c
)
normalNet
.
name
=
'
NormalNet
'
normalNet
.
net_layout
=
[
256
,
128
]
normalNet
.
conf_to_name
()
normalSlowDecay
=
copy
.
deepcopy
(
c
)
normalSlowDecay
.
name
=
'
NormalSlowDecay
'
normalSlowDecay
.
net_layout
=
[
256
,
128
]
normalSlowDecay
.
eps_decay
=
0.99995
normalSlowDecay
.
conf_to_name
()
normalSlowLearn
=
copy
.
deepcopy
(
c
)
normalSlowLearn
.
name
=
'
NormalSlowLearn
'
normalSlowLearn
.
net_layout
=
[
256
,
128
]
normalSlowLearn
.
learn_rate
=
0.0005
normalSlowLearn
.
conf_to_name
()
largeNet
=
copy
.
deepcopy
(
c
)
largeNet
.
name
=
'
LargeNet
'
largeNet
.
net_layout
=
[
512
,
256
]
largeNet
.
conf_to_name
()
deepNet
=
copy
.
deepcopy
(
c
)
deepNet
.
name
=
'
DeppNet
'
deepNet
.
net_layout
=
[
256
,
128
,
128
]
deepNet
.
conf_to_name
()
deepNetSlowLearn
=
copy
.
deepcopy
(
c
)
deepNetSlowLearn
.
name
=
'
DeppNet
'
deepNetSlowLearn
.
net_layout
=
[
256
,
128
,
128
]
deepNetSlowLearn
.
learn_rate
=
0.0005
deepNetSlowLearn
.
conf_to_name
()
deepNetSmaller
=
copy
.
deepcopy
(
c
)
deepNetSmaller
.
name
=
'
DeppNetSmaller
'
deepNetSmaller
.
net_layout
=
[
256
,
128
,
32
]
deepNetSmaller
.
conf_to_name
()
littleNet
=
copy
.
deepcopy
(
c
)
littleNet
.
name
=
'
LittleNet
'
littleNet
.
net_layout
=
[
64
,
64
]
littleNet
.
conf_to_name
()
verryLittleNet
=
copy
.
deepcopy
(
c
)
verryLittleNet
.
name
=
'
VerryLittleNet
'
verryLittleNet
.
net_layout
=
[
64
,
32
]
verryLittleNet
.
conf_to_name
()
verryLittleNetDeep
=
copy
.
deepcopy
(
c
)
verryLittleNetDeep
.
name
=
'
VerryLittleNetDeep
'
verryLittleNetDeep
.
net_layout
=
[
64
,
32
,
32
]
verryLittleNetDeep
.
conf_to_name
()
lun
=
copy
.
deepcopy
(
c
)
lun
.
run_episodes
=
500
lun
.
name
=
'
NormalLunarDoubleNotSoMoreLearn
'
lun
.
net_layout
=
[
256
,
128
]
lun
.
conf_to_name
()
# lun.agent = QAgent(lun)
# configuration = smallNet
# configuration = smallNetDeep
configuration
=
normalNet
# configuration = normalSlowDecay
# configuration = normalSlowLearn
# configuration = largeNet
# configuration = deepNet
# configuration = deepNetSmaller
# configuration = verryLittleNet
# configuration = littleNet
# configuration = verryLittleNetDeep
# configuration = deepNetSlowLearn
# configuration = smallNetDeepSlowLearn
# configuration = lun
print
(
configuration
.
name
)
configuration
.
agent
=
QAgent
(
configuration
)
main
.
run
(
configuration
)
# configurations = [smallNet, smallNetDeep, normalNet, normalSlowDecay, normalSlowLearn, largeNet, deepNet, verryLittleNet, littleNet, verryLittleNetDeep, smallNetDeepSlowLearn, deepNetSlowLearn]
# threads = []
# for conf in configurations:
# threads.append(threading.Thread(target=main.run, args=[conf]))
# for thread in threads:
# thread.start()
# for thread in threads:
# thread.join()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
run_scripts/cartpole.py
0 → 100644
+
20
−
0
View file @
fade62f0
import
main
import
environment_wrapper
as
ew
import
gym
from
agents
import
DQAgent
,
QAgent
c
=
ew
.
Config
()
c
.
name
=
'
DoubleCartPole
'
c
.
render
=
False
c
.
env
=
gym
.
make
(
'
CartPole-v0
'
)
c
.
env_type
=
'
CartPole
'
c
.
net_layout
=
[
128
,
64
,
32
]
c
.
eps_decay
=
0.9991
c
.
learn_rate
=
0.001
c
.
run_episodes
=
300
c
.
save_to
=
'
benchmarks/
'
c
.
conf_to_name
()
c
.
agent
=
QAgent
(
c
)
main
.
run
(
c
)
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