private string BuildFileName(Occupation occ, TTSEmploymentStatus empStat, FileLocation fileLocation) { var dirPath = fileLocation.GetFilePath(); var info = new DirectoryInfo(dirPath); if(!info.Exists) { info.Create(); } StringBuilder buildFileName = new StringBuilder(); switch(occ) { case Occupation.Professional: buildFileName.Append("P"); break; case Occupation.Office: buildFileName.Append("G"); break; case Occupation.Retail: buildFileName.Append("S"); break; case Occupation.Manufacturing: buildFileName.Append("M"); break; } switch(empStat) { case TTSEmploymentStatus.FullTime: buildFileName.Append("F.csv"); break; case TTSEmploymentStatus.PartTime: buildFileName.Append("P.csv"); break; } return Path.Combine(dirPath, buildFileName.ToString()); }
private void SaveBoardings(FileLocation location, Dictionary<string, float> periodData) { using (StreamWriter writer = new StreamWriter(location)) { writer.WriteLine("Line,Boardings"); foreach(var set in periodData) { writer.Write(set.Key); writer.Write(','); writer.WriteLine(set.Value); } } }
public static void SaveMatrixThirdNormalized(SparseTwinIndex<float> matrix, FileLocation saveLocation) { using (StreamWriter writer = new StreamWriter(saveLocation)) { writer.WriteLine("Origin,Destination,Data"); foreach (var o in matrix.ValidIndexes()) { foreach (var d in matrix.ValidIndexes(o)) { writer.Write(o); writer.Write(','); writer.Write(d); writer.Write(','); writer.WriteLine(matrix[o, d]); } } } }
private void SaveData(FileLocation file, float[] data) { using (StreamWriter writer= new StreamWriter(file)) { writer.WriteLine("Bin,Data"); for(int i = 0; i < data.Length; i++) { writer.Write(i); writer.Write(','); writer.WriteLine(data[i]); } } }
private void SaveIfExists(float[][] observedWork, FileLocation observedWorkOD) { if (observedWork != null) { TMG.Functions.SaveData.SaveMatrix(RealRoot.ZoneSystem.ZoneArray.GetFlatData() , observedWork, observedWorkOD); } }
private void CreateIfObserved(out float[][] observedDataSet, FileLocation observedDatasetOutputLocation) { if (observedDatasetOutputLocation == null) { observedDataSet = null; } else { var zones = RealRoot.ZoneSystem.ZoneArray.GetFlatData().Length; observedDataSet = new float[zones][]; for (int i = 0; i < observedDataSet.Length; i++) { observedDataSet[i] = new float[zones]; } } }
private static string GetFileLocationOrNone(FileLocation location) { return location == null ? "None" : "\"" + location.GetFilePath() + "\""; }