public Qos copy() { Qos _result = new Qos(); _result.COST = COST; _result.TIME = TIME; _result.SKILL = SKILL; _result.UTILITY = UTILITY; return _result; }
// Pairwise Acc public Qos pairwise_acc(Qos source, Qos target, JSONEFFECT _src, JSONEFFECT _trg) { Qos _result = new Qos(); // Process the goals to check which objective functions we're using HashSet<String> goals = new HashSet<String>(); for (String s : _src.GOAL) { goals.add(s); } for (String s : _trg.GOAL) { goals.add(s); } // Handle Cost Accumulation PREF_FUNC costPref = null; if (goals.contains("MINPRICE")) { costPref = new MIN_COST(); } else { costPref = new MAX_COST(); } // Handle Time Preferences PREF_FUNC timePref = null; if (goals.contains("MINTIME")) { timePref = new MIN_TIME(); } else { timePref = new MAX_TIME(); } // Handle Skill Accumulation PREF_FUNC skillPref = null; if (goals.contains("MINSKILL")) { skillPref = new MIN_SKILL(); } else { skillPref = new MAX_SKILL(); } // Handle Utility Accumulation PREF_FUNC utilityPref = null; utilityPref = new MAX_COST(); _result.COST = costPref.combine(source.COST, target.COST); _result.TIME = timePref.combine(source.TIME, target.TIME); _result.SKILL = skillPref.combine(source.SKILL, target.SKILL); _result.UTILITY = utilityPref.compare(source.UTILITY, target.UTILITY) ? source.UTILITY : target.UTILITY; return _result; }