File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ and this project adheres to
1515
1616### Minor Changes
1717#### com.unity.ml-agents / com.unity.ml-agents.extensions (C#)
18+ - The ` ActionSpec ` constructor is now public. Previously, it was not possible to create an
19+ ActionSpec with both continuous and discrete actions from code. (#4896 )
1820- ` StatAggregationMethod.Sum ` can now be passed to ` StatsRecorder.Add() ` . This
19- will result in the values being summed (instead of averaged) when written to
20- TensorBoard. Thanks to @brccabral for the contribution! (#4816 )
21+ will result in the values being summed (instead of averaged) when written to
22+ TensorBoard. Thanks to @brccabral for the contribution! (#4816 )
2123- The upper limit for the time scale (by setting the ` --time-scale ` paramater in mlagents-learn) was
2224removed when training with a player. The Editor still requires it to be clamped to 100. (#4867 )
2325- Added the IHeuristicProvider interface to allow IActuators as well as Agent implement the Heuristic function to generate actions.
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public struct ActionSpec
4545 /// <summary>
4646 /// Creates a Continuous <see cref="ActionSpec"/> with the number of actions available.
4747 /// </summary>
48- /// <param name="numActions">The number of actions available.</param>
48+ /// <param name="numActions">The number of continuous actions available.</param>
4949 /// <returns>An Continuous ActionSpec initialized with the number of actions available.</returns>
5050 public static ActionSpec MakeContinuous ( int numActions )
5151 {
@@ -66,10 +66,17 @@ public static ActionSpec MakeDiscrete(params int[] branchSizes)
6666 return actuatorSpace ;
6767 }
6868
69- internal ActionSpec ( int numContinuousActions , int [ ] branchSizes = null )
69+ /// <summary>
70+ /// Create an ActionSpec initialized with the specified action sizes.
71+ /// </summary>
72+ /// <param name="numContinuousActions">The number of continuous actions available.</param>
73+ /// <param name="discreteBranchSizes">The array of branch sizes for the discrete actions. Each index
74+ /// contains the number of actions available for that branch.</param>
75+ /// <returns>An ActionSpec initialized with the specified action sizes.</returns>
76+ public ActionSpec ( int numContinuousActions = 0 , int [ ] discreteBranchSizes = null )
7077 {
7178 m_NumContinuousActions = numContinuousActions ;
72- BranchSizes = branchSizes ;
79+ BranchSizes = discreteBranchSizes ;
7380 }
7481
7582 /// <summary>
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ public IEnumerator RuntimeApiTestWithEnumeratorPasses()
7171 var behaviorParams = gameObject . AddComponent < BehaviorParameters > ( ) ;
7272 behaviorParams . BrainParameters . VectorObservationSize = 3 ;
7373 behaviorParams . BrainParameters . NumStackedVectorObservations = 2 ;
74- behaviorParams . BrainParameters . VectorActionDescriptions = new [ ] { "TestActionA" , "TestActionB" } ;
75- behaviorParams . BrainParameters . ActionSpec = ActionSpec . MakeDiscrete ( 2 , 2 ) ;
74+ behaviorParams . BrainParameters . VectorActionDescriptions = new [ ] { "Continuous1" , " TestActionA", "TestActionB" } ;
75+ behaviorParams . BrainParameters . ActionSpec = new ActionSpec ( 1 , new [ ] { 2 , 2 } ) ;
7676 behaviorParams . BehaviorName = "TestBehavior" ;
7777 behaviorParams . TeamId = 42 ;
7878 behaviorParams . UseChildSensors = true ;
You can’t perform that action at this time.
0 commit comments