private Integer calculateEndOfTrip(Vehicle vehicle) { logger.trace( "--------------------------------------------------------------------------------"); logger.trace( "--------------------calculateEndOfTrip begins ----------------------------------"); logger.trace( "--------------------------------------------------------------------------------"); logger.trace("vehicle : " + vehicle); logger.trace("vehicle.getNextCustomer() : " + vehicle.getNextCustomer()); Integer endOfTrip = vehicle.getReadyTime(); Customer customer = vehicle.getNextCustomer(); while (customer != null) { if (customer.getNextCustomer() == null) { endOfTrip = (int) (customer.getDepartureTime() + customer.getSecondsTo(customer.getVehicleRecursive())); } customer = customer.getNextCustomer(); } logger.trace( "--------------------------------------------------------------------------------"); logger.trace( "--------------------calculateEndOfTrip begins ----------------------------------"); logger.trace( "--------------------------------------------------------------------------------"); return endOfTrip; }
protected void updateArrivalTimeAndEnfOfTrip(ScoreDirector scoreDirector, Customer customer) { // updateChain(scoreDirector, customer); // return; logger.trace( "--------------------------------------------------------------------------------"); logger.trace( "-----------------updateArrivalTimeAndEnfOfTrip begins---------------------------"); logger.trace( "--------------------------------------------------------------------------------"); // customer.getPreviousStandstill()==null // customer.getNextCustomer()==null // customer.getVehicle().getNextCustomer()==null logger.trace("customer : " + customer); logger.trace("customer.getPreviousStandstill() : " + customer.getPreviousStandstill()); logger.trace("customer.getNextCustomer() : " + customer.getNextCustomer()); logger.trace("customer.getVehicleRecursive(): " + customer.getVehicleRecursive()); logger.debug("vehicle.getNextCustomer(): " + customer.getVehicleRecursive().getNextCustomer()); updateArrivalTime(scoreDirector, customer); Vehicle vehicle = customer.getVehicleRecursive(); Integer calculatedEndOfTrip = calculateEndOfTrip(vehicle); // if(calculatedEndOfTrip==1 && customer.getPreviousStandstill()!=null) // { // logger.debug("customer : " + customer); // logger.debug("customer.getPreviousStandstill() : " + customer.getPreviousStandstill()); // logger.debug("customer.getNextCustomer() : " + customer.getNextCustomer()); // logger.debug("customer.getVehicleRecursive(): " + customer.getVehicleRecursive()); // logger.debug("vehicle.getNextCustomer(): " + // customer.getVehicleRecursive().getNextCustomer()); // } vehicle.setEndOfTrip(calculatedEndOfTrip); // while(vehicle!=null) // { // updateArrivalTime(scoreDirector, customer); // vehicle.setEndOfTrip(calculateEndOfTrip(vehicle)); // // vehicle = vehicle.getNextVehicle(); // } // logger.trace(" while (nextVehicle != null)..."); // logger.trace("vehicle: " + vehicle); // logger.trace("nextVehicle: " + nextVehicle); // logger.trace("nextVehicle.getReadyTime(): " + nextVehicle.getReadyTime()); // logger.trace("calculatedEndOfTrip: " + calculatedEndOfTrip); // logger.trace("nextVehicle.getNextCustomer(): " + nextVehicle.getNextCustomer()); // updateArrivalTime(scoreDirector, customer); // Vehicle vehicle = customer.getVehicleRecursive(); // // Integer calculatedEndOfTrip = calculateEndOfTrip(vehicle); // vehicle.setEndOfTrip(calculatedEndOfTrip); // // Vehicle nextVehicle = vehicle.getNextVehicle(); // // while (nextVehicle != null) // { // // // nextVehicle.setReadyTime(calculatedEndOfTrip); // if (nextVehicle.getNextCustomer() != null) { // updateArrivalTime(scoreDirector, nextVehicle.getNextCustomer()); // // } // calculatedEndOfTrip = calculateEndOfTrip(nextVehicle); // nextVehicle.setEndOfTrip(calculatedEndOfTrip); // // vehicle = nextVehicle; // nextVehicle = vehicle.getNextVehicle(); // calculatedEndOfTrip = calculateEndOfTrip(vehicle); // // } logger.trace( "--------------------------------------------------------------------------------"); logger.trace( "-----------------updateArrivalTimeAndEnfOfTrip ends-----------------------------"); logger.trace( "--------------------------------------------------------------------------------"); }