-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HardActivityConstraint with CRITICAL Priority allowing invalid solutions. #475
Comments
I've update my constraint to be more complete, but I still have the problem of solutions coming about that violate this constraint:
|
I've now narrowed it down to this and it's at about ~2% failure rate:
I think the problem arises when it does this (all pickups at depot):
|
Hi Brian |
@grantm009 the value of that is insignificant - it's just the index of the dimension within the |
@grantm009 here's the entire thing: https://gist.github.com/briandilley/33a36feef99b5fa3608db25c902d29b0 |
Thanks
…--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.http://www.mailguard.com.au/mg
|
@briandilley I assume you are using this:
and not the previous version. scratching head now. |
let me expound some thought. |
Yeah - this makes sense. I'll think on it a bit and try something this weekend. |
So I created a state updater for the round that sets a "run id" on each activity. Here it is:
The problem I'm having is that the
|
Hi Brian |
Im getting the same. but when I call getActivityState in the hard constraint it always returns the value of START_RUN_ID. (If you change START_RUN_ID to 99 it returns 99). This means, I think, that there is a problem getting the state for the activity and it is always return the orElse value. Still working on it. Let me know if you crack it :) |
A bit more expounding Brian
`
or am I missing something |
You could, I guess I was just being overly cautious... I'm not entirely
sure how this API works and there is no documentation so I'm pretty much
fumbling in the dark on this stuff.
…On Mon, Jul 22, 2019, 1:10 AM grantm009 ***@***.***> wrote:
A bit more expounding Brian
Your constraint fulfilled code looks something like this.
` public ConstraintsStatus fulfilled(JobInsertionContext iFacts,
TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double
prevActDepTime) {
int runId = Optional.ofNullable(stateManager.getActivityState(prevAct, STATE_ID, Integer.class))
.orElse(SM_ActivityRunsUpdater_EXP.START_RUN_ID);
for (int i=0; i < iFacts.getAssociatedActivities().size(); i++) {
final TourActivity otherActivity = iFacts.getAssociatedActivities().get(i);
final int otherRunId = Optional.ofNullable(otherActivity)
.map((act) -> stateManager.getActivityState(act, STATE_ID, Integer.class))
.orElse(SM_ActivityRunsUpdater_EXP.START_RUN_ID);
if (otherRunId != runId) {
return ConstraintsStatus.NOT_FULFILLED;
}
}
return ConstraintsStatus.FULFILLED;
}
`
Why are you doing the loop. Can you just do this (pseudo)
runIdD = getRunIdOf(prevAct)
runIdP = getRunIdOf(prevAct.AssociatedActivity)
if runIdD = runIdP then FULFILLED
or am I missing something
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#475?email_source=notifications&email_token=AAIE3T6GZZ5VC6FLFLGF2KLQAVTQDA5CNFSM4H6N4YW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2PEBVI#issuecomment-513687765>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIE3T6AKUZCAVTQLJXLPQLQAVTQDANCNFSM4H6N4YWQ>
.
|
Hi Brian |
excellent - looking forward to it. |
@grantm009 any updates? |
This comment has been minimized.
This comment has been minimized.
The problem with our approaches is that the insertion may be fine for the current job being inserted... but it breaks an existing job that was already inserted. |
I also still have top ups problem. Can you please share your solution? |
Hi We do this in the solution checker which you add to the algorithm as:
In this function (solutionCostCalculator) we check each route for "odd sized runs" which basically means a job is picked up in one run then delivered in another run. If you remove the "runs" overlay this means a topup occurred in the route. When we find this we remove the offending run from the solution and its jobs to the unassigned jobs and the iterations continue until the job is assigned nicely. If your environment has scheduled Breaks or other activities (aside from pickups and deliveries) then you would have to allow for those. I hope this helps. If you find a better way or improvement - please share :)
|
Thanks for your answer. What is RouteRuns? Can you share it too? |
Routeruns is a class that manages our "runs" approach. It is quite proprietary and Im afraid I cant share that class. Essentially you just want a function that takes a route and iterates over it to identify the runs. |
Thanks. Will take a look |
@ifle is it working for you ? |
@grantm009 Yes, thanks. We still not use it on production. The idea move splitted shipments to unassigned jobs works well. We found for some problems we must to increase the iterations otherwise, the result is suboptimal. |
Yes we found it needed more iterations as well. |
Do you have recommendations about number of iterations? |
Hi @grantm009, We have array index out of bounds exception when use initial routes. Do you fimilar with this issue? |
I have a
HardActivityConstraint
for returningNOT_FULFILLED
when the new activity is a pickup at the depot following any activity that wasn't at the depot yet there are pending non-depot deliveries to be made (that's a mouth-full). The problem that I'm having is that I still get an invalid best solution that violates this constraint. How can i prevent invalid solutions as the best solution?Here's the constraint:
and the state updater:
The text was updated successfully, but these errors were encountered: