public void SaveResult(AllocationResult res, int waste) { using (var filestream = new System.IO.FileStream(_saveFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite)) { using (var file = new System.IO.StreamWriter(filestream)) { file.WriteLine("eksperci nie przypisani: " + waste); file.Write(res); } } }
public static AllocationResult GraphToAllocationResult(this Graph g, int projectCount, int skillCount, int expertCount) { var res = new AllocationResult(); for (int i = 1; i <= projectCount; i++) //lecimy po wszystkich projektach (wierzcholkach ktore sa projektami) { foreach (var e in g.OutEdges(i)) { //dla kazdej krawedzi, patrzymy jescze ile z niej odchodzi foreach (var e1 in g.OutEdges(e.To)) { res.ExpertToProjects.Add(new ExpertToProject() { ProjectId = i - 1, SkillId = e1.From - projectCount - 1, ExpertId = e1.To - projectCount - skillCount - 1 }); } } } return(res); }