use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class ClusteringEvaluation method createCallSequencesForUserGroupStoreManager.
/**
* Behavior Model of user group Store Manager. It creates for each user session a random user
* behavior according to the BehaviorModel it describes
*
* @param userSessions
*/
private void createCallSequencesForUserGroupStoreManager(final List<UserSession> userSessions) {
EntryCallEvent entryCallEvent;
for (final UserSession userSession : userSessions) {
int entryTime = this.getRandomInteger(30, 1);
int exitTime = entryTime + 1;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "login", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
double callDecisioner = this.getRandomDouble(1, 0);
if (callDecisioner <= 0.5) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "changePrice", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
} else {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "orderProduct", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
while (!entryCallEvent.getOperationSignature().equals("commit")) {
callDecisioner = this.getRandomDouble(1, 0);
if (entryCallEvent.getOperationSignature().equals("changePrice") && callDecisioner <= 0.3) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "changePrice", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("changePrice") && callDecisioner > 0.3 && callDecisioner <= 0.6) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "orderProduct", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("changePrice") && callDecisioner > 0.6) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "commit", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("orderProduct") && callDecisioner <= 0.3) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "changePrice", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("orderProduct") && callDecisioner > 0.3 && callDecisioner <= 0.6) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "orderProduct", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("orderProduct") && callDecisioner > 0.6) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "commit", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
}
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "logout", "class", "2", "hostname");
userSession.add(entryCallEvent, true);
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class ClusteringEvaluation method createCallSequenceModelWithVaryingUserGroups.
/**
* Creates for each user group user sessions with random behavior according to the
* BehaviorModels and subsumes the user sessions within an EntryCallSequenceModel.
*
* @throws IOException
*/
private void createCallSequenceModelWithVaryingUserGroups() throws IOException {
final List<UserSession> userSessionsOfGroupCustomer = this.getUserSessions(ClusteringEvaluation.NUMBER_OF_USER_SESSIONS_OF_USER_GROUP_CUSTOMER, ClusteringEvaluation.CUSTOMER_TAG);
final List<UserSession> userSessionsOfGroupStockManager = this.getUserSessions(ClusteringEvaluation.NUMBER_OF_USER_SESSIONS_OF_USER_GROUP_STOCK_MANAGER, ClusteringEvaluation.STOCK_MANAGER_TAG);
final List<UserSession> userSessionsOfGroupStoreManager = this.getUserSessions(ClusteringEvaluation.NUMBER_OF_USER_SESSIONS_OF_USER_GROUP_STORE_MANAGER, ClusteringEvaluation.STORE_MANAGER_TAG);
this.createCallSequencesForUserGroupCustomer(userSessionsOfGroupCustomer);
this.createCallSequencesForUserGroupStockManager(userSessionsOfGroupStockManager);
this.createCallSequencesForUserGroupStoreManager(userSessionsOfGroupStoreManager);
final List<UserSession> userSessions = new ArrayList<>();
userSessions.addAll(userSessionsOfGroupStockManager);
userSessions.addAll(userSessionsOfGroupStoreManager);
userSessions.addAll(userSessionsOfGroupCustomer);
final long seed = 5;
Collections.shuffle(userSessions, new Random(seed));
this.entryCallSequenceModel = new UserSessionCollectionModel(userSessions);
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class ClusteringEvaluation method getUserSessions.
/**
* Creates for the passed user group the passed number of user sessions.
*
* @param numberOfUserSessionsToCreate
* @param userGroupId
* @return user sessions tagged with their user group belonging
*/
private List<UserSession> getUserSessions(final int numberOfUserSessionsToCreate, final String userGroupId) {
final List<UserSession> userSessions = new ArrayList<>();
for (int i = 0; i < numberOfUserSessionsToCreate; i++) {
final UserSession userSession = new UserSession("host", userGroupId);
userSessions.add(userSession);
}
return userSessions;
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class ClusteringEvaluation method createCallSequencesForUserGroupCustomer.
/**
* Behavior Model of user group Customer. It creates for each user session a random user
* behavior according to the BehaviorModel it describes
*
* @param userSessions
*/
private void createCallSequencesForUserGroupCustomer(final List<UserSession> userSessions) {
EntryCallEvent entryCallEvent;
for (final UserSession userSession : userSessions) {
int entryTime = this.getRandomInteger(30, 1);
int exitTime = entryTime + 1;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "login", "class", "1", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "buyProduct", "class", "1", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
while (!entryCallEvent.getOperationSignature().equals("logout")) {
if (this.getRandomDouble(1, 0) <= 0.7) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "buyProduct", "class", "1", "hostname");
userSession.add(entryCallEvent, true);
} else {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "logout", "class", "1", "hostname");
userSession.add(entryCallEvent, true);
}
entryTime += 2;
exitTime += 2;
}
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class ClusteringEvaluation method createCallSequencesForUserGroupStockManager.
/**
* Behavior Model of user group Stock Manager. It creates for each user session a random user
* behavior according to the BehaviorModel it describes
*
* @param userSessions
*/
private void createCallSequencesForUserGroupStockManager(final List<UserSession> userSessions) {
EntryCallEvent entryCallEvent;
for (final UserSession userSession : userSessions) {
int entryTime = this.getRandomInteger(30, 1);
int exitTime = entryTime + 1;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "login", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "checkDelivery", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
while (!entryCallEvent.getOperationSignature().equals("logout")) {
final double callDecisioner = this.getRandomDouble(1, 0);
if (entryCallEvent.getOperationSignature().equals("checkDelivery") && callDecisioner <= 0.3) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "checkDelivery", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("checkDelivery") && callDecisioner > 0.3) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "updateStock", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("updateStock") && callDecisioner <= 0.4) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "checkDelivery", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
if (entryCallEvent.getOperationSignature().equals("updateStock") && callDecisioner > 0.4) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "confirm", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, "logout", "class", "3", "hostname");
userSession.add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
continue;
}
}
}
}
Aggregations