public DataSpecification getDataFile() { StreamReader infile; try { infile = new StreamReader(datafilepath); } catch(Exception e) { Console.WriteLine("Get DataFile Exception: " + e.Message); return null; } //Throw out the line that says "Number of ..." infile.ReadLine(); uint hostcount = Convert.ToUInt32(infile.ReadLine()); //Throw out another line that says "Number of ..." infile.ReadLine(); uint routercount = Convert.ToUInt32(infile.ReadLine()); //Throw out 'Paths: " infile.ReadLine(); List<Path> networkpaths = new List<Path>(); while(infile.Peek() > -1) { networkpaths.Add(new Path(infile.ReadLine().Split(' ').Select(n=>Int32.Parse(n)).ToList(), (int)routercount, (int)hostcount)); } infile.Close(); DataSpecification dataspec = new DataSpecification(hostcount, routercount, networkpaths, datafilepath); return dataspec; }
public EvolutionaryAlgorithm() { data = null; log = null; solution = null; }