newLocation.setLongitude(longitude);
newLocation.setLatitude(latitude);
logger.info("Scheduling insertion of newLocation ({}).", newLocation);
solutionBusiness.doProblemFactChange(new ProblemFactChange() {
public void doChange(ScoreDirector scoreDirector) {
VrpSchedule solution = (VrpSchedule) scoreDirector.getWorkingSolution();
scoreDirector.beforeProblemFactAdded(newLocation);
solution.getLocationList().add(newLocation);
scoreDirector.afterProblemFactAdded(newLocation);
VrpCustomer newCustomer = new VrpCustomer();
newCustomer.setId(newLocation.getId());
newCustomer.setLocation(newLocation);
// Demand must not be 0
newCustomer.setDemand(demandRandom.nextInt(10) + 1);
scoreDirector.beforeEntityAdded(newCustomer);
solution.getCustomerList().add(newCustomer);
scoreDirector.afterEntityAdded(newCustomer);
}
});
updatePanel(solutionBusiness.getSolution());
}