public static IEnumerable <ICombination <T> > CompleteCombination <T>(ICombination <T> initialCombination, IEnumerable <T> newItems, IItemUtils <T> itemMethods, Length totalLength) { var sortedItems = newItems.SelectMany(item => item.ToSequence(itemMethods.getItemMaxCount(item))).ToSortedList(); var optimalValues = new Dictionary <(int, Length), double>(); sortedItems.ToList().ForEach(item => ComputeOptimalValues(item, itemMethods, optimalValues, totalLength)); return(GetCombinationFromTable(initialCombination, optimalValues, sortedItems, itemMethods.getItemLength).ToSequence()); }
private static void ComputeOptimalValues <T>(KeyValuePair <int, T> item, IItemUtils <T> itemMethods, Dictionary <(int, Length), double> optimalValues, Length totalLength)