Objectives
The objective function (or simply objective) in optimization problems is the function whose value is to be minimized or maximized over the set of all feasible solutions that satisfy the problem constraints. A classical objective function in the Vehicle Routing Problem (VRP) domain is the minimization of total distance. However, real life scenarios require different objective functions or even more than one considered simultaneously. Good examples of different objectives would be fair work distribution, prioritization of particular jobs over others, reducing the amount of tours over total cost, etc.
Tour Planning allows you to specify objectives using the problem's optional property objectives
Supported Objectives
The list of supported objectives is:
-
minimizeUnassigned
: minimizes the number of unassigned jobs -
minimizeCost
: minimizes the total solution cost (implicitly could minimize distance, duration and fixed cost) -
minimizeDistance
minimizes the total traveled distance -
minimizeDuration
: minimizes total duration calculated as the sum of all tour durations -
optimizeTourCount
optimizes the number of tours in the solution. The objective has an extra parameter: -
action
: if set to minimize
then it minimizes the number of tours in the solution. If it is set to maximize
then it maximizes the number of tours in the solution
-
optimizeTaskOrder
: controls the order of job task activities in the tour. When specified, the task order is considered as a soft constraint, and the solver tries to minimize the number of its violations. When not specified, but order
property is defined on job's level, then it is considered as a hard constraint, which cannot be violated.
Objectives are specified in a hierarchy using the objectives
property:
"objectives": [
{
"type": "minimizeUnassigned"
},
{
"type": "minimizeCost"
}
]
In this example, the objective minimizeUnassigned
is highest in the hierarchy, meaning it will govern the optimization stronger than the other objective. As a consequence the optimization algorithm will favor solutions with fewer unassigned jobs over solutions with lower cost. Note that having the minimizeUnassigned
at lower levels of the hierarchy, e.g. after minimizeCost
in the above example, might lead to unexpected results like having all jobs unassigned.
Default objectives
In case you did not specify the objectives
, by default the solver minimizes the amount of unassigned jobs with highest importance, the number of tours with medium importance and with least importance the total cost. This is equal to the following definition:
"objectives": [
{
"type": "minimizeUnassigned"
},
{
"type": "optimizeTourCount",
"action": "minimize"
},
{
"type": "minimizeCost"
}
]
When relying on the default objectives, make sure that they serve the purpose of your optimization. For example, if you care more about the cost of using your fleet, and you have a hybrid fleet of small and large vehicles with large ones being more expensive, then probably you need to put minimizeCost
above optimizeTourCount
in the objectives hierarchy. Otherwise, default objectives will tend to use the large vehicles, that are more expensive, as this will result in less total number of used vehicles.
The next section describes some implicit conventions and rules that are noteworthy when defining objectives.
Definition rules
- objectives are specified as an array
- the order of objectives in the array defines the importance of objectives from more important to less important
-
minimizeCost
objective must be present -
minimizeUnassigned
objective must be present - each specific objective can be defined only once
- an empty
objectives
definition is not allowed (see default objective)
Objectives in combination with territory, priority and job task order features
If the problem has territory, priority or job task order feature and whether the objectives
property is set or not, the following applies.
- If the problem has the territory feature, then satisfying it will get the highest importance.
- If the problem has the job priority feature, then satisfying it will get the highest importance unless the problem has the territory feature, then it will be the second-highest importance.
- In case the problem has the job task order feature, then it will be considered as a hard constraint.