Comments (18)
You can set a break starting at the end of your first day, with a duration equal to the work interruption.
The vehicle timewindow must start at the beginning of day 1 and end at the end of day 2.
from optimizer-api.
Thank, I test and tell you
from optimizer-api.
With this JSON = crash :
LD_LIBRARY_PATH=../or-tools/dependencies/install/lib/:../or-tools/lib/ ../optimizer-ortools/tsp_simple -time_limit_in_ms 60000 -intermediate_solutions -instance_file '/tmp/optimize-or-tools-input20180806-1125-940yyn' -solution_file '/tmp/optimize-or-tools-output20180806-1125-1l9r2na'
RuntimeError
/home/www/optimizer-api/wrappers/ortools.rb:699:in `run_ortools'
/home/www/optimizer-api/wrappers/ortools.rb:331:in `solve'
/home/www/optimizer-api/optimizer_wrapper.rb:227:in `block (2 levels) in solve'
/home/www/optimizer-api/optimizer_wrapper.rb:709:in `cluster'
/home/www/optimizer-api/optimizer_wrapper.rb:224:in `block in solve'
/home/www/optimizer-api/optimizer_wrapper.rb:395:in `block in join_vrps'
/home/www/optimizer-api/optimizer_wrapper.rb:392:in `each'
/home/www/optimizer-api/optimizer_wrapper.rb:392:in `each_with_index'
/home/www/optimizer-api/optimizer_wrapper.rb:392:in `each'
/home/www/optimizer-api/optimizer_wrapper.rb:392:in `map'
/home/www/optimizer-api/optimizer_wrapper.rb:392:in `join_vrps'
/home/www/optimizer-api/optimizer_wrapper.rb:170:in `solve'
/home/www/optimizer-api/optimizer_wrapper.rb:924:in `perform'
/var/lib/gems/2.3.0/gems/resque-status-0.5.0/lib/resque/plugins/status.rb:161:in `safe_perform!'
/var/lib/gems/2.3.0/gems/resque-status-0.5.0/lib/resque/plugins/status.rb:137:in `perform'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/job.rb:168:in `perform'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:304:in `perform'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:894:in `block in perform_with_fork'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:892:in `fork'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:892:in `perform_with_fork'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:260:in `work_one_job'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:234:in `block in work'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:231:in `loop'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/worker.rb:231:in `work'
/var/lib/gems/2.3.0/gems/resque-1.27.4/lib/resque/tasks.rb:20:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.3.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:22:in `load'
/usr/local/bin/rake:22:in `<main>'
In my JSON :
4 vehicles :
-
Vehicles 1 with break stop :
7H - 19H -
Vehicles 2 with break stop:
31H - 43H -
Vehicles 3 with break start :
55H - 67H -
Vehicles 4 without break :
7h - 19H
All point (multi time window):
9H - 17H
33H - 41H
57H - 65H
Break (multi time window):
19H - 31H
43H - 55H
Can you help me please ?
Thanks a lot !
from optimizer-api.
If I understand well, vehicles 1, 2 and 3 are the same with night breaks between.
This way, you have to define only one vehicle for those 3 with a timewindow starting at 7h and ending at 67h.
The breaks lasts 12 hours each and starts at 19h and 43h respectively.
The corrected JSON could be find here : https://gist.github.com/braktar/1b8334bdfe9faea313431e7456fa6600
from optimizer-api.
By the way, thanks for the error report ;)
from optimizer-api.
ok thanks for your response, it's OK in this case
I continu testing break, and testing multi breaks.
With 5 breaks : JSON here
1 vehicule to simulate :
- Start work monday (depot)
- End friday (depot)
- With sleep in hotel monday, tuesday, wednesday, thursday
All day work start at 7H and finish at 19H
All service start at 9H and finish at 17H
Vehicule Time :
Day 1 : 7H - 24H
Day 2 : 24H - 48H
Day 3 : 48H - 72H
Day 4 : 72H - 96H
Day 5 : 96H - 115H
"timewindow":{
"start":25200,
"end":414000
}
Break :
Day 1 : 19H - 31H
Day 2 : 43H - 55H
Day 3 : 67H - 75H
Day 4 : 91H - 103H
"rests": [
{
"duration": 43200,
"id": "break-0",
"timewindows": [
{
"start": 68400,
"end": 111600
}
]
},
{
"duration": 43200,
"id": "break-1",
"timewindows": [
{
"start": 154800,
"end": 198000
}
]
},
{
"duration": 43200,
"id": "break-2",
"timewindows": [
{
"start": 241200,
"end": 284400
}
]
},
{
"duration": 43200,
"id": "break-3",
"timewindows": [
{
"start": 327600,
"end": 370800
}
]
}
]
Services :
Day 1 : 9H : 17H
Day 2 : 33H : 41H
Day 3 : 57H : 65H
Day 3 : 81H : 89H
Day 4 : 105H : 113H
"activity": {
"point_id": "point_7",
"timewindows": [
{
"start": 32400,
"end": 55800
},
{
"start": 118800,
"end": 147600
},
{
"start": 205200,
"end": 234000
},
{
"start": 291600,
"end": 320400
},
{
"start": 378000,
"end": 406800
}
],
"duration": 5400
}
No solution find, do you know why ?
Thanks
from optimizer-api.
Hello,
Timewindows are actually starting slots. So I advice you to reduce the breaks timewindows in order to reduce the complexity.
With the next JSON, I obtain a result in 80 seconds.
https://gist.github.com/braktar/c10102fd680d574ec898c7c7da6188d2
from optimizer-api.
OK thanks a lot !
I testing
from optimizer-api.
I reduce time windows of break, It's OK solutions find all the time.
I simplify problem, to analyze the data more easily.
JSON here
vehicules :
- 1 vehicule for two day
- 3 vehicules for one day
All day work start at 7H and finish at 19H
All service start at 9H and finish at 17H
Vehicule Time :
Day 1 : 7H - 24H vehicle_0
Day 2 : 24H - 43H vehicle_0
Day 3 : 7H - 19H vehicle_1
Day 4 : 7H - 19H vehicle_2
Day 5 : 7H - 19H vehicle_3
"vehicles":[
{
"id":"vehicle_0",
"matrix_id":"matrix_0",
"timewindow":{
"start":25200,
"end":154800
},
"start_point_id":"depot",
"end_point_id":"depot",
"rest_ids":[
"break-0"
]
},
{
"id":"vehicle_2",
"matrix_id":"matrix_0",
"timewindow":{
"start":25200,
"end":68400
},
"start_point_id":"depot",
"end_point_id":"depot"
},
{
"id":"vehicle_3",
"matrix_id":"matrix_0",
"timewindow":{
"start":25200,
"end":68400
},
"start_point_id":"depot",
"end_point_id":"depot"
},
{
"id":"vehicle_4",
"matrix_id":"matrix_0",
"timewindow":{
"start":25200,
"end":68400
},
"start_point_id":"depot",
"end_point_id":"depot"
},
{
"id":"vehicle_5",
"matrix_id":"matrix_0",
"timewindow":{
"start":25200,
"end":68400
},
"start_point_id":"depot",
"end_point_id":"depot"
}
]
Break :
Day 1 : 19H - 31H
"rests": [
{
"duration": 43200,
"id": "break-0",
"timewindows": [
{
"start": 68400,
"end": 68900
}
]
}
]
Services :
Day 1 : 9H : 17H
Day 2 : 33H : 41H
Day 3 : 9H : 17H
Day 3 : 9H : 17H
Day 4 : 9H : 17H
"activity": {
"point_id": "point_4",
"timewindows": [
{
"start": 32400,
"end": 59400
},
{
"start": 118800,
"end": 147600
}
],
"duration": 1800
}
If we look at the vehicle 0 we see who starts with the break, yet he can make interventions before.
Did I configure something in the wrong way ?
Thanks !!
from optimizer-api.
I find tips, i add cost_fixed in my vehicles
"vehicles": [
{
"id": "vehicle_0",
"matrix_id": "matrix_0",
"timewindow": {
"start": 25200,
"end": 154800
},
"start_point_id": "depot",
"end_point_id": "depot",
"rest_ids": [
"break-0"
],
"cost_fixed": 10000.0,
"cost_distance_multiplier": 0.0,
"cost_time_multiplier": 1.0
},
{
"id": "vehicle_2",
"matrix_id": "matrix_0",
"timewindow": {
"start": 25200,
"end": 68400
},
"start_point_id": "depot",
"end_point_id": "depot",
"cost_fixed": 20000.0,
"cost_distance_multiplier": 0.0,
"cost_time_multiplier": 1.0
},
{
"id": "vehicle_3",
"matrix_id": "matrix_0",
"timewindow": {
"start": 25200,
"end": 68400
},
"start_point_id": "depot",
"end_point_id": "depot",
"cost_fixed": 30000.0,
"cost_distance_multiplier": 0.0,
"cost_time_multiplier": 1.0
},
{
"id": "vehicle_4",
"matrix_id": "matrix_0",
"timewindow": {
"start": 25200,
"end": 68400
},
"start_point_id": "depot",
"end_point_id": "depot",
"cost_fixed": 40000.0,
"cost_distance_multiplier": 0.0,
"cost_time_multiplier": 1.0
},
{
"id": "vehicle_5",
"matrix_id": "matrix_0",
"timewindow": {
"start": 25200,
"end": 68400
},
"start_point_id": "depot",
"end_point_id": "depot",
"cost_fixed": 50000.0,
"cost_distance_multiplier": 0.0,
"cost_time_multiplier": 1.0
}
],
The result seems to be ok, can you please confirm it's a compliant way to do?
Thanks
from optimizer-api.
The fixed cost is a way to define the cost implied by the use of a vehicle.
It can also be used to define a preference between vehicles.
Your usage is compliant with the philosophy behind this parameter.
from optimizer-api.
With the break, the vehicle stop in my exemple at 13h44 point_4 :
6 => {#838 ▼
+"service_id": "service4"
+"point_id": "point_4"
+"travel_time": 1035.1
+"travel_distance": 16570.5
+"begin_time": 47668
+"departure_time": 49468
+"detail": {#596 ▶}
+"alternative": 0
}
and start at 09h00 (point_7)
8 => {#835 ▼
+"service_id": "service7"
+"point_id": "point_7"
+"travel_time": 0
+"travel_distance": 0
+"begin_time": 118801
+"departure_time": 120601
+"detail": {#832 ▶}
+"alternative": 0
}
With this break between :
7 => {#629 ▼
+"rest_id": "break-0"
+"begin_time": 68400
+"departure_time": 111600
+"detail": {#836 ▼
+"duration": 43200
+"timewindows": array:1 [▶]
}
}
but I do not have the travel time between the two points, it's normal ?
how do you know if you're driving in the evening and in the morning? only in the evening only in the morning?
I hope is clear ?
Thank
from optimizer-api.
Travel times are missing currently on the master branch, we have a fix for that on dev
from optimizer-api.
On dev branch, the travel time is added on break activity ?
Thanks
from optimizer-api.
Indeed, that's the way we define the breaks within ortools.
We travel to the next point before performing the break.
from optimizer-api.
OK,
But the travel time in point_8 is the travel time to go at point_8.
Where is the travel time to go at point_2 ?
Thanks
from optimizer-api.
Those data must be into the break data, which seems to be currently not implemented, we will provide this soon.
from optimizer-api.
ok thanks.
And thank a lot for all advise !
from optimizer-api.
Related Issues (8)
- Error on docker container HOT 10
- Error with matrix HOT 4
- Break time evolution HOT 2
- API - Right breaks setting HOT 15
- Mistake in documentation HOT 2
- Strange results HOT 1
- Testing sequence_timewindows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optimizer-api.