Period rules
Period rules
A resource can define a set of rules that apply to all its shifts. The following constraint rules are supported:
maxDriveTime
: the maximum drive time in seconds for that periodmaxWorkTime
: the maximum work time in seconds for that periodminDriveTime
: the minimum drive time in seconds for that periodminWorkTime
: the minimum work time in seconds for that period
Watch out with putting minimum rules to drive time. At worst, it will ensure higher travel time than perhaps
necessary.
Period rules are defined in the rules
array of a resource.
In this example we use a single rule:
"rules" : [
{
"maxDriveTime": "10000"
}
]
{
"resources": [
{
"name": "R-1",
"start": {
"latitude": 50.923554431590595,
"longitude": 4.890691212789399
},
"shifts": [
{
"from": "2023-01-13T08:00:00",
"to": "2023-01-13T22:00:00"
}
],
"rules": [
{
"maxDriveTime": "10000"
}
]
}
],
"jobs": [
{
"name": "JOB-1",
"location": {
"latitude": 50.54963315022148,
"longitude": 4.848855475505483
},
"duration": 3600
},
{
"name": "JOB-2",
"location": {
"latitude": 50.65910297910443600,
"longitude": 4.007987934186738
},
"duration": 3600
},
{
"name": "JOB-3",
"location": {
"latitude": 50.324969095932296,
"longitude": 4.010111317974326
},
"duration": 3600
},
{
"name": "JOB-4",
"location": {
"latitude": 50.53457539132416,
"longitude": 4.69167867847318
},
"duration": 3600
},
{
"name": "JOB-5",
"location": {
"latitude": 50.94837893617721,
"longitude": 4.001604640663746
},
"duration": 3600
},
{
"name": "JOB-6",
"location": {
"latitude": 50.89633806889935,
"longitude": 4.45161298168845
},
"duration": 3600
},
{
"name": "JOB-7",
"location": {
"latitude": 50.48191907288704,
"longitude": 4.311723085641562
},
"duration": 3600
},
{
"name": "JOB-8",
"location": {
"latitude": 50.1824046123600988,
"longitude": 4.355240303516217
},
"duration": 3600
},
{
"name": "JOB-9",
"location": {
"latitude": 50.09960152277046,
"longitude": 4.46586698360070229
},
"duration": 3600
},
{
"name": "JOB-10",
"location": {
"latitude": 50.78868282668716,
"longitude": 4.167956383823208
},
"duration": 3600
}
],
"options": {
"partialPlanning": true
}
}
{
"score": {
"hardScore": 0,
"mediumScore": -25200,
"softScore": -6924,
"feasible": true
},
"trips": [
{
"visits": [
{
"arrival": "2023-01-13T08:44:54",
"job": "JOB-6",
"location": "50.89633806889935;4.45161298168845"
},
{
"arrival": "2023-01-13T10:21:25",
"job": "JOB-5",
"location": "50.94837893617721;4.001604640663746"
},
{
"arrival": "2023-01-13T11:55:17",
"job": "JOB-10",
"location": "50.78868282668716;4.167956383823208"
}
],
"resource": "R-1",
"date": "2023-01-13",
"departureTime": "2023-01-13T08:00:00",
"waitTime": 0,
"travelTime": 6917,
"workTime": 17717,
"serviceTime": 10800
}
],
"totalTravelTimeInSeconds": 6917,
"totalServiceTimeInSeconds": 10800,
"workloadFairness": 0.5,
"unserved": [
"JOB-1",
"JOB-2",
"JOB-3",
"JOB-4",
"JOB-7",
"JOB-8",
"JOB-9"
],
"status": "SOLVED"
}
{
"score": {
"hardScore": 0,
"mediumScore": -25200,
"softScore": -6924,
"feasible": true
},
"unresolved": [
{
"constraint": "JOB_DAY_INDEX",
"score": "-7soft"
},
{
"constraint": "TRAVEL_TIME",
"score": "-6917soft"
},
{
"constraint": "UNUSED_RESOURCES",
"score": "-25200medium"
}
]
}
Updated 7 months ago