static void Main(string[] args) { // Parse the raw survey data into fields, this was the first step in the process. //ParseSurveyFile("cando"); //ParseSurveyFile("want"); // Re-exported parts of the excel doc to the minimal set of data needed for matching. var personList = ParseMinimalSheet(@"C:\Users\peterzen\OneDrive - Microsoft\Desktop\MentorMinimal.txt"); // Store off the list of eventual matches. List <Tuple <Person, Person> > matches = new List <Tuple <Person, Person> >(); // Let's figure out how many different disciplines are represented, we'll later match by discipline var disciplines = GetDisciplines(personList); foreach (var discipline in disciplines) { var disciplinedPeople = GetPeopleByRole(discipline, personList); for (int pass = 1; pass <= MaxMentees; pass++) { var match = ProcessListOfUsers(disciplinedPeople, pass); matches.AddRange(match); } var noMentor = disciplinedPeople.Where(x => x.IsMentored); var NotMentoring = disciplinedPeople.Where(x => x.IsMentoring == 0); } // Sort by survey ID and process the output in that order so we can re-import it into excel and have it line up. var orderedMatches = matches.OrderBy(x => x.Item1.Id); int id = 1; foreach (var match in orderedMatches) { while (id != match.Item1.Id) { Console.WriteLine("{0},,,,,,,,", id); id++; } Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8}", match.Item1.Id, match.Item1.Name, match.Item1.Email, match.Item1.Band, match.Item2.Name, match.Item2.Email, match.Item2.Band, match.Item2.IsMentoring, Interest.Overlap(match.Item1.WantMentorItems, match.Item2.CanMentorItems)); id++; } }
/// <summary> /// Given a person, find a mentor for that person. /// </summary> public static Person FindMentor(Person p, List <Person> people, int maxMentors) { // Filter by band first var mentors = people.Where(x => x.Band > p.Band).ToList(); Person mentorTarget = null; // It's late, let's just brute force it. int maxOverlap = 0; foreach (var mentor in mentors) { int overlap = Interest.Overlap(p.WantMentorItems, mentor.CanMentorItems); if (overlap > maxOverlap && mentor.IsMentoring < maxMentors) { mentorTarget = mentor; maxOverlap = overlap; } } return(mentorTarget); }