public void Merge(ConfigurationAction action) { if (this.Id.Equals(action.Id)) { this.GainedUtility += action.GainedUtility; } action.OriginatingSLAs.ToList().ForEach(s => this.OriginatingSLAs.Add(s)); }
public override bool Equals(System.Object obj) { if (obj == null) { return(false); } ConfigurationAction p = (ConfigurationAction)obj; if (p == null) { return(false); } return(this.Id == p.Id); }
public static void CheckAction(ConfigurationAction action, ServiceLevelAgreement SLA, ClientUsageData usage, ReplicaConfiguration currentConfig) { ReplicaConfiguration newConfig = action.IfApply(currentConfig); foreach (SubSLA s in SLA) { float currentProbability = GetApplicableServers(s, currentConfig, usage).Max(server => server.ProbabilityOfFindingValueLessThanGiven(s.Latency)); //probability of new state should be computed in pessimistic mode. I.e., if there is no entry in the distribution of session state, instead of returning 1, we return 0. float newProbability = GetApplicableServers(s, newConfig, usage).Max(server => server.ProbabilityOfFindingValueLessThanGiven(s.Latency, false)); /* * // Not sure why the utility is multiplied by hits or misses * if (newProbability > currentProbability) * { * action.AddUtility((newProbability - currentProbability) * s.NumberOfMisses * s.Utility); * } * else * { * action.AddUtility((newProbability - currentProbability) * s.NumberOfHits * s.Utility); * } * */ action.AddUtility((newProbability - currentProbability) * s.Utility); } }