public static Solution Solve(Problem problem) { using (_differencesStore = new DifferencesStore()) { File.WriteAllText("dynamicfwdsolver.log", "progress...\r\n"); var objectiveValue = Calc_objective_values(problem); var selection = Trace_item_selection(problem); var sum = 0; for (var i = 0; i < selection.Length; i++) { if (selection[i]) { sum += problem.Items[i].Value; } } File.AppendAllText("dynamicfwdsolver.log", string.Format("Trace result: {0}, found: {1}\r\n", objectiveValue, sum)); return(new Solution { ObjectiveValue = objectiveValue, ItemSelections = selection, IsExact = sum == objectiveValue }); } }
public static Solution Solve(Problem problem) { using (_differencesStore = new DifferencesStore()) { File.WriteAllText("dynamicfwdsolver.log", "progress...\r\n"); var objectiveValue = Calc_objective_values(problem); var selection = Trace_item_selection(problem); var sum = 0; for (var i = 0; i < selection.Length; i++) if (selection[i]) sum += problem.Items[i].Value; File.AppendAllText("dynamicfwdsolver.log", string.Format("Trace result: {0}, found: {1}\r\n", objectiveValue, sum)); return new Solution { ObjectiveValue = objectiveValue, ItemSelections = selection, IsExact = sum == objectiveValue }; } }