There are some jobs to be done in same location. I wanted to add constraint not to do 2 jobs same location back to back. I tried with HardActivityConstraint.
if (prevAct instanceof TourActivity.JobActivity && nextAct instanceof TourActivity.JobActivity) { if(prevAct.getLocation().getId().equalsIgnoreCase(newAct.getLocation().getId())) { return ConstraintsStatus.NOT_FULFILLED; } if(nextAct.getLocation().getId().equalsIgnoreCase(newAct.getLocation().getId())) { return ConstraintsStatus.NOT_FULFILLED; } }
if (prevAct instanceof TourActivity.JobActivity) { if(prevAct.getLocation().getId().equalsIgnoreCase(newAct.getLocation().getId())) { return ConstraintsStatus.NOT_FULFILLED; } } if (nextAct instanceof TourActivity.JobActivity) { if(nextAct.getLocation().getId().equalsIgnoreCase(newAct.getLocation().getId())) { return ConstraintsStatus.NOT_FULFILLED; } }
But this is not working. Can anyone point the mistake I made?
Here are the input:
job/vehicle,location id,x,y,capacity
Vehicle,99,30,40,3
Job1,1,0,40,1
Job2,1,0,40,1
Job3,1,0,40,1
Job4,2,60,30,1
Job5,2,60,30,1
Job6,2,60,30,1