-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of environment, models still need tuning
- Loading branch information
Showing
503 changed files
with
83,408 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,42 @@ | ||
## Ignore Unity temporary files, build results, etc | ||
/[Ll]ibrary/ | ||
/[Tt]emp/ | ||
/[Oo]bj/ | ||
/[Bb]uild/ | ||
/[Bb]uilds/ | ||
/Assets/AssetStoreTools* | ||
/[Bb]uilds[Nn][Cc]lips/ | ||
/.vs/ | ||
|
||
# Autogenerated VS/MD solution and project files | ||
ExportedObj/ | ||
.vs/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
|
||
# Unity3D Generated File On Crash Reports | ||
sysinfo.txt | ||
|
||
# Tensorflow Sharp Files | ||
/Assets/ML-Agents/Plugins/Android* | ||
/Assets/ML-Agents/Plugins/iOS* | ||
/Assets/ML-Agents/Plugins/Computer* | ||
/Assets/ML-Agents/Plugins/System* | ||
|
||
# Builds | ||
*.apk | ||
*.unitypackage | ||
|
||
# OSX | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,80 @@ | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
/* | ||
This code is meant to modify the behavior of the inspector on Brain Components. | ||
Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly. | ||
*/ | ||
[CustomEditor(typeof(Agent), true)] | ||
[CanEditMultipleObjects] | ||
public class AgentEditor : Editor | ||
{ | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
SerializedObject serializedAgent = serializedObject; | ||
serializedAgent.Update(); | ||
|
||
SerializedProperty brain = serializedAgent.FindProperty("brain"); | ||
SerializedProperty actionsPerDecision = serializedAgent.FindProperty( | ||
"agentParameters.numberOfActionsBetweenDecisions"); | ||
SerializedProperty maxSteps = serializedAgent.FindProperty( | ||
"agentParameters.maxStep"); | ||
SerializedProperty isResetOnDone = serializedAgent.FindProperty( | ||
"agentParameters.resetOnDone"); | ||
SerializedProperty isODD = serializedAgent.FindProperty( | ||
"agentParameters.onDemandDecision"); | ||
SerializedProperty cameras = serializedAgent.FindProperty( | ||
"agentParameters.agentCameras"); | ||
|
||
EditorGUILayout.PropertyField(brain); | ||
|
||
EditorGUILayout.LabelField("Agent Cameras"); | ||
for (int i = 0; i < cameras.arraySize; i++) | ||
{ | ||
EditorGUILayout.PropertyField( | ||
cameras.GetArrayElementAtIndex(i), | ||
new GUIContent("Camera " + (i + 1).ToString() + ": ")); | ||
} | ||
EditorGUILayout.BeginHorizontal(); | ||
if (GUILayout.Button("Add Camera", EditorStyles.miniButton)) | ||
{ | ||
cameras.arraySize++; | ||
} | ||
if (GUILayout.Button("Remove Camera", EditorStyles.miniButton)) | ||
{ | ||
cameras.arraySize--; | ||
} | ||
EditorGUILayout.EndHorizontal(); | ||
|
||
EditorGUILayout.PropertyField( | ||
maxSteps, | ||
new GUIContent( | ||
"Max Step", "The per-agent maximum number of steps.")); | ||
EditorGUILayout.PropertyField( | ||
isResetOnDone, | ||
new GUIContent( | ||
"Reset On Done", | ||
"If checked, the agent will reset on done. Else, AgentOnDone() will be called.")); | ||
EditorGUILayout.PropertyField( | ||
isODD, | ||
new GUIContent( | ||
"On Demand Decisions", | ||
"If checked, you must manually request decisions.")); | ||
if (!isODD.boolValue) | ||
{ | ||
EditorGUILayout.PropertyField( | ||
actionsPerDecision, | ||
new GUIContent( | ||
"Decision Frequency", | ||
"The agent will automatically request a decision every X" + | ||
" steps and perform an action at every step.")); | ||
actionsPerDecision.intValue = Mathf.Max(1, actionsPerDecision.intValue); | ||
} | ||
|
||
serializedAgent.ApplyModifiedProperties(); | ||
|
||
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); | ||
base.OnInspectorGUI(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,101 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
using UnityEditor; | ||
using System.Linq; | ||
/* | ||
This code is meant to modify the behavior of the inspector on Brain Components. | ||
Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly. | ||
*/ | ||
[CustomEditor (typeof(Brain))] | ||
public class BrainEditor : Editor | ||
{ | ||
[SerializeField] | ||
bool _Foldout = true; | ||
|
||
public override void OnInspectorGUI () | ||
{ | ||
Brain myBrain = (Brain)target; | ||
SerializedObject serializedBrain = serializedObject; | ||
|
||
if (myBrain.transform.parent == null) { | ||
EditorGUILayout.HelpBox ("A Brain GameObject must be a child of an Academy GameObject!", MessageType.Error); | ||
} else if (myBrain.transform.parent.GetComponent<Academy> () == null) { | ||
EditorGUILayout.HelpBox ("The Parent of a Brain must have an Academy Component attached to it!", MessageType.Error); | ||
} | ||
|
||
BrainParameters parameters = myBrain.brainParameters; | ||
if (parameters.vectorActionDescriptions == null || parameters.vectorActionDescriptions.Length != parameters.vectorActionSize) | ||
parameters.vectorActionDescriptions = new string[parameters.vectorActionSize]; | ||
|
||
serializedBrain.Update(); | ||
|
||
|
||
_Foldout = EditorGUILayout.Foldout(_Foldout, "Brain Parameters"); | ||
int indentLevel = EditorGUI.indentLevel; | ||
if (_Foldout) | ||
{ | ||
EditorGUI.indentLevel++; | ||
EditorGUILayout.LabelField("Vector Observation"); | ||
EditorGUI.indentLevel++; | ||
|
||
SerializedProperty bpVectorObsType = serializedBrain.FindProperty("brainParameters.vectorObservationSpaceType"); | ||
EditorGUILayout.PropertyField(bpVectorObsType, new GUIContent("Space Type", "Corresponds to whether state " + | ||
"vector contains a single integer (Discrete) " + | ||
"or a series of real-valued floats (Continuous).")); | ||
|
||
SerializedProperty bpVectorObsSize = serializedBrain.FindProperty("brainParameters.vectorObservationSize"); | ||
EditorGUILayout.PropertyField(bpVectorObsSize, new GUIContent("Space Size", "Length of state " + | ||
"vector for brain (In Continuous state space)." + | ||
"Or number of possible values (in Discrete state space).")); | ||
|
||
|
||
SerializedProperty bpNumStackedVectorObs = serializedBrain.FindProperty("brainParameters.numStackedVectorObservations"); | ||
EditorGUILayout.PropertyField(bpNumStackedVectorObs, new GUIContent("Stacked Vectors", "Number of states that" + | ||
" will be stacked before beeing fed to the neural network.")); | ||
|
||
EditorGUI.indentLevel--; | ||
SerializedProperty bpCamResol = serializedBrain.FindProperty("brainParameters.cameraResolutions"); | ||
EditorGUILayout.PropertyField(bpCamResol, new GUIContent("Visual Observation", "Describes height, " + | ||
"width, and whether to greyscale visual observations for the Brain."), true); | ||
|
||
EditorGUILayout.LabelField("Vector Action"); | ||
EditorGUI.indentLevel++; | ||
|
||
SerializedProperty bpVectorActionType = serializedBrain.FindProperty("brainParameters.vectorActionSpaceType"); | ||
EditorGUILayout.PropertyField(bpVectorActionType, new GUIContent("Space Type", "Corresponds to whether state" + | ||
" vector contains a single integer (Discrete) " + | ||
"or a series of real-valued floats (Continuous).")); | ||
|
||
SerializedProperty bpVectorActionSize = serializedBrain.FindProperty("brainParameters.vectorActionSize"); | ||
EditorGUILayout.PropertyField(bpVectorActionSize, new GUIContent("Space Size", "Length of action vector " + | ||
"for brain (In Continuous state space)." + | ||
"Or number of possible values (In Discrete action space).")); | ||
|
||
SerializedProperty bpVectorActionDescription = serializedBrain.FindProperty("brainParameters.vectorActionDescriptions"); | ||
EditorGUILayout.PropertyField(bpVectorActionDescription, new GUIContent("Action Descriptions", "A list of strings used to name" + | ||
" the available actions for the Brain."), true); | ||
|
||
} | ||
EditorGUI.indentLevel = indentLevel; | ||
SerializedProperty bt = serializedBrain.FindProperty("brainType"); | ||
EditorGUILayout.PropertyField(bt); | ||
|
||
|
||
|
||
|
||
if (bt.enumValueIndex < 0) { | ||
bt.enumValueIndex = (int)BrainType.Player; | ||
} | ||
|
||
serializedBrain.ApplyModifiedProperties(); | ||
|
||
myBrain.UpdateCoreBrains (); | ||
myBrain.coreBrain.OnInspector (); | ||
|
||
#if !NET_4_6 && ENABLE_TENSORFLOW | ||
EditorGUILayout.HelpBox ("You cannot have ENABLE_TENSORFLOW without NET_4_6", MessageType.Error); | ||
#endif | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.