Skip to content

1 to 1 Brain to Agent #2729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
663445d
1 to 1 Brain to Agent
vincentpierre Oct 14, 2019
43217b6
Removing editorconfig
vincentpierre Oct 14, 2019
c4c3826
Updating BallanceBall scene
vincentpierre Oct 14, 2019
9478281
grammar mistake
vincentpierre Oct 14, 2019
23edabd
Clearing the Agents of the Model runner
vincentpierre Oct 14, 2019
def23e3
Added Documentation on IBrain
vincentpierre Oct 15, 2019
324758d
Modified comments on GiveModel
vincentpierre Oct 15, 2019
356c23c
Introduced a factory
vincentpierre Oct 15, 2019
b339247
Split Learning Brain in two
vincentpierre Oct 15, 2019
31766e7
Changes to walljump
vincentpierre Oct 16, 2019
2776d05
Fixing the Unit tests
vincentpierre Oct 16, 2019
c47c349
Renaming the Brain to Policy
vincentpierre Oct 16, 2019
e832960
Heuristic now has priority over training
vincentpierre Oct 16, 2019
0bb25d6
Edited code comments
vincentpierre Oct 16, 2019
4bfb530
Fixing bugs
vincentpierre Oct 16, 2019
49152e4
Resolving conflicts
vincentpierre Oct 16, 2019
2f12007
Develop one to one scene edits (#2744)
vincentpierre Oct 16, 2019
e15500d
Moving the policies in a separate folder
vincentpierre Oct 17, 2019
4c01bee
Missing meta file
vincentpierre Oct 17, 2019
3ca1516
Develop one to one with component (#2753)
vincentpierre Oct 21, 2019
87c535d
Removing references to Brain in the Academy comments;
vincentpierre Oct 21, 2019
03d6712
Develop one to one documentation (#2742)
vincentpierre Oct 21, 2019
0b47fd7
resolving conflicts
vincentpierre Oct 22, 2019
c0014e6
Removing warning in the Agent Inspector when Vis Obs is used
vincentpierre Oct 22, 2019
90fac1f
Fixing C# unit tests
vincentpierre Oct 22, 2019
6715a14
Merge branch 'develop' into develop-one-to-one
vincentpierre Oct 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed UnitySDK/Assets/Gizmos/HeuristicBrain Icon.png
Binary file not shown.
76 changes: 0 additions & 76 deletions UnitySDK/Assets/Gizmos/HeuristicBrain Icon.png.meta

This file was deleted.

Binary file removed UnitySDK/Assets/Gizmos/LearningBrain Icon.png
Binary file not shown.
76 changes: 0 additions & 76 deletions UnitySDK/Assets/Gizmos/LearningBrain Icon.png.meta

This file was deleted.

Binary file removed UnitySDK/Assets/Gizmos/PlayerBrain Icon.png
Binary file not shown.
76 changes: 0 additions & 76 deletions UnitySDK/Assets/Gizmos/PlayerBrain Icon.png.meta

This file was deleted.

10 changes: 4 additions & 6 deletions UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using UnityEngine;
using UnityEditor;
using Barracuda;

namespace MLAgents
{
/*
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.
*/
/*
This code is meant to modify the behavior of the inspector on Agent Components.
*/
[CustomEditor(typeof(Agent), true)]
[CanEditMultipleObjects]
public class AgentEditor : Editor
Expand All @@ -16,7 +16,6 @@ public override void OnInspectorGUI()
var serializedAgent = serializedObject;
serializedAgent.Update();

var brain = serializedAgent.FindProperty("brain");
var actionsPerDecision = serializedAgent.FindProperty(
"agentParameters.numberOfActionsBetweenDecisions");
var maxSteps = serializedAgent.FindProperty(
Expand All @@ -26,7 +25,6 @@ public override void OnInspectorGUI()
var isOdd = serializedAgent.FindProperty(
"agentParameters.onDemandDecision");

EditorGUILayout.PropertyField(brain);


EditorGUILayout.PropertyField(
Expand Down
78 changes: 78 additions & 0 deletions UnitySDK/Assets/ML-Agents/Editor/BehaviorParametersEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using UnityEngine;
using UnityEditor;
using Barracuda;

namespace MLAgents
{
/*
This code is meant to modify the behavior of the inspector on Agent Components.
*/
[CustomEditor(typeof(BehaviorParameters))]
[CanEditMultipleObjects]
public class BehaviorParametersEditor : Editor
{
private const float k_TimeBetweenModelReloads = 2f;
// Time since the last reload of the model
private float m_TimeSinceModelReload;
// Whether or not the model needs to be reloaded
private bool m_RequireReload;

public override void OnInspectorGUI()
{
var serializedObject = base.serializedObject;
serializedObject.Update();

// Drawing the Behavior Parameters
EditorGUI.BeginChangeCheck();
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BehaviorName"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BrainParameters"), true);
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Model"), true);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_InferenceDevice"), true);
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_UseHeuristic"));
// EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Heuristic"), true);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck())
{
m_RequireReload = true;
}
DisplayFailedModelChecks();
serializedObject.ApplyModifiedProperties();
}

/// <summary>
/// Must be called within OnEditorGUI()
/// </summary>
private void DisplayFailedModelChecks()
{
if (m_RequireReload && m_TimeSinceModelReload > k_TimeBetweenModelReloads)
{
m_RequireReload = false;
m_TimeSinceModelReload = 0;
}
// Display all failed checks
D.logEnabled = false;
Model barracudaModel = null;
var model = (NNModel)serializedObject.FindProperty("m_Model").objectReferenceValue;
var brainParameters = ((BehaviorParameters)target).brainParameters;
if (model != null)
{
barracudaModel = ModelLoader.Load(model.Value);
}
if (brainParameters != null)
{
var failedChecks = InferenceBrain.BarracudaModelParamLoader.CheckModel(
barracudaModel, brainParameters);
foreach (var check in failedChecks)
{
if (check != null)
{
EditorGUILayout.HelpBox(check, MessageType.Warning);
}
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 0 additions & 36 deletions UnitySDK/Assets/ML-Agents/Editor/BrainEditor.cs

This file was deleted.

3 changes: 0 additions & 3 deletions UnitySDK/Assets/ML-Agents/Editor/BrainEditor.cs.meta

This file was deleted.

Loading