private void ReadMediumCompatibilityData() { lineNum += 1; string count = Reader.ReadLine(); int lineCount = Convert.ToInt32(count); string line = null; while (!(line = Reader.ReadLine()).StartsWith("%")) { string[] fields = line.Split(' '); instance.AddBrandCompatibility(Convert.ToInt32(fields[0]), Convert.ToInt32(fields[1]), 1.0d); lineNum += 1; } }
private void IncreaseCompatibility() { foreach (var brand1 in Instance.Brands) { foreach (var brand2 in Instance.Brands) { if (Instance.GetBrandsIncompatibility(brand1.Key, brand2.Key) == double.PositiveInfinity) { Instance.AddBrandCompatibility(brand1.Key, brand2.Key, 1.0); } } } Instance.TypeToBreakIncompatibilityMatrix.Clear(); }
public void AssureBrandToBrandCompatibility() { foreach (var tvBreak in Instance.Breaks.Values) { int startingPos = 0; for (int i = startingPos; i < tvBreak.Advertisements.Count - 1; i++) { Instance.AddBrandCompatibility(tvBreak.Advertisements[i].OwnerID, tvBreak.Advertisements[i + 1].OwnerID, 0); for (int j = i + 2; j < tvBreak.Advertisements.Count; j++) { Instance.AddBrandCompatibility(tvBreak.Advertisements[i].OwnerID, tvBreak.Advertisements[j].OwnerID, 1.0); } } startingPos += 1; } }