public void insertLocationAndCustomer(double longitude, double latitude) {
   final VrpLocation newLocation = new VrpLocation();
   newLocation.setId(nextLocationId);
   nextLocationId++;
   newLocation.setLongitude(longitude);
   newLocation.setLatitude(latitude);
   logger.info("Scheduling insertion of newLocation ({}).", newLocation);
   solutionBusiness.doProblemFactChange(
       new ProblemFactChange() {
         public void doChange(ScoreDirector scoreDirector) {
           VrpSchedule schedule = (VrpSchedule) scoreDirector.getWorkingSolution();
           scoreDirector.beforeProblemFactAdded(newLocation);
           schedule.getLocationList().add(newLocation);
           scoreDirector.afterProblemFactAdded(newLocation);
           VrpCustomer newCustomer;
           if (schedule instanceof VrpTimeWindowedSchedule) {
             VrpTimeWindowedCustomer newTimeWindowedCustomer = new VrpTimeWindowedCustomer();
             newTimeWindowedCustomer.setReadyTime(10);
             newTimeWindowedCustomer.setDueTime(100);
             newTimeWindowedCustomer.setServiceDuration(10);
             newCustomer = newTimeWindowedCustomer;
           } else {
             newCustomer = new VrpCustomer();
           }
           newCustomer.setId(newLocation.getId());
           newCustomer.setLocation(newLocation);
           // Demand must not be 0
           newCustomer.setDemand(demandRandom.nextInt(10) + 1);
           scoreDirector.beforeEntityAdded(newCustomer);
           schedule.getCustomerList().add(newCustomer);
           scoreDirector.afterEntityAdded(newCustomer);
         }
       });
   updatePanel(solutionBusiness.getSolution());
 }
 private void resetNextLocationId() {
   long highestLocationId = 0L;
   for (VrpLocation location : getSchedule().getLocationList()) {
     if (highestLocationId < location.getId().longValue()) {
       highestLocationId = location.getId();
     }
   }
   nextLocationId = highestLocationId + 1L;
 }