Commit 32919cea authored by Jonathan Shahen's avatar Jonathan Shahen

Reduction comments added

parent 3f060e2b
Pipeline #12995 skipped
......@@ -41,10 +41,12 @@ public class ConvertToASAPTimeNSA extends ConvertTo {
roleHelper.setupSortedRoles();
// Reduce TimeIntervals to Timeslots
timeIntervalHelper.allowZeroTimeslot = false;// time-slots start from t1 NOT t0!
// Reduction (2)
timeIntervalHelper.reduceToTimeslots();
/* Timing */timing.stopTimer(tPrefix + "_" + "sortRolesReduceTimeslots");
// Convert Query to Reduced ASAPTime NSA Query and add any extra rules as needed
// Reduction (1)
ASAPTimeNSA_Query query = toASAPTimeNSA_Query(workableQuery, rules, roleHelper, timeIntervalHelper);
// Convert Rules into Reduced ASAPTime NSA Rules
......
......@@ -40,6 +40,7 @@ public class ConvertToASAPTimeSA extends ConvertTo {
// removeEnableDisableRules and alwaysOnRules are Deep Copies
/* Timing */timing.startTimer(tPrefix + "_removeEnableDisableRules");
// Reduction (3)
switch (canEnableVersion) {
case 1:
workableRules = roleHelper.removeEnableDisableRules(m.getAllRules());
......@@ -57,10 +58,12 @@ public class ConvertToASAPTimeSA extends ConvertTo {
}
/* Timing */timing.startTimer(tPrefix + "_" + "alwaysOnRules");
// Reduction (4)
workableRules = roleHelper.alwaysOnRules(workableRules, workableQuery, timeIntervalHelper);
/* Timing */timing.stopTimer(tPrefix + "_" + "alwaysOnRules");
/* Timing */timing.startTimer(tPrefix + "_" + "reduceToTimeslots");
// Reduction (2)
timeIntervalHelper.allowZeroTimeslot = false;// time-slots start from t1 NOT t0!
timeIntervalHelper.reduceToTimeslots();// Reduce TimeIntervals to Timeslots
......@@ -75,6 +78,7 @@ public class ConvertToASAPTimeSA extends ConvertTo {
}
// Convert Query to Reduced ASAPTime SA Query and add any extra rules as needed
// Reduction (1)
ASAPTimeSA_Query query = toASAPTimeSA_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
// Convert Rules into Reduced ASAPTime SA Rules
......
......@@ -44,6 +44,7 @@ public class ConvertToMohawk extends ConvertTo {
try {
/* Timing */timing.startTimer(tPrefix + "_removeEnableDisableRules");
// Reduction (3)
switch (canEnableVersion) {
case 1:
workableRules = roleHelper.removeEnableDisableRules(m.getAllRules());
......@@ -53,23 +54,23 @@ public class ConvertToMohawk extends ConvertTo {
workableRules = roleHelper.removeEnableDisableRulesv2(m.getAllRules());
break;
}
// (3)
/* Timing */timing.stopTimer(tPrefix + "_removeEnableDisableRules");
// Convert Query to Reduced ASAPTime SA Query and add any extra rules as needed
// Mohawk_Query query = toMohawk_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
/* Timing */timing.startTimer(tPrefix + "_alwaysOnRules");
// Reduction (4)
workableRules = roleHelper.alwaysOnRules(workableRules, workableQuery, timeIntervalHelper);
// (4)
/* Timing */timing.stopTimer(tPrefix + "_alwaysOnRules");
// Convert Query to Reduced ASAPTime SA Query and add any extra rules as needed
// Reduction (1)
Mohawk_Query query = toMohawk_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
/* Timing */timing.startTimer(tPrefix + "_removeUninvokablePrecondtions");
// Optimization
workableRules = roleHelper.removeUninvokablePrecondtions(workableRules, false);
// (6)
/* Timing */timing.stopTimer(tPrefix + "_removeUninvokablePrecondtions");
if (logger.isLoggable(Level.FINE)) {
......@@ -78,8 +79,8 @@ public class ConvertToMohawk extends ConvertTo {
}
/* Timing */timing.startTimer(tPrefix + "_removePrecondtionsCanRevoke");
// Reduction (6)
workableRules = roleHelper.removePrecondtionsCanRevoke(workableRules, false);
// (6)
/* Timing */timing.stopTimer(tPrefix + "_removePrecondtionsCanRevoke");
if (logger.isLoggable(Level.FINE)) {
......@@ -88,6 +89,7 @@ public class ConvertToMohawk extends ConvertTo {
}
/* Timing */timing.startTimer(tPrefix + "_removeTemporality");
// Reduction (5)
roleHelperTemporality = new RoleHelper(roleHelper);
ArrayList<Object> reducedRules = roleHelperTemporality.removeTemporality(workableRules, timeIntervalHelper);
/* Timing */timing.stopTimer(tPrefix + "_removeTemporality");
......@@ -120,6 +122,7 @@ public class ConvertToMohawk extends ConvertTo {
}
/* Timing */timing.stopTimer(tPrefix + "_convertRules");
// Reduction (1)
boolean queryFound = query.finalize(roleHelperTemporality, shortRolenames);
if (queryFound == false) { throw new Exception("The query could not find the Goal Role!"); }
// Stats and logging
......
......@@ -42,6 +42,7 @@ public class ConvertToTRole extends ConvertTo {
/* Timing */timing.stopTimer(tPrefix + "_" + "deepcopy");
/* Timing */timing.startTimer(tPrefix + "_removeEnableDisableRules");
// Reduction (3)
switch (canEnableVersion) {
case 1:
workableRules = roleHelper.removeEnableDisableRules(m.getAllRules());
......@@ -54,6 +55,7 @@ public class ConvertToTRole extends ConvertTo {
/* Timing */timing.stopTimer(tPrefix + "_removeEnableDisableRules");
/* Timing */timing.startTimer(tPrefix + "_" + "alwaysOnRules");
// Reduction (4)
workableRules = roleHelper.alwaysOnRules(workableRules, workableQuery, timeIntervalHelper);
/* Timing */timing.stopTimer(tPrefix + "_" + "alwaysOnRules");
......@@ -65,6 +67,7 @@ public class ConvertToTRole extends ConvertTo {
TRole_Query query = toTRole_Query(workableQuery, workableRules, roleHelper, timeIntervalHelper);
// Finalize the Query
// Reduction (1)
query.finalize(roleHelper);
// Stats and logging
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment