This commit is contained in:
Luong Hoang 2015-07-06 17:11:31 -04:00
Родитель d184df4f44
Коммит 9699ea66f9
2 изменённых файлов: 50 добавлений и 1 удалений

Просмотреть файл

@ -146,6 +146,12 @@ namespace BlackBox
public IScorerConfiguration ScorerConfiguration { get; set; }
}
public class BootstrapTestConfiguration : BaseExploreTestConfiguration
{
public override TestType Type { get { return TestType.Bootstrap; } }
public IPolicyConfiguration[] PolicyConfigurations { get; set; }
}
public enum TestType
{
Prg = 0,
@ -153,7 +159,8 @@ namespace BlackBox
EpsilonGreedy,
TauFirst,
Softmax,
Generic
Generic,
Bootstrap
}
public enum PolicyType

Просмотреть файл

@ -320,6 +320,48 @@ namespace BlackBox
}
}
[TestMethod]
public void TestBootstrap()
{
var bootstrapTests = new BootstrapTestConfiguration[]
{
new BootstrapTestConfiguration
{
AppId = TestContext.TestName + "NoPolicyAgreeListFixedActionContext",
ContextType = ContextType.FixedAction, // test fixed-action context
NumberOfActions = 20,
ExperimentalUnitIdList = Enumerable.Range(1, 100).Select(i => i.ToString()).ToList(),
PolicyConfigurations = Enumerable.Range(1, 10).Select(i =>
new FixedPolicyConfiguration { Action = (uint)i }).ToArray()
},
new BootstrapTestConfiguration
{
AppId = TestContext.TestName + "NoPolicyAgreeListVariableActionContext",
ContextType = ContextType.VariableAction, // test variable-action context
NumberOfActions = 20,
ExperimentalUnitIdList = Enumerable.Range(1, 100).Select(i => i.ToString()).ToList(),
PolicyConfigurations = Enumerable.Range(1, 10).Select(i =>
new FixedPolicyConfiguration { Action = (uint)i }).ToArray()
},
new BootstrapTestConfiguration
{
AppId = TestContext.TestName + "SomePolicyAgreeListVariableActionContext",
ContextType = ContextType.VariableAction, // test variable-action context
NumberOfActions = 20,
ExperimentalUnitIdList = Enumerable.Range(1, 100).Select(i => i.ToString()).ToList(),
PolicyConfigurations = Enumerable.Range(1, 10).Select(i =>
new FixedPolicyConfiguration { Action = (uint) (i % 7) + 1 }).ToArray()
}
};
Run(outputFilePatternExpected, outputFilePatternActual, outputJsonConfigFile, bootstrapTests);
for (uint i = 0; i < bootstrapTests.Length; i++)
{
CompareExplorationData(FormatPath(outputFilePatternExpected, i), FormatPath(outputFilePatternActual, i));
}
}
[TestInitialize]
public void Initialize()
{