浏览代码
Merge branch 'master' of github.com:Unity-Technologies/ml-agents into develop-agentprocessor
/develop-newnormalization
Merge branch 'master' of github.com:Unity-Technologies/ml-agents into develop-agentprocessor
/develop-newnormalization
Ervin Teng
5 年前
当前提交
88b1123a
共有 84 个文件被更改,包括 780 次插入 和 1689 次删除
-
11CONTRIBUTING.md
-
3README.md
-
1UnitySDK/Assets/ML-Agents/Editor/Tests/DemonstrationTests.cs
-
1UnitySDK/Assets/ML-Agents/Editor/Tests/EditModeTestInternalBrainTensorGenerator.cs
-
8UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs
-
7UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAcademy.cs
-
8UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs
-
8UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs
-
2UnitySDK/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs
-
6UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs
-
5UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs
-
12UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAcademy.cs
-
4UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs
-
14UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scripts/GridArea.cs
-
13UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs
-
3UnitySDK/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAcademy.cs
-
9UnitySDK/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs
-
4UnitySDK/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerAcademy.cs
-
2UnitySDK/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerFieldArea.cs
-
5UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAcademy.cs
-
8UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs
-
6UnitySDK/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAcademy.cs
-
14UnitySDK/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs
-
11UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs
-
200UnitySDK/Assets/ML-Agents/Scripts/Academy.cs
-
52UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/UnityRlInitializationOutput.cs
-
92UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/UnityRlInput.cs
-
23UnitySDK/Assets/ML-Agents/Scripts/Grpc/GrpcExtensions.cs
-
22UnitySDK/Assets/ML-Agents/Scripts/Grpc/RpcCommunicator.cs
-
27UnitySDK/Assets/ML-Agents/Scripts/ICommunicator.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/SideChannel/EngineConfigurationChannel.cs
-
38docs/Basic-Guide.md
-
30docs/FAQ.md
-
23docs/Getting-Started-with-Balance-Ball.md
-
6docs/Installation-Windows.md
-
25docs/Installation.md
-
3docs/Learning-Environment-Create-New.md
-
12docs/Learning-Environment-Design-Academy.md
-
6docs/Learning-Environment-Design.md
-
28docs/Learning-Environment-Examples.md
-
18docs/Learning-Environment-Executable.md
-
22docs/Migrating.md
-
81docs/Python-API.md
-
5docs/Training-Curriculum-Learning.md
-
4docs/Training-Generalized-Reinforcement-Learning-Agents.md
-
23docs/Training-ML-Agents.md
-
2docs/Training-on-Amazon-Web-Service.md
-
14ml-agents-envs/mlagents/envs/base_unity_environment.py
-
17ml-agents-envs/mlagents/envs/communicator_objects/unity_rl_initialization_output_pb2.py
-
14ml-agents-envs/mlagents/envs/communicator_objects/unity_rl_initialization_output_pb2.pyi
-
36ml-agents-envs/mlagents/envs/communicator_objects/unity_rl_input_pb2.py
-
16ml-agents-envs/mlagents/envs/communicator_objects/unity_rl_input_pb2.pyi
-
11ml-agents-envs/mlagents/envs/env_manager.py
-
66ml-agents-envs/mlagents/envs/environment.py
-
25ml-agents-envs/mlagents/envs/side_channel/engine_configuration_channel.py
-
29ml-agents-envs/mlagents/envs/simple_env_manager.py
-
71ml-agents-envs/mlagents/envs/subprocess_env_manager.py
-
35ml-agents-envs/mlagents/envs/tests/test_subprocess_env_manager.py
-
9ml-agents/mlagents/trainers/curriculum.py
-
70ml-agents/mlagents/trainers/learn.py
-
8ml-agents/mlagents/trainers/meta_curriculum.py
-
7ml-agents/mlagents/trainers/ppo/policy.py
-
3ml-agents/mlagents/trainers/tests/mock_brain.py
-
8ml-agents/mlagents/trainers/tests/test_curriculum.py
-
4ml-agents/mlagents/trainers/tests/test_learn.py
-
9ml-agents/mlagents/trainers/tests/test_meta_curriculum.py
-
5ml-agents/mlagents/trainers/tests/test_sac.py
-
4ml-agents/mlagents/trainers/tests/test_simple_rl.py
-
2ml-agents/mlagents/trainers/tests/test_trainer_controller.py
-
12ml-agents/mlagents/trainers/tf_policy.py
-
4ml-agents/mlagents/trainers/trainer_controller.py
-
3protobuf-definitions/proto/mlagents/envs/communicator_objects/unity_rl_initialization_output.proto
-
5protobuf-definitions/proto/mlagents/envs/communicator_objects/unity_rl_input.proto
-
259docs/images/barracuda-package.png
-
179UnitySDK/Assets/ML-Agents/Editor/ResetParameterDrawer.cs
-
12UnitySDK/Assets/ML-Agents/Editor/ResetParameterDrawer.cs.meta
-
207UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/EnvironmentParameters.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/EnvironmentParameters.cs.meta
-
61UnitySDK/Assets/ML-Agents/Scripts/ResetParameters.cs
-
12UnitySDK/Assets/ML-Agents/Scripts/ResetParameters.cs.meta
-
116docs/images/academy.png
-
130ml-agents-envs/mlagents/envs/communicator_objects/environment_parameters_pb2.py
-
75ml-agents-envs/mlagents/envs/communicator_objects/environment_parameters_pb2.pyi
-
11protobuf-definitions/proto/mlagents/envs/communicator_objects/environment_parameters.proto
|
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor.SceneManagement; |
|||
using UnityEngine.SceneManagement; |
|||
|
|||
namespace MLAgents |
|||
{ |
|||
/// <summary>
|
|||
/// PropertyDrawer for ResetParameters. Defines how ResetParameters are displayed in the
|
|||
/// Inspector.
|
|||
/// </summary>
|
|||
[CustomPropertyDrawer(typeof(ResetParameters))] |
|||
public class ResetParameterDrawer : PropertyDrawer |
|||
{ |
|||
ResetParameters m_Parameters; |
|||
// The height of a line in the Unity Inspectors
|
|||
const float k_LineHeight = 17f; |
|||
// This is the prefix for the key when you add a reset parameter
|
|||
const string k_NewKeyPrefix = "Param-"; |
|||
|
|||
/// <summary>
|
|||
/// Computes the height of the Drawer depending on the property it is showing
|
|||
/// </summary>
|
|||
/// <param name="property">The property that is being drawn.</param>
|
|||
/// <param name="label">The label of the property being drawn.</param>
|
|||
/// <returns>The vertical space needed to draw the property.</returns>
|
|||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) |
|||
{ |
|||
LazyInitializeParameters(property); |
|||
return (m_Parameters.Count + 2) * k_LineHeight; |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) |
|||
{ |
|||
LazyInitializeParameters(property); |
|||
position.height = k_LineHeight; |
|||
EditorGUI.LabelField(position, label); |
|||
position.y += k_LineHeight; |
|||
var width = position.width / 2 - 24; |
|||
var keyRect = new Rect(position.x + 20, position.y, width, position.height); |
|||
var valueRect = new Rect(position.x + width + 30, position.y, width, position.height); |
|||
DrawAddRemoveButtons(keyRect, valueRect); |
|||
EditorGUI.BeginProperty(position, label, property); |
|||
foreach (var parameter in m_Parameters) |
|||
{ |
|||
var key = parameter.Key; |
|||
var value = parameter.Value; |
|||
keyRect.y += k_LineHeight; |
|||
valueRect.y += k_LineHeight; |
|||
EditorGUI.BeginChangeCheck(); |
|||
var newKey = EditorGUI.TextField(keyRect, key); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
MarkSceneAsDirty(); |
|||
try |
|||
{ |
|||
m_Parameters.Remove(key); |
|||
m_Parameters.Add(newKey, value); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
Debug.Log(e.Message); |
|||
} |
|||
break; |
|||
} |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
value = EditorGUI.FloatField(valueRect, value); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
MarkSceneAsDirty(); |
|||
m_Parameters[key] = value; |
|||
break; |
|||
} |
|||
} |
|||
EditorGUI.EndProperty(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the Add and Remove buttons.
|
|||
/// </summary>
|
|||
/// <param name="addRect">The rectangle for the Add New button.</param>
|
|||
/// <param name="removeRect">The rectangle for the Remove Last button.</param>
|
|||
void DrawAddRemoveButtons(Rect addRect, Rect removeRect) |
|||
{ |
|||
// This is the Add button
|
|||
if (m_Parameters.Count == 0) |
|||
{ |
|||
addRect.width *= 2; |
|||
} |
|||
if (GUI.Button(addRect, |
|||
new GUIContent("Add New", "Add a new item to the default reset parameters"), |
|||
EditorStyles.miniButton)) |
|||
{ |
|||
MarkSceneAsDirty(); |
|||
AddParameter(); |
|||
} |
|||
|
|||
// If there are no items in the ResetParameters, Hide the Remove button
|
|||
if (m_Parameters.Count == 0) |
|||
{ |
|||
return; |
|||
} |
|||
// This is the Remove button
|
|||
if (GUI.Button(removeRect, |
|||
new GUIContent( |
|||
"Remove Last", "Remove the last item from the default reset parameters"), |
|||
EditorStyles.miniButton)) |
|||
{ |
|||
MarkSceneAsDirty(); |
|||
RemoveLastParameter(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Signals that the property has been modified and requires the scene to be saved for
|
|||
/// the changes to persist. Only works when the Editor is not playing.
|
|||
/// </summary>
|
|||
static void MarkSceneAsDirty() |
|||
{ |
|||
if (!EditorApplication.isPlaying) |
|||
{ |
|||
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Ensures that the state of the Drawer is synchronized with the property.
|
|||
/// </summary>
|
|||
/// <param name="property">The SerializedProperty of the ResetParameters
|
|||
/// to make the custom GUI for.</param>
|
|||
void LazyInitializeParameters(SerializedProperty property) |
|||
{ |
|||
if (m_Parameters != null) |
|||
{ |
|||
return; |
|||
} |
|||
var target = property.serializedObject.targetObject; |
|||
m_Parameters = fieldInfo.GetValue(target) as ResetParameters; |
|||
if (m_Parameters == null) |
|||
{ |
|||
m_Parameters = new ResetParameters(); |
|||
fieldInfo.SetValue(target, m_Parameters); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Removes the last ResetParameter from the ResetParameters
|
|||
/// </summary>
|
|||
void RemoveLastParameter() |
|||
{ |
|||
if (m_Parameters.Count > 0) |
|||
{ |
|||
var key = m_Parameters.Keys.ToList()[m_Parameters.Count - 1]; |
|||
m_Parameters.Remove(key); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Adds a new ResetParameter to the ResetParameters with a default name.
|
|||
/// </summary>
|
|||
void AddParameter() |
|||
{ |
|||
var key = k_NewKeyPrefix + m_Parameters.Count; |
|||
var value = default(float); |
|||
try |
|||
{ |
|||
m_Parameters.Add(key, value); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
Debug.Log(e.Message); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 740b9a60fe38f476ab020dcf91f3f94a |
|||
timeCreated: 1517291065 |
|||
licenseType: Free |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// <auto-generated>
|
|||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|||
// source: mlagents/envs/communicator_objects/environment_parameters.proto
|
|||
// </auto-generated>
|
|||
#pragma warning disable 1591, 0612, 3021
|
|||
#region Designer generated code
|
|||
|
|||
using pb = global::Google.Protobuf; |
|||
using pbc = global::Google.Protobuf.Collections; |
|||
using pbr = global::Google.Protobuf.Reflection; |
|||
using scg = global::System.Collections.Generic; |
|||
namespace MLAgents.CommunicatorObjects { |
|||
|
|||
/// <summary>Holder for reflection information generated from mlagents/envs/communicator_objects/environment_parameters.proto</summary>
|
|||
public static partial class EnvironmentParametersReflection { |
|||
|
|||
#region Descriptor
|
|||
/// <summary>File descriptor for mlagents/envs/communicator_objects/environment_parameters.proto</summary>
|
|||
public static pbr::FileDescriptor Descriptor { |
|||
get { return descriptor; } |
|||
} |
|||
private static pbr::FileDescriptor descriptor; |
|||
|
|||
static EnvironmentParametersReflection() { |
|||
byte[] descriptorData = global::System.Convert.FromBase64String( |
|||
string.Concat( |
|||
"Cj9tbGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL2Vudmlyb25t", |
|||
"ZW50X3BhcmFtZXRlcnMucHJvdG8SFGNvbW11bmljYXRvcl9vYmplY3RzGkBt", |
|||
"bGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL2N1c3RvbV9yZXNl", |
|||
"dF9wYXJhbWV0ZXJzLnByb3RvIogCChpFbnZpcm9ubWVudFBhcmFtZXRlcnNQ", |
|||
"cm90bxJfChBmbG9hdF9wYXJhbWV0ZXJzGAEgAygLMkUuY29tbXVuaWNhdG9y", |
|||
"X29iamVjdHMuRW52aXJvbm1lbnRQYXJhbWV0ZXJzUHJvdG8uRmxvYXRQYXJh", |
|||
"bWV0ZXJzRW50cnkSUQoXY3VzdG9tX3Jlc2V0X3BhcmFtZXRlcnMYAiABKAsy", |
|||
"MC5jb21tdW5pY2F0b3Jfb2JqZWN0cy5DdXN0b21SZXNldFBhcmFtZXRlcnNQ", |
|||
"cm90bxo2ChRGbG9hdFBhcmFtZXRlcnNFbnRyeRILCgNrZXkYASABKAkSDQoF", |
|||
"dmFsdWUYAiABKAI6AjgBQh+qAhxNTEFnZW50cy5Db21tdW5pY2F0b3JPYmpl", |
|||
"Y3RzYgZwcm90bzM=")); |
|||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
|||
new pbr::FileDescriptor[] { global::MLAgents.CommunicatorObjects.CustomResetParametersReflection.Descriptor, }, |
|||
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { |
|||
new pbr::GeneratedClrTypeInfo(typeof(global::MLAgents.CommunicatorObjects.EnvironmentParametersProto), global::MLAgents.CommunicatorObjects.EnvironmentParametersProto.Parser, new[]{ "FloatParameters", "CustomResetParameters" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }) |
|||
})); |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
#region Messages
|
|||
public sealed partial class EnvironmentParametersProto : pb::IMessage<EnvironmentParametersProto> { |
|||
private static readonly pb::MessageParser<EnvironmentParametersProto> _parser = new pb::MessageParser<EnvironmentParametersProto>(() => new EnvironmentParametersProto()); |
|||
private pb::UnknownFieldSet _unknownFields; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pb::MessageParser<EnvironmentParametersProto> Parser { get { return _parser; } } |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pbr::MessageDescriptor Descriptor { |
|||
get { return global::MLAgents.CommunicatorObjects.EnvironmentParametersReflection.Descriptor.MessageTypes[0]; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
pbr::MessageDescriptor pb::IMessage.Descriptor { |
|||
get { return Descriptor; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public EnvironmentParametersProto() { |
|||
OnConstruction(); |
|||
} |
|||
|
|||
partial void OnConstruction(); |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public EnvironmentParametersProto(EnvironmentParametersProto other) : this() { |
|||
floatParameters_ = other.floatParameters_.Clone(); |
|||
CustomResetParameters = other.customResetParameters_ != null ? other.CustomResetParameters.Clone() : null; |
|||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public EnvironmentParametersProto Clone() { |
|||
return new EnvironmentParametersProto(this); |
|||
} |
|||
|
|||
/// <summary>Field number for the "float_parameters" field.</summary>
|
|||
public const int FloatParametersFieldNumber = 1; |
|||
private static readonly pbc::MapField<string, float>.Codec _map_floatParameters_codec |
|||
= new pbc::MapField<string, float>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForFloat(21), 10); |
|||
private readonly pbc::MapField<string, float> floatParameters_ = new pbc::MapField<string, float>(); |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public pbc::MapField<string, float> FloatParameters { |
|||
get { return floatParameters_; } |
|||
} |
|||
|
|||
/// <summary>Field number for the "custom_reset_parameters" field.</summary>
|
|||
public const int CustomResetParametersFieldNumber = 2; |
|||
private global::MLAgents.CommunicatorObjects.CustomResetParametersProto customResetParameters_; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public global::MLAgents.CommunicatorObjects.CustomResetParametersProto CustomResetParameters { |
|||
get { return customResetParameters_; } |
|||
set { |
|||
customResetParameters_ = value; |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override bool Equals(object other) { |
|||
return Equals(other as EnvironmentParametersProto); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public bool Equals(EnvironmentParametersProto other) { |
|||
if (ReferenceEquals(other, null)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(other, this)) { |
|||
return true; |
|||
} |
|||
if (!FloatParameters.Equals(other.FloatParameters)) return false; |
|||
if (!object.Equals(CustomResetParameters, other.CustomResetParameters)) return false; |
|||
return Equals(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override int GetHashCode() { |
|||
int hash = 1; |
|||
hash ^= FloatParameters.GetHashCode(); |
|||
if (customResetParameters_ != null) hash ^= CustomResetParameters.GetHashCode(); |
|||
if (_unknownFields != null) { |
|||
hash ^= _unknownFields.GetHashCode(); |
|||
} |
|||
return hash; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override string ToString() { |
|||
return pb::JsonFormatter.ToDiagnosticString(this); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void WriteTo(pb::CodedOutputStream output) { |
|||
floatParameters_.WriteTo(output, _map_floatParameters_codec); |
|||
if (customResetParameters_ != null) { |
|||
output.WriteRawTag(18); |
|||
output.WriteMessage(CustomResetParameters); |
|||
} |
|||
if (_unknownFields != null) { |
|||
_unknownFields.WriteTo(output); |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public int CalculateSize() { |
|||
int size = 0; |
|||
size += floatParameters_.CalculateSize(_map_floatParameters_codec); |
|||
if (customResetParameters_ != null) { |
|||
size += 1 + pb::CodedOutputStream.ComputeMessageSize(CustomResetParameters); |
|||
} |
|||
if (_unknownFields != null) { |
|||
size += _unknownFields.CalculateSize(); |
|||
} |
|||
return size; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(EnvironmentParametersProto other) { |
|||
if (other == null) { |
|||
return; |
|||
} |
|||
floatParameters_.Add(other.floatParameters_); |
|||
if (other.customResetParameters_ != null) { |
|||
if (customResetParameters_ == null) { |
|||
customResetParameters_ = new global::MLAgents.CommunicatorObjects.CustomResetParametersProto(); |
|||
} |
|||
CustomResetParameters.MergeFrom(other.CustomResetParameters); |
|||
} |
|||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(pb::CodedInputStream input) { |
|||
uint tag; |
|||
while ((tag = input.ReadTag()) != 0) { |
|||
switch(tag) { |
|||
default: |
|||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); |
|||
break; |
|||
case 10: { |
|||
floatParameters_.AddEntriesFrom(input, _map_floatParameters_codec); |
|||
break; |
|||
} |
|||
case 18: { |
|||
if (customResetParameters_ == null) { |
|||
customResetParameters_ = new global::MLAgents.CommunicatorObjects.CustomResetParametersProto(); |
|||
} |
|||
input.ReadMessage(customResetParameters_); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
} |
|||
|
|||
#endregion Designer generated code
|
|
|||
fileFormatVersion: 2 |
|||
guid: 8b4c58a64d6a94f579774322ef683b17 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Serialization; |
|||
|
|||
namespace MLAgents |
|||
{ |
|||
[Serializable] |
|||
public class ResetParameters : Dictionary<string, float>, ISerializationCallbackReceiver |
|||
{ |
|||
[Serializable] |
|||
public struct ResetParameter |
|||
{ |
|||
public string key; |
|||
public float value; |
|||
} |
|||
|
|||
public ResetParameters() {} |
|||
|
|||
public ResetParameters(IDictionary<string, float> dict) : base(dict) |
|||
{ |
|||
UpdateResetParameters(); |
|||
} |
|||
|
|||
void UpdateResetParameters() |
|||
{ |
|||
m_ResetParameters.Clear(); |
|||
foreach (var pair in this) |
|||
{ |
|||
m_ResetParameters.Add(new ResetParameter { key = pair.Key, value = pair.Value }); |
|||
} |
|||
} |
|||
|
|||
[FormerlySerializedAs("resetParameters")] |
|||
[SerializeField] |
|||
List<ResetParameter> m_ResetParameters = new List<ResetParameter>(); |
|||
|
|||
public void OnBeforeSerialize() |
|||
{ |
|||
UpdateResetParameters(); |
|||
} |
|||
|
|||
public void OnAfterDeserialize() |
|||
{ |
|||
Clear(); |
|||
|
|||
|
|||
for (var i = 0; i < m_ResetParameters.Count; i++) |
|||
{ |
|||
if (ContainsKey(m_ResetParameters[i].key)) |
|||
{ |
|||
Debug.LogError("The ResetParameters contains the same key twice"); |
|||
} |
|||
else |
|||
{ |
|||
Add(m_ResetParameters[i].key, m_ResetParameters[i].value); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: af19281a4c1dd47518ac7501c45eca9f |
|||
timeCreated: 1517261137 |
|||
licenseType: Free |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT! |
|||
# source: mlagents/envs/communicator_objects/environment_parameters.proto |
|||
|
|||
import sys |
|||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) |
|||
from google.protobuf import descriptor as _descriptor |
|||
from google.protobuf import message as _message |
|||
from google.protobuf import reflection as _reflection |
|||
from google.protobuf import symbol_database as _symbol_database |
|||
from google.protobuf import descriptor_pb2 |
|||
# @@protoc_insertion_point(imports) |
|||
|
|||
_sym_db = _symbol_database.Default() |
|||
|
|||
|
|||
from mlagents.envs.communicator_objects import custom_reset_parameters_pb2 as mlagents_dot_envs_dot_communicator__objects_dot_custom__reset__parameters__pb2 |
|||
|
|||
|
|||
DESCRIPTOR = _descriptor.FileDescriptor( |
|||
name='mlagents/envs/communicator_objects/environment_parameters.proto', |
|||
package='communicator_objects', |
|||
syntax='proto3', |
|||
serialized_pb=_b('\n?mlagents/envs/communicator_objects/environment_parameters.proto\x12\x14\x63ommunicator_objects\x1a@mlagents/envs/communicator_objects/custom_reset_parameters.proto\"\x88\x02\n\x1a\x45nvironmentParametersProto\x12_\n\x10\x66loat_parameters\x18\x01 \x03(\x0b\x32\x45.communicator_objects.EnvironmentParametersProto.FloatParametersEntry\x12Q\n\x17\x63ustom_reset_parameters\x18\x02 \x01(\x0b\x32\x30.communicator_objects.CustomResetParametersProto\x1a\x36\n\x14\x46loatParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02:\x02\x38\x01\x42\x1f\xaa\x02\x1cMLAgents.CommunicatorObjectsb\x06proto3') |
|||
, |
|||
dependencies=[mlagents_dot_envs_dot_communicator__objects_dot_custom__reset__parameters__pb2.DESCRIPTOR,]) |
|||
|
|||
|
|||
|
|||
|
|||
_ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY = _descriptor.Descriptor( |
|||
name='FloatParametersEntry', |
|||
full_name='communicator_objects.EnvironmentParametersProto.FloatParametersEntry', |
|||
filename=None, |
|||
file=DESCRIPTOR, |
|||
containing_type=None, |
|||
fields=[ |
|||
_descriptor.FieldDescriptor( |
|||
name='key', full_name='communicator_objects.EnvironmentParametersProto.FloatParametersEntry.key', index=0, |
|||
number=1, type=9, cpp_type=9, label=1, |
|||
has_default_value=False, default_value=_b("").decode('utf-8'), |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
_descriptor.FieldDescriptor( |
|||
name='value', full_name='communicator_objects.EnvironmentParametersProto.FloatParametersEntry.value', index=1, |
|||
number=2, type=2, cpp_type=6, label=1, |
|||
has_default_value=False, default_value=float(0), |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
], |
|||
extensions=[ |
|||
], |
|||
nested_types=[], |
|||
enum_types=[ |
|||
], |
|||
options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')), |
|||
is_extendable=False, |
|||
syntax='proto3', |
|||
extension_ranges=[], |
|||
oneofs=[ |
|||
], |
|||
serialized_start=366, |
|||
serialized_end=420, |
|||
) |
|||
|
|||
_ENVIRONMENTPARAMETERSPROTO = _descriptor.Descriptor( |
|||
name='EnvironmentParametersProto', |
|||
full_name='communicator_objects.EnvironmentParametersProto', |
|||
filename=None, |
|||
file=DESCRIPTOR, |
|||
containing_type=None, |
|||
fields=[ |
|||
_descriptor.FieldDescriptor( |
|||
name='float_parameters', full_name='communicator_objects.EnvironmentParametersProto.float_parameters', index=0, |
|||
number=1, type=11, cpp_type=10, label=3, |
|||
has_default_value=False, default_value=[], |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
_descriptor.FieldDescriptor( |
|||
name='custom_reset_parameters', full_name='communicator_objects.EnvironmentParametersProto.custom_reset_parameters', index=1, |
|||
number=2, type=11, cpp_type=10, label=1, |
|||
has_default_value=False, default_value=None, |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
], |
|||
extensions=[ |
|||
], |
|||
nested_types=[_ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY, ], |
|||
enum_types=[ |
|||
], |
|||
options=None, |
|||
is_extendable=False, |
|||
syntax='proto3', |
|||
extension_ranges=[], |
|||
oneofs=[ |
|||
], |
|||
serialized_start=156, |
|||
serialized_end=420, |
|||
) |
|||
|
|||
_ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY.containing_type = _ENVIRONMENTPARAMETERSPROTO |
|||
_ENVIRONMENTPARAMETERSPROTO.fields_by_name['float_parameters'].message_type = _ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY |
|||
_ENVIRONMENTPARAMETERSPROTO.fields_by_name['custom_reset_parameters'].message_type = mlagents_dot_envs_dot_communicator__objects_dot_custom__reset__parameters__pb2._CUSTOMRESETPARAMETERSPROTO |
|||
DESCRIPTOR.message_types_by_name['EnvironmentParametersProto'] = _ENVIRONMENTPARAMETERSPROTO |
|||
_sym_db.RegisterFileDescriptor(DESCRIPTOR) |
|||
|
|||
EnvironmentParametersProto = _reflection.GeneratedProtocolMessageType('EnvironmentParametersProto', (_message.Message,), dict( |
|||
|
|||
FloatParametersEntry = _reflection.GeneratedProtocolMessageType('FloatParametersEntry', (_message.Message,), dict( |
|||
DESCRIPTOR = _ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY, |
|||
__module__ = 'mlagents.envs.communicator_objects.environment_parameters_pb2' |
|||
# @@protoc_insertion_point(class_scope:communicator_objects.EnvironmentParametersProto.FloatParametersEntry) |
|||
)) |
|||
, |
|||
DESCRIPTOR = _ENVIRONMENTPARAMETERSPROTO, |
|||
__module__ = 'mlagents.envs.communicator_objects.environment_parameters_pb2' |
|||
# @@protoc_insertion_point(class_scope:communicator_objects.EnvironmentParametersProto) |
|||
)) |
|||
_sym_db.RegisterMessage(EnvironmentParametersProto) |
|||
_sym_db.RegisterMessage(EnvironmentParametersProto.FloatParametersEntry) |
|||
|
|||
|
|||
DESCRIPTOR.has_options = True |
|||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\252\002\034MLAgents.CommunicatorObjects')) |
|||
_ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY.has_options = True |
|||
_ENVIRONMENTPARAMETERSPROTO_FLOATPARAMETERSENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) |
|||
# @@protoc_insertion_point(module_scope) |
|
|||
# @generated by generate_proto_mypy_stubs.py. Do not edit! |
|||
import sys |
|||
from google.protobuf.descriptor import ( |
|||
Descriptor as google___protobuf___descriptor___Descriptor, |
|||
) |
|||
|
|||
from google.protobuf.message import ( |
|||
Message as google___protobuf___message___Message, |
|||
) |
|||
|
|||
from mlagents.envs.communicator_objects.custom_reset_parameters_pb2 import ( |
|||
CustomResetParametersProto as mlagents___envs___communicator_objects___custom_reset_parameters_pb2___CustomResetParametersProto, |
|||
) |
|||
|
|||
from typing import ( |
|||
Mapping as typing___Mapping, |
|||
MutableMapping as typing___MutableMapping, |
|||
Optional as typing___Optional, |
|||
Text as typing___Text, |
|||
) |
|||
|
|||
from typing_extensions import ( |
|||
Literal as typing_extensions___Literal, |
|||
) |
|||
|
|||
|
|||
builtin___bool = bool |
|||
builtin___bytes = bytes |
|||
builtin___float = float |
|||
builtin___int = int |
|||
|
|||
|
|||
class EnvironmentParametersProto(google___protobuf___message___Message): |
|||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... |
|||
class FloatParametersEntry(google___protobuf___message___Message): |
|||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... |
|||
key = ... # type: typing___Text |
|||
value = ... # type: builtin___float |
|||
|
|||
def __init__(self, |
|||
*, |
|||
key : typing___Optional[typing___Text] = None, |
|||
value : typing___Optional[builtin___float] = None, |
|||
) -> None: ... |
|||
@classmethod |
|||
def FromString(cls, s: builtin___bytes) -> EnvironmentParametersProto.FloatParametersEntry: ... |
|||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
if sys.version_info >= (3,): |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"key",u"value"]) -> None: ... |
|||
else: |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"key",b"key",u"value",b"value"]) -> None: ... |
|||
|
|||
|
|||
@property |
|||
def float_parameters(self) -> typing___MutableMapping[typing___Text, builtin___float]: ... |
|||
|
|||
@property |
|||
def custom_reset_parameters(self) -> mlagents___envs___communicator_objects___custom_reset_parameters_pb2___CustomResetParametersProto: ... |
|||
|
|||
def __init__(self, |
|||
*, |
|||
float_parameters : typing___Optional[typing___Mapping[typing___Text, builtin___float]] = None, |
|||
custom_reset_parameters : typing___Optional[mlagents___envs___communicator_objects___custom_reset_parameters_pb2___CustomResetParametersProto] = None, |
|||
) -> None: ... |
|||
@classmethod |
|||
def FromString(cls, s: builtin___bytes) -> EnvironmentParametersProto: ... |
|||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
if sys.version_info >= (3,): |
|||
def HasField(self, field_name: typing_extensions___Literal[u"custom_reset_parameters"]) -> builtin___bool: ... |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"custom_reset_parameters",u"float_parameters"]) -> None: ... |
|||
else: |
|||
def HasField(self, field_name: typing_extensions___Literal[u"custom_reset_parameters",b"custom_reset_parameters"]) -> builtin___bool: ... |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"custom_reset_parameters",b"custom_reset_parameters",u"float_parameters",b"float_parameters"]) -> None: ... |
|
|||
syntax = "proto3"; |
|||
|
|||
import "mlagents/envs/communicator_objects/custom_reset_parameters.proto"; |
|||
|
|||
option csharp_namespace = "MLAgents.CommunicatorObjects"; |
|||
package communicator_objects; |
|||
|
|||
message EnvironmentParametersProto { |
|||
map<string, float> float_parameters = 1; |
|||
CustomResetParametersProto custom_reset_parameters = 2; |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue