private void HardCase() { List <ITrip> uniquePassenger = GetUniquePassengerTrips(); PotentialPassengerTrip[][] feasible = new PotentialPassengerTrip[uniquePassenger.Count][]; SetupTable(HouseholdData.PersonData.Length, feasible, uniquePassenger); //var watch = new Stopwatch(); //watch.Start(); int[] bestAssignment = new int[uniquePassenger.Count]; for (int i = 0; i < bestAssignment.Length; i++) { bestAssignment[i] = -1; } Solve(feasible, bestAssignment, HouseholdData.PersonData.Length); AssignPassengerTrips(feasible, bestAssignment); }
private void SetupTable(int numberOfPeoples, PotentialPassengerTrip[][] feasible, List <ITrip> uniqueTrips) { for (int i = 0; i < uniqueTrips.Count; i++) { feasible[i] = new PotentialPassengerTrip[numberOfPeoples]; } for (int i = 0; i < uniqueTrips.Count; i++) { for (int j = 0; j < PotentialTrips.Count; j++) { if (PotentialTrips[j].PassengerDestinationTrip == uniqueTrips[i]) { feasible[i][IndexOf(PotentialTrips[j].DriverDestinationTrip.TripChain.Person, Household.Persons)] = PotentialTrips[j]; } } } }