/// <summary> /// Updates autopilot rules according to the rules repository changes /// </summary> /// <param name="ruleTypeId"></param> /// <param name="newRules"></param> /// <param name="deletedRules"></param> private void UpdateAutopilotRulesRepository(int ruleTypeId, IReadOnlyCollection <int> newRules, IReadOnlyCollection <int> deletedRules) { var flexibilityLevels = _flexibilityLevelRepository.GetAll().ToList(); // delete autopilot rules if (deletedRules != null && deletedRules.Any()) { var autopilotRulesToDelete = _autopilotRuleRepository.GetAll() .Where(rt => rt.RuleTypeId == ruleTypeId && deletedRules.Contains(rt.RuleId)).ToList(); if (autopilotRulesToDelete.Any()) { _autopilotRuleRepository.Delete(autopilotRulesToDelete.Select(r => r.Id)); } } // add new autopilot rules if (newRules != null && newRules.Any()) { foreach (var ruleId in newRules) { foreach (var flexibilityLevel in flexibilityLevels) { var autopilotRule = AutopilotRule.Create(flexibilityLevel.Id, ruleId, ruleTypeId); _autopilotRuleRepository.Add(autopilotRule); } } } _autopilotRuleRepository.SaveChanges(); }
public void Apply() { foreach (string tenantConnectionString in _tenantConnectionStrings) { using (IDocumentStore documentStore = DocumentStoreFactory.CreateStore(tenantConnectionString)) using (IDocumentSession session = documentStore.OpenSession()) { var programmeRuleId = (int)ToleranceRuleId.Programme; var programmeRuleTypeId = (int)RuleCategory.Tolerances; var rules = session.GetAll <Rule>(); if (!rules.Any(r => r.RuleId == programmeRuleId)) { session.Store( new Rule { RuleTypeId = programmeRuleTypeId, RuleId = programmeRuleId, Description = "Programme", InternalType = "Campaign", Type = "tolerances" }); session.SaveChanges(); } var isAllowedAutopilot = session.GetAll <RuleType>() .Any(rt => rt.AllowedForAutopilot && rt.Id == programmeRuleTypeId); var hasProgrammeAutopilotRule = session.GetAll <AutopilotRule>() .Any(rt => rt.RuleId == programmeRuleId); if (isAllowedAutopilot && !hasProgrammeAutopilotRule) { var newAutopilotRules = new List <AutopilotRule>(); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, programmeRuleId, programmeRuleTypeId, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, programmeRuleId, programmeRuleTypeId, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, programmeRuleId, programmeRuleTypeId, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, programmeRuleId, programmeRuleTypeId, 20, 20, 40, 40)); foreach (var autopilotRule in newAutopilotRules) { session.Store(autopilotRule); } session.SaveChanges(); } } } }
private static IEnumerable <AutopilotRule> CreateValidAutopilotRules(AutopilotFlexibilityLevel flexibilityLevel = AutopilotFlexibilityLevel.Low) { return(new List <AutopilotRule> { AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.General, 5, -5, 10, -10), AutopilotRule.Create((int)flexibilityLevel, 2, (int)RuleCategory.General, 5, -5, 10, -10), AutopilotRule.Create((int)flexibilityLevel, 3, (int)RuleCategory.General, 0, 0, 0, 0), AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.Tolerances, 5, 5, 10, 10), AutopilotRule.Create((int)flexibilityLevel, 2, (int)RuleCategory.Tolerances, 5, 5, 10, 10), AutopilotRule.Create((int)flexibilityLevel, 3, (int)RuleCategory.Tolerances, 5, 5, 10, 10), AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.Rules, -5, 5, -10, 10), AutopilotRule.Create((int)flexibilityLevel, 2, (int)RuleCategory.Rules, 0, 0, 0, 0), AutopilotRule.Create((int)flexibilityLevel, 3, (int)RuleCategory.Rules, 0, 0, 0, 0), AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.SlottingLimits, 0, 0, 0, 0) }); }
public static IEnumerable <AutopilotRule> CreateValidAutopilotRules(AutopilotFlexibilityLevel flexibilityLevel = AutopilotFlexibilityLevel.Low) { return(new List <AutopilotRule> { AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.General, TightenABitPercentage, LoosenABitPercentage, TightenALotPercentage, LoosenALotPercentage), AutopilotRule.Create((int)flexibilityLevel, 2, (int)RuleCategory.General, TightenABitPercentage, LoosenABitPercentage, TightenALotPercentage, LoosenALotPercentage), AutopilotRule.Create((int)flexibilityLevel, 3, (int)RuleCategory.General, TightenABitPercentage, LoosenABitPercentage, TightenALotPercentage, LoosenALotPercentage), AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.Tolerances, TightenABitPercentage, ToleranceLoosenABitPercentage, TightenALotPercentage, ToleranceLoosenALotPercentage), AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.Rules, TightenABitPercentage, LoosenABitPercentage, TightenALotPercentage, LoosenALotPercentage), AutopilotRule.Create((int)flexibilityLevel, 1, (int)RuleCategory.SlottingLimits, TightenABitPercentage, LoosenABitPercentage, TightenALotPercentage, LoosenALotPercentage) }); }
public void Apply() { foreach (var tenantConnectionString in _tenantConnectionStrings) { using (var documentStore = DocumentStoreFactory.CreateStore(tenantConnectionString, null)) using (var session = documentStore.OpenSession()) { // Default autopilot settings session.Store(new AutopilotSettings { Id = 1, DefaultFlexibilityLevelId = 1, ScenariosToGenerate = 8 }); var newAutopilotRules = new List <AutopilotRule>(); #region General Rules // Minimum Efficiency newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 1, (int)RuleCategory.General, 5, -5, 10, -10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 1, (int)RuleCategory.General, 10, -10, 20, -20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 1, (int)RuleCategory.General, 15, -15, 30, -30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 1, (int)RuleCategory.General, 20, -20, 40, -40)); // Maximum Rank newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 2, (int)RuleCategory.General, -5, 5, -10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 2, (int)RuleCategory.General, -10, 10, -20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 2, (int)RuleCategory.General, -15, 15, -30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 2, (int)RuleCategory.General, -20, 20, -40, 40)); // Demograph Banding Tolerance newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 3, (int)RuleCategory.General, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 3, (int)RuleCategory.General, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 3, (int)RuleCategory.General, -5, 5, -10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 3, (int)RuleCategory.General, -10, 10, -15, 15)); #endregion #region Tolerances Rules // Campaign newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 1, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 1, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 1, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 1, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Booking Position newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 8, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 8, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 8, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 8, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Centre/End newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 9, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 9, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 9, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 9, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Sales Area newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 2, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 2, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 2, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 2, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Spot Length newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 3, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 3, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 3, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 3, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Daypart newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 4, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 4, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 4, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 4, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Strike Weight newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 5, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 5, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 5, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 5, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Strike Wgt/Daypart newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 6, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 6, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 6, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 6, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Peak Daypart newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 7, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 7, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 7, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 7, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Daypart/Length newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 12, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 12, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 12, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 12, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Strike Weight/Length newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 13, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 13, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 13, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 13, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Strike Weight/Daypart/Length newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 14, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 14, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 14, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 14, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Campaign (Budget) newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 10, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 10, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 10, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 10, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); // Sales Area (Budget) newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 11, (int)RuleCategory.Tolerances, 5, 5, 10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 11, (int)RuleCategory.Tolerances, 10, 10, 20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 11, (int)RuleCategory.Tolerances, 15, 15, 30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 11, (int)RuleCategory.Tolerances, 20, 20, 40, 40)); #endregion #region Rules // Max Spots Per Day newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 1, (int)RuleCategory.Rules, -5, 5, -10, 10)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 1, (int)RuleCategory.Rules, -10, 10, -20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 1, (int)RuleCategory.Rules, -15, 15, -30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 1, (int)RuleCategory.Rules, -20, 20, -40, 40)); // Max Spots Per Hour newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 2, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 2, (int)RuleCategory.Rules, 0, 0, -20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 2, (int)RuleCategory.Rules, -20, 20, -40, 40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 2, (int)RuleCategory.Rules, -40, 40, -80, 80)); // Max Spots Per 2 Hours newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 3, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 3, (int)RuleCategory.Rules, 0, 0, -20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 3, (int)RuleCategory.Rules, -20, 20, -40, 40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 3, (int)RuleCategory.Rules, -40, 40, -80, 80)); // Min Breaks Between Spots newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 4, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 4, (int)RuleCategory.Rules, 0, 0, 20, -20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 4, (int)RuleCategory.Rules, 20, -20, 40, -40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 4, (int)RuleCategory.Rules, 40, -40, 80, -80)); // Min Hours Between Spots newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 5, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 5, (int)RuleCategory.Rules, 0, 0, 20, -20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 5, (int)RuleCategory.Rules, 20, -20, 40, -40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 5, (int)RuleCategory.Rules, 40, -40, 80, -80)); // Max Spots Per Programme/Day newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 6, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 6, (int)RuleCategory.Rules, 0, 0, 20, -20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 6, (int)RuleCategory.Rules, 20, -20, 40, -40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 6, (int)RuleCategory.Rules, 40, -40, 80, -80)); // Max Spots Per Programme/Week newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 7, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 7, (int)RuleCategory.Rules, 0, 0, -15, 15)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 7, (int)RuleCategory.Rules, -15, 15, -30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 7, (int)RuleCategory.Rules, -30, 30, -60, 60)); // Max Spots per Prog/100 rtgs newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 17, (int)RuleCategory.Rules, -10, 10, -20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 17, (int)RuleCategory.Rules, -20, 20, -30, 30)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 17, (int)RuleCategory.Rules, -30, 30, -50, 50)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 17, (int)RuleCategory.Rules, -50, 50, -80, 80)); // Min Weeks Between Programmes newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 20, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 20, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 20, (int)RuleCategory.Rules, 0, 0, 50, -50)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 20, (int)RuleCategory.Rules, 50, -50, 100, -100)); // Minimum Break Availability newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 23, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 23, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 23, (int)RuleCategory.Rules, 50, 0, 100, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 23, (int)RuleCategory.Rules, 50, 0, 100, 0)); // Max Spots Per Prog/Time newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 24, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 24, (int)RuleCategory.Rules, 0, 0, -20, 20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 24, (int)RuleCategory.Rules, -20, 20, -40, 40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 24, (int)RuleCategory.Rules, -40, 40, -80, 80)); // Min Days Between Prog/Time newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 25, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 25, (int)RuleCategory.Rules, 0, 0, 20, -20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 25, (int)RuleCategory.Rules, 20, -20, 40, -40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 25, (int)RuleCategory.Rules, 40, -40, 80, -80)); // Min Weeks Between Prog/Time newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 26, (int)RuleCategory.Rules, 0, 0, 0, 0)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 26, (int)RuleCategory.Rules, 0, 0, 20, -20)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 26, (int)RuleCategory.Rules, 20, -20, 40, -40)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 26, (int)RuleCategory.Rules, 40, -40, 80, -80)); #endregion // Slotting Limits default rule newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Low, 1, (int)RuleCategory.SlottingLimits)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Medium, 1, (int)RuleCategory.SlottingLimits)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.High, 1, (int)RuleCategory.SlottingLimits)); newAutopilotRules.Add(AutopilotRule.Create((int)AutopilotFlexibilityLevel.Extreme, 1, (int)RuleCategory.SlottingLimits)); foreach (var autopilotRule in newAutopilotRules) { session.Store(autopilotRule); } session.SaveChanges(); } } }