public void ThrowsError() { var bp = new BrainParameters(); bp.vectorActionSpaceType = SpaceType.discrete; bp.vectorActionSize = new int[3] { 4, 5, 6 }; var masker = new ActionMasker(bp); Assert.Catch <UnityAgentsException>( () => masker.SetActionMask(0, new int[1] { 5 })); Assert.Catch <UnityAgentsException>( () => masker.SetActionMask(1, new int[1] { 5 })); masker.SetActionMask(2, new int[1] { 5 }); Assert.Catch <UnityAgentsException>( () => masker.SetActionMask(3, new int[1] { 1 })); masker.GetMask(); masker.ResetMask(); masker.SetActionMask(0, new int[4] { 0, 1, 2, 3 }); Assert.Catch <UnityAgentsException>( () => masker.GetMask()); }
public void MaskReset() { var bp = new BrainParameters { vectorActionSpaceType = SpaceType.Discrete, vectorActionSize = new[] { 4, 5, 6 } }; var masker = new ActionMasker(bp); masker.SetActionMask(1, new[] { 1, 2, 3 }); masker.ResetMask(); var mask = masker.GetMask(); for (var i = 0; i < 15; i++) { Assert.IsFalse(mask[i]); } }