GraphHopper.com | Forum | GitHub | Maps | Blog

New Feature: Groups

announcements

#1

We are happy to announce one of the most requested feature: Job groups. With job groups you can easily specify that jobs need be served successively.

If you want the algorithm to determine the actual sequence of jobs within a group as well as the group position within a route, you can specify the following:

{
     "id": "A-1",
     "address": {
       "location_id": "A-1-location",
       "lon": 9.999,
       "lat": 53.552
     },
     "group": "A"
},
{
     "id": "A-2",
     "address": {
       "location_id": "A-2-location",
       "lon": 9.799,
       "lat": 53.662
     },
     "group": "A"
}

As you can see, it is as easy as adding a new field to your services/shipments called “group”.

If you want to better control group positions within the route, you can use groups just like relations, i.e. you can specify a relation as follows:

{
     "type": "in_direct_sequence",
     "groups": ["start","A"]
}

This way you specify that all A-jobs need to be served at the beginning of a route.

If you want them to be executed at the end, specify:

{
     "type": "in_direct_sequence",
     "groups": ["A","end"]
}

If you have two groups “A” and “B” and want to specify that A-jobs need to be served before
B-jobs, specify:

{
     "type": "in_sequence",
     "groups": ["A","B"]
}

Accordingly, if you want B-jobs followed directly after A-jobs, switch relation type
to “in_direct_sequence” like this:

{
     "type": "in_direct_sequence",
     "groups": ["A","B"]
}

The great thing is that groups also cover another frequently requested feature: priorities within a route. For example, if you have high, medium and low priority jobs that need to be served in sequence, you can assign them for example the following groups “high priority”, “medium priority” and “low priority” and specify a in_sequence relations like this:

{
     "type": "in_sequence",
     "groups": ["high priority","medium priority", "low priority"]
}

Please note that this is still a beta feature and thus subject to changes. Furthermore, it is currently limited to traveling salesman problems, i.e. if you have more than one vehicle, you cannot use it yet (however it is coming soon). If you find something unexpected, please let us know.