blob: 497ac32b111016a2206a96ad5e4dec6140cbcb94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
using Graph;
using Graph.IO;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSP;
namespace Plotter
{
using Map = Graph<Vertex<Edge<double>, double>, Edge<double>, double>;
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Run();
Application.Run(new Plot());
}
static void Run()
{
foreach (string file in Directory.GetFiles("graphs/"))
{
Map graph = GraphFile.Read(new FileReader(file));
// Graph mst = graph.MST(0);
// GraphFile.Print(mst, new ConsoleWriter());
// Console.WriteLine(
// graph.Vertices.Sum(vertex =>
// vertex.Edges.FirstOrDefault(edge => edge.V == vertex.Parent).Weight));
Tour bruteForce = TSP.TSP.BruteForce(graph, 0);
Debug.WriteLine(bruteForce);
// mst.Vertices.ForEach(vertex =>
// {
// Console.Write($"{vertex.Id}");
// vertex.Edges.ForEach(edge => Console.Write($" {edge.V} {edge.Weight.ToString("F1")}"));
// Console.WriteLine();
// });
// Console.WriteLine(mst.Vertices
// .Sum(vertex => vertex.Edges
// .FirstOrDefault(edge => edge.V == vertex.Parent).Weight));
}
}
}
}
|