use of org.iobserve.model.provider.RepositoryLookupModelProvider in project iobserve-analysis by research-iobserve.
the class UserBehaviorTransformationTest method testBranchWithinLoop.
/**
* TODO this test is dysfunctional as models are missing Test branch within a loop.
*
* @throws IOException
* when reading and writing files.
*/
// @Test
public void testBranchWithinLoop() throws IOException {
// TODO load that model
final ICorrespondence correspondenceModel = null;
// TODO fix location
final GraphLoader graphLoader = new GraphLoader(null);
final Graph graph = graphLoader.createRepositoryModelGraph();
final ModelProvider<Repository> repositoryModelProvider = new ModelProvider<>(graph);
final RepositoryLookupModelProvider repositoryLookupModel = new RepositoryLookupModelProvider(repositoryModelProvider.readRootComponent(Repository.class));
final int numberOfIterations = 500;
final int stepSize = 1;
final List<AccuracyResults> results = new ArrayList<>();
for (int i = 1; i <= numberOfIterations; i += stepSize) {
final int numberOfUserGroups = UserBehaviorTransformationTest.NUMBER_OF_USER_GROUPS;
final int varianceOfUserGroups = 0;
final int thinkTime = UserBehaviorTransformationTest.THINK_TIME;
final boolean isClosedWorkload = UserBehaviorTransformationTest.CLOSED_WORKLOAD;
final ReferenceElements referenceElements = SimpleSequenceReference.getModel(UserBehaviorTransformationTest.REFERENCE_USAGE_MODEL, repositoryLookupModel, correspondenceModel, thinkTime, isClosedWorkload);
final UserBehaviorTransformation behaviorModeling = new UserBehaviorTransformation(referenceElements.getEntryCallSequenceModel(), numberOfUserGroups, varianceOfUserGroups, isClosedWorkload, thinkTime, repositoryLookupModel, correspondenceModel);
behaviorModeling.modelUserBehavior();
final AccuracyResults accuracyResults = UserBehaviorEvaluation.matchUsageModels(behaviorModeling.getPcmUsageModel(), referenceElements.getUsageModel());
results.add(accuracyResults);
final double relativeMeasurementError = WorkloadEvaluation.calculateRME(behaviorModeling.getPcmUsageModel(), referenceElements);
if (UserBehaviorTransformationTest.LOGGER.isDebugEnabled()) {
UserBehaviorTransformationTest.LOGGER.debug("RME " + relativeMeasurementError);
}
TestHelper.saveModel(behaviorModeling.getPcmUsageModel(), UserBehaviorTransformationTest.OUTPUT_USAGE_MODEL);
if (UserBehaviorTransformationTest.LOGGER.isDebugEnabled()) {
UserBehaviorTransformationTest.LOGGER.debug("Iteration :" + i + "/" + numberOfIterations);
}
}
TestHelper.writeAccuracyResults(results);
}
Aggregations