I have some finite vehicle with different priorities jobs. I tried to follow the approach what you mentioned here:
Thanks for your clarification. Now I understand your problem much better.
He is right, you need a HardActivityConstraint to enforce this. Working with an ActivityConstraint is what I experienced not that easy. You need to consider all possible states when inserting a new Activity. For example, a state might be the current route state [Start, P1,P2,NP,NP,End]. Then there are actually two allowed insertion positions for an activity of priority P1, between Start and P1 AND between P1 and P2. Thus …
But faced the problem what you mentioned here. As I have finite fleet some of jobs are being unassigned which have more priority than others. How to assign all the jobs having more priority before the others?
stefan
August 13, 2016, 1:56pm
2
Do you use your own objective function? Note that priority = 1 means high priority whereas priority = 3 means low priority.
Hi Steafan,
Here is my objective function. Please suggest me what I am doing wrong here.
HardActivityConstraint specificVehicle = new HardActivityConstraint() {
@Override
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct,
TourActivity nextAct, double prevActDepTime) {
if(newAct instanceof TourActivity.JobActivity) {
if(prevAct instanceof TourActivity.JobActivity) {
if(((TourActivity.JobActivity) newAct).getJob().getPriority() < ((TourActivity.JobActivity) prevAct).getJob().getPriority()){
return ConstraintsStatus.NOT_FULFILLED;
}
}
if(nextAct instanceof TourActivity.JobActivity) {
if(((TourActivity.JobActivity) newAct).getJob().getPriority() > ((TourActivity.JobActivity) nextAct).getJob().getPriority()){
return ConstraintsStatus.NOT_FULFILLED;
}
}
return ConstraintsStatus.FULFILLED;
}
return ConstraintsStatus.FULFILLED;
}
};