Hello. I am trying to give a priority to one vehicle for a stop over another. I’ve implemented a soft constraint where :
@Override
public double getCosts(JobInsertionContext insertionContext) {
double penalizeScore = 0.0;
if (vrpTasks != null) {
for (VrpTask vrpTask : vrpTasks) {
if (vrpTask.getId().equalsIgnoreCase(insertionContext.getJob().getId())) {
if (!insertionContext.getNewVehicle().getId().equalsIgnoreCase(vrpTask.getPrioritizedVehicleId())) {
penalizeScore += 10000;
break;
}
}
}
}
return penalizeScore;
}
I’ve set penalty to 10000 but I’m not sure if this is a right way to implement it. Can anybody tell me if there is something I’m missing ? Thank you in advance.