private static Tuple <DethloffType, int, int> ParseDethloffName(string path) { Regex nameexp = new Regex(@"(?<type>\w+)(?<x>\d)(?<y>\d)"); Match m = nameexp.Match(Path.GetFileNameWithoutExtension(path)); DethloffType type = (m.Groups["type"].Value == "cc05") ? DethloffType.CON : DethloffType.SCA; return(new Tuple <DethloffType, int, int>(type, int.Parse(m.Groups["x"].Value), int.Parse(m.Groups["y"].Value))); }
public static VRPSimultaneousPickupDelivery LoadDenthoffProblem(string path) { Tuple <DethloffType, int, int> dataName = ParseDethloffName(path); DethloffType type = dataName.Item1; int x = dataName.Item2; int y = dataName.Item3; StreamReader reader = new StreamReader(path); Fleet f = ParseFleetInfo(reader, x + 1); int clientAmount = int.Parse(reader.ReadLine().Trim()); TravelData m = ParseTravelMatrix(reader, clientAmount); ClientSet <PickupDeliveryClient> c = ParseClientInfo(reader, clientAmount); VRPSimultaneousPickupDelivery instance = new VRPSimultaneousPickupDelivery(c, f, m); instance.ProblemName = type.ToString() + x.ToString() + "-" + y.ToString(); return(instance); }