summaryrefslogtreecommitdiffstats
path: root/src/CS340.TSP/Tour.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/CS340.TSP/Tour.cs')
-rw-r--r--src/CS340.TSP/Tour.cs42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/CS340.TSP/Tour.cs b/src/CS340.TSP/Tour.cs
deleted file mode 100644
index 5f530be..0000000
--- a/src/CS340.TSP/Tour.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Graph;
-
-namespace TSP
-{
- using Vertex = Vertex<Edge<double>, double>;
- public class Tour
- {
- public List<City> Cities { get; set; } = new List<City>();
- public double Weight
- {
- get
- {
- if (Cities.Count == 0)
- return double.MaxValue;
-
- return Cities.Where(city => city.Parent != -1)
- .Sum(city => city.Key);
- }
- }
-
- // indexer: get vertex where vertex.Id == index
- public City this[int index] { get => Cities.Find(city => city.Id == index); }
-
- public Tour() =>
- Cities = new List<City>();
-
- public Tour(Tour tour) : this(tour.Cities) { }
-
- public Tour(List<City> cities) =>
- Cities.AddRange(cities.Select(city => new City(city)));
-
- public Tour(List<Vertex> cities, List<Coordinate> coordinates) =>
- Cities.AddRange(cities.Select(city => new City(city, coordinates[city.Id])));
-
- public override string ToString() =>
- $"{Weight},{String.Join(",", Cities.Select(city => city.Id))}";
-
- }
-}