-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from bark-simulator/experiment_runner_package
Place ExperimentRunner in bark_ml and introduce max. velocity
- Loading branch information
Showing
13 changed files
with
288 additions
and
97 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
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
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,40 @@ | ||
filegroup( | ||
name = "data", | ||
srcs = glob(["*.json", "**/*.yaml", "**/*.json", "**/*.xodr", "**/*.py"]), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
py_library( | ||
name = "experiment", | ||
srcs = ["experiment.py"], | ||
data = ["@bark_project//bark/python_wrapper:core.so"], | ||
imports = ["../external/bark_project/bark/python_wrapper/"], | ||
deps = ["//bark_ml/environments:environments", | ||
"//bark_ml/library_wrappers/lib_tf_agents/agents:agents", | ||
"//bark_ml/library_wrappers/lib_tf_agents/runners:runners", | ||
"//bark_ml/evaluators:evaluators", | ||
"//bark_ml/observers:observers"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
py_binary( | ||
name = "experiment_runner", | ||
srcs = ["experiment_runner.py"], | ||
data = ["@bark_project//bark/python_wrapper:core.so", | ||
"//bark_ml:generate_core"], | ||
imports = ["../external/bark_project/bark/python_wrapper/"], | ||
deps = [":experiment"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
py_test( | ||
name = "py_experiment_tests", | ||
srcs = ["py_experiment_tests.py"], | ||
data = ["@bark_project//bark/python_wrapper:core.so", | ||
":data"], | ||
imports = ["../external/bark_project/bark/python_wrapper/", | ||
"../python_wrapper/"], | ||
deps = [":experiment"], | ||
visibility = ["//visibility:public"] | ||
) | ||
|
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,173 @@ | ||
{ | ||
"Experiment": { | ||
"Observer": { | ||
"ModuleName": "GraphObserver", | ||
"Config": {} | ||
}, | ||
"Evaluator": { | ||
"ModuleName": "RewardShapingEvaluator", | ||
"Config": {} | ||
}, | ||
"Runtime": { | ||
"ModuleName": "SingleAgentRuntime", | ||
"Config": {} | ||
}, | ||
"Runner": { | ||
"ModuleName": "SACRunner", | ||
"Config": {} | ||
}, | ||
"Agent": { | ||
"ModuleName": "BehaviorGraphSACAgent", | ||
"Config": { | ||
"init_gnn": "init_interaction_network" | ||
} | ||
}, | ||
"Blueprint": { | ||
"ModuleName": "ContinuousHighwayBlueprint", | ||
"Config": { | ||
"num_scenarios": 10000, | ||
"viewer": true, | ||
"mode": "dense" | ||
} | ||
}, | ||
"NumEvaluationEpisodes": 10, | ||
"NumVisualizationEpisodes": 10 | ||
}, | ||
"Visualization": { | ||
"Agents": { | ||
"Color": { | ||
"Other": { | ||
"Lines": [ | ||
0.5, | ||
0.5, | ||
0.5 | ||
], | ||
"Face": [ | ||
0.7, | ||
0.7, | ||
0.7 | ||
] | ||
}, | ||
"Controlled": { | ||
"Lines": [ | ||
0.0, | ||
0.27, | ||
0.58 | ||
], | ||
"Face": [ | ||
0.49, | ||
0.63, | ||
0.83 | ||
] | ||
}, | ||
"UseColormapForOtherAgents": false, | ||
"IfColormapUseLineColorOthers": true | ||
}, | ||
"Alpha": { | ||
"Controlled": 1.0, | ||
"Other": 1 | ||
}, | ||
"ColorRoute": [ | ||
0.2, | ||
0.2, | ||
0.2 | ||
], | ||
"DrawRoute": false, | ||
"DrawAgentId": false, | ||
"DrawEvalGoals": true, | ||
"EvalGoalColor": [ | ||
0.49, | ||
0.63, | ||
0.83 | ||
], | ||
"DrawHistory": false, | ||
"DrawHistoryDrawFace": true | ||
} | ||
}, | ||
"ML": { | ||
"RewardShapingEvaluator": { | ||
"RewardShapingPotentials": { | ||
"VelocityPotential" : { | ||
"desired_vel": 20.0, "vel_dev_max": 20.0, "exponent": 0.4, "type": "positive" | ||
} | ||
} | ||
}, | ||
"GoalReachedEvaluator": { | ||
"MaxSteps": 200 | ||
}, | ||
"InteractionNetwork": { | ||
"NumMessagePassingLayers": 2, | ||
"EmbeddingSize": 80 | ||
}, | ||
"BehaviorTFAAgents": { | ||
"NumCheckpointsToKeep": 3 | ||
}, | ||
"TFARunner": { | ||
"EvaluationSteps": 25, | ||
"InitialCollectionEpisodes": 50, | ||
"CollectionEpisodesPerStep": 1 | ||
}, | ||
"BehaviorContinuousML": { | ||
"ActionsLowerBound": [ | ||
-5.0, | ||
-0.2 | ||
], | ||
"ActionsUpperBound": [ | ||
4.0, | ||
0.2 | ||
] | ||
}, | ||
"GraphObserver": { | ||
"NormalizationEnabled": true, | ||
"AgentLimit": 5, | ||
"VisibilityRadius": 1500, | ||
"SelfLoops": true, | ||
"EnabledNodeFeatures": [ | ||
"x", | ||
"y", | ||
"theta", | ||
"vel" | ||
], | ||
"EnabledEdgeFeatures": [ | ||
"dx", | ||
"dy" | ||
] | ||
}, | ||
"BehaviorGraphSACAgent": { | ||
"ActorFcLayerParams": [ | ||
512, | ||
512 | ||
], | ||
"CriticObservationFcLayerParams": null, | ||
"CriticActionFcLayerParams": null, | ||
"CriticJointFcLayerParams": [ | ||
512, | ||
512 | ||
], | ||
"ActorLearningRate": 0.0003, | ||
"CriticLearningRate": 0.0003, | ||
"AlphaLearningRate": 0.0003, | ||
"TargetUpdateTau": 0.05, | ||
"TargetUpdatePeriod": 3, | ||
"Gamma": 0.995, | ||
"RewardScaleFactor": 1.0, | ||
"AgentName": "gnn_sac_agent", | ||
"DebugSummaries": false, | ||
"ReplayBufferCapacity": 10000, | ||
"ParallelBufferCalls": 1, | ||
"BatchSize": 512, | ||
"BufferNumSteps": 2, | ||
"BufferPrefetch": 3 | ||
}, | ||
"SACRunner": { | ||
"NumberOfCollections": 250000, | ||
"EvaluateEveryNSteps": 2000 | ||
} | ||
}, | ||
"BehaviorDynamicModel": { | ||
"IntegrationTimeDelta": 0.05000000074505806 | ||
}, | ||
"World": { | ||
"remove_agents_out_of_map": true | ||
} | ||
} |
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
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
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,29 @@ | ||
# Copyright (c) 2020 fortiss GmbH | ||
# | ||
# Authors: Patrick Hart, Julian Bernhard, Klemens Esterle, and | ||
# Tobias Kessler | ||
# | ||
# This software is released under the MIT License. | ||
# https://opensource.org/licenses/MIT | ||
|
||
|
||
import unittest | ||
import os | ||
from bark_ml.experiment.experiment import Experiment | ||
from bark_ml.experiment.experiment_runner import ExperimentRunner | ||
|
||
|
||
class PyExperimentTests(unittest.TestCase): | ||
def test_experiment(self): | ||
experiment = Experiment( | ||
os.path.join(os.path.dirname(__file__), | ||
"data/highway_gnn.json")) | ||
|
||
def test_experiment_runner(self): | ||
exp_runner = ExperimentRunner( | ||
json_file=os.path.join(os.path.dirname(__file__), | ||
"data/highway_gnn.json"), mode="evaluate", random_seed=0) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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
Oops, something went wrong.