-
Notifications
You must be signed in to change notification settings - Fork 340
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
Pre-planned jobs #287
Comments
Looks like you need a combination of two things.
Note that the later cannot guarantee that all "mandatory" jobs will be included in the solution if you have lots of jobs and strict constraints (e.g. time windows). |
@romainrey out of curiosity, can you expand a bit on the context and what you're trying to achieve? |
Thanks for the quick answer, Indeed the strategy you detailed is exactly the one I followed. I set up unique matching by skill to ensure only the good car can do the job and I set priority 10 and 0 to push it to go to these jobs. Unfortunatly this is not enough to make it work... For context: |
Can you please be a bit more verbose on what does "not work"? I think I get what you expect but I'm not sure what is actually different in the solutions you get? Maybe provide a simple example if you can? |
Sorry for the lack of details, here a more complete answer: Let's look at the example below, and the final solution gives me: whereas jobs 1, 2, 3 were 'mandatory' (All locations are in France) |
I'm getting the expected result when running your input against my local OSRM instance with France data.
I see two potential causes.
|
Hi, This is encouraging, I didn't have the time to to the standalone version as suggest, I'll do it asap. |
By running the process on your link I got the following json file |
I can confirm I'm getting the expected behaviour with your standalone input file and a recent version. You need to checkout tag The priority key has been introduced in the last As a general rule of thumb, and unless you need to mess up with a feature that is under development, I'd recommend using release builds by checking out specific version tags. |
I installed the new version this morning and I confirm that it is indeed working way better. I tested it on some real case scenario that I have with a lot more jobs and vehicles. The solution works well in 90% of the case by giving to people the mandatory jobs they are qualified to do. I was also thinking about a potential way to add more weight to the mandatory job. By duplicating a job and adding service=0 to its copy and priority=10, the vehicle will get 20 priority points (10 for the real job and 10 for the duplicate) by going there without spending more time, so that should give it an incentive to go there. We can even add 3, 4, ... duplicate jobs for one real job to add more weight. |
I get it that it's tempting to try forcing the weight this way, and in term of pure modelling it makes sense. However I wouldn't recommend doing this for two reasons:
|
@romainrey to make sure I get it right, can you confirm this is what's happening in the 10% of cases you mention, that is:
If so, then I agree we don't provide the expected solution and it would be valuable if you could share a standalone instance to reproduce. |
All right I get it, it makes more sense now, thanks for the explanation. It was indeed risky to try that without knowing the underlying optimizations you were doing.
Sorry I forgot to mention a crucial information: I was simplifying the problem in this thread with only priorities 0 and 10 because the simple example wasn't working for me. But now that the simple example is working (thanks to version upgrade), I got back to my initial problem: working with several priorities values. However the business need is real: I need to repair some shops, so these are urgent and mandatory interventions (priority 10). But I also need to do some maintenance and the priority of the maintenance could be based on a contract delay we have to respect (e.g predictive maintenance priority 0, 6 months in advance priority 1, ..., 1 month late priority 5). The only solution I see to deal with this for me is to rerun the optimization on the missing ones and reduce the priorities (for example by saying only <inferior 3 months in advance priority 1 else if superior then 0), this will help to reduce the sum of priorities of non mandatory-jobs solutions. But this will make me loose some information on the real priority of the maintenance to do and also a cost of recomputing optimization The other solution would be to put the priority parameter on a range from 0 to 100 as you were suggesting in your original post. That would solve all these problems and it should not change anything for those using it with the range 0 to 10. But I don't know if this on your plan... But at least now your know that some business case actually justify it :) |
I'm not sure changing the priority scale would fundamentally make things different, other than by providing a little more granularity. If you want to give it a try, you only have to adjust this check. A priority is a 32-bit unsigned integer so you just want to be careful that priority sums do not overflow.
I don't quite understand what is wrong with the way you translate your business logic into priorities. If the provided solution actually gives the highest priority sum, then how is it different from what you're trying to achieve? |
Thanks will try this! I will keep you updated
Let's recap:
But in reality a combination of maintenance cannot replace a mandatory jobs. Even 5 maintenance of priority 5 can't replace one mandatory urgent fix. Because the fix is mandatory and cannot be left unassigned. What I can only do is to add some maintenance after or before the fix if I still have time in my day. So the problem with priority 10 is that a combination of maintenance can easily replace one mandatory job (for example only 3 maintenance with priority 5 (so a total of 15) so can do it). But in reality one day can only contain 5 operations maximum (either fix or maintenance). So if I put the mandatory fixes to a priority of 100 and I keep the priority between 1 and 5 for maintenance (I keep priority for them because this help me to rank them between maintenance) then there is no combination possible of maintenance that could be preferred to a mandatory fix. So that solves my situation. |
Yes, the 0-10 priority scale woks well in most cases with just a few priority classes but it may indeed be too restrictive if you want to have 5 levels of optional jobs. Happy to have feedback on your tests and findings! |
After testing on several examples, changing the priority to 100 for mandatory and keeping low values (usually <10) for the other worked well for me. I don't have any problem anymore on this! Thanks a lot for the help all along An other question: today the major part of my time is taking by the loading phase and not the solving phase (13s for loading and 0.3 for solving). I am using vroom express and json in the query. Is there any ways to make this loading quicker? |
@romainrey adding yet another parameter is not ideal and anyway I think it's clearer for everyone to have a fixed range for priority values. Based on the way it's been implemented, the scale itself does not really matter as long as it allows to use enough priority "classes". So in the light of your feedback I'm in favour of your previous suggestion to raise the max value to 100. Besides, as you mentioned, that change would not affect at all anyone using the current [0,10] scale. |
Are you referring to the A loading time of 13s seems indeed very high, especially because the solving time suggest you have a small problem. Can you provide more context on your setup:
|
Great news for the official increase of priority! About my problem complexity I have: |
@romainrey first check the time it takes for your local OSRM instance to complete a Another option you have to speed-up things is to install |
Sorry for getting back late on this, I checked and this was indeed the bottleneck. I didn't try the other improvement as I am not sure I want to overload the RAM with it So I think it is now all good for me, thanks a lot Julien for your help. I hope I could help you on this nice project one day if there is something more into Python or R which are my main skills. Anyways I will let you know if I have some comments, or ideas for improvement. Thanks! |
Hi,
I would need to use vroom to optimize several vehicles which have to do some jobs, but I already know that some given vehicules have to do some given jobs. These ones are 'already' planned and I need vroom to only complete the planning.
For example you have to visit different cities but you know that you have to go to city X, and this is non-negociable.
How to force this? I tried priority but this is not enough, even with priority 0 on all jobs and 10 on mandatory job.
Thanks
Ps:
I am in a situation where I have a lot of jobs and a restricted time window so I know that there will be a lot of unassigned jobs. I just don't want one of my mandatory job to be unassigned.
The text was updated successfully, but these errors were encountered: