// Returns 0 if a is better, 1 if b is better. public int compareAnalyzations(Analyzation a, Analyzation b) { if (a.conflictCount < b.conflictCount) { return 0; } if (a.conflictCount > b.conflictCount) { return 1; } else { // TODO... make it better. For now, return the one with the lowest time. if (a.time <= b.time) { return 0; } else { return 1; } } }
public Analyzation analyzeSolution() { Analyzation a = new Analyzation(); a.cost = 0; a.time = 0; a.conflictCount = 0; a.max_arrive = 0; a.min_depart = 24*60; // can't get any higher than 24 hours. a.null_trains = 0; int unalignedComps = 0; foreach (Missionary m in missionaries) { foreach (Leg l in m.legs) { if (l.train != null) { if (l.train.costEuro > 0) { a.cost += l.train.costEuro; } a.time += l.train.durationMinutes; if (l.conflict_after == true) { a.conflictCount += 1; } if (l.time_end > a.max_arrive) { a.max_arrive = l.time_end; } if (l.time_start < a.min_depart) { a.min_depart = l.time_start; } } else { a.null_trains++; } } } return a; }