14. Guidelines for Objective Functions
An Objective Function (OF), in conjunction with routing metrics and constraints, allows for the selection of a DODAG to join, and a number of peers in that DODAG as parents. The OF is used to compute an ordered list of parents. The OF is also responsible to compute the Rank of the device within the DODAG Version.
The Objective Function is indicated in the DIO message using an Objective Code Point (OCP), and it indicates the method that must be used to construct the DODAG. The Objective Code Points are specified in [RFC6552] and related companion specifications.
14.1. Objective Function Behavior
Most Objective Functions are expected to follow the same abstract behavior at a node:
-
The parent selection is triggered each time an event indicates that a potential next-hop information is updated. This might happen upon the reception of a DIO message, a timer elapse, all DODAG parents are unavailable, or a trigger indicating that the state of a candidate neighbor has changed.
-
An OF scans all the interfaces on the node. Although, there may typically be only one interface in most application scenarios, there might be multiple of them and an interface might be configured to be usable or not for RPL operation. An interface can also be configured with a preference or dynamically learned to be better than another by some heuristics that might be link-layer dependent and are out of scope for this specification. Finally, an interface might or might not match a required criterion for an Objective Function, for instance, a degree of security. As a result, some interfaces might be completely excluded from the computation, for example, if those interfaces cannot satisfy some advertised constraints, while others might be more or less preferred.
-
An OF scans all the candidate neighbors on the possible interfaces to check whether they can act as a router for a DODAG. There might be many of them and a candidate neighbor might need to pass some validation tests before it can be used. In particular, some link layers require experience on the activity with a router to enable the router as a next hop.
-
An OF computes Rank of a node for comparison by adding to the Rank of the candidate a value representing the relative locations of the node and the candidate in the DODAG Version.
-
The increase in Rank must be at least MinHopRankIncrease.
-
To keep loop avoidance and metric optimization in alignment, the increase in Rank should reflect any increase in the metric value. For example, with a purely additive metric, such as ETX, the increase in Rank can be made proportional to the increase in the metric.
-
Candidate neighbors that would cause the Rank of the node to increase are not considered for parent selection.
-
-
Candidate neighbors that advertise an OF incompatible with the set of OFs specified by the policy functions are ignored.
-
As it scans all the candidate neighbors, the OF keeps the current best parent and compares its capabilities with the current candidate neighbor. The OF defines a number of tests that are critical to reach the objective. A test between the routers determines an order relation.
-
If the routers are equal for that relation, then the next test is attempted between the routers,
-
Else the best of the two routers becomes the current best parent, and the scan continues with the next candidate neighbor.
-
Some OFs may include a test to compare the Ranks that would result if the node joined either router.
-
-
When the scan is complete, the preferred parent is elected and the node's Rank is computed as the preferred parent Rank plus the step in Rank with that parent.
-
Other rounds of scans might be necessary to elect alternate parents. In the next rounds:
-
Candidate neighbors that are not in the same DODAG are ignored.
-
Candidate neighbors that are of greater Rank than the node are ignored.
-
Candidate neighbors of an equal Rank to the node are ignored for parent selection.
-
Candidate neighbors of a lesser Rank than the node are preferred.
-