public static void WriteSolution(string toPath, QapProblemInstance instance, QapProblemSolution solution) { using (var writer = new StreamWriter(toPath)) { writer.WriteLine($"{instance.Size} {solution.Cost}"); string permutation = String.Join(" ", solution.Solution.Select(s => (s + 1).ToString()).ToArray()); writer.WriteLine(permutation); } }
public void WriteResultLine(ref QapProblemSolution solution) { if (Writer == null) { return; } string permutation = string.Join("-", solution.Solution .Select(s => (s + 1).ToString()) .ToArray() ); string line = $"{Counter++},{solution.InitialCost},{solution.Cost},{solution.Steps},{solution.Visited},{solution.TimeMs},{permutation}"; Writer.WriteLine(line); }