The present invention relates to a method for computing a constraint based routing in the fields such as communication, and traffic and so on, and in particular, to a method and an apparatus for generating a constraint based routing.
Routing computation generally needs to satisfy various constraint conditions, and in the related art, the constraint conditions mainly include: passing a certain node; passing a certain link; avoiding a certain node; avoiding a certain link; separating shared risk link groups; separating from the designated link (the above constraint conditions support the strict constraint and the loose constraint, wherein the strict constraint means that other nodes are not allowed to exist between the previous node and a designated passing resource, while the loose constraint means that other nodes are allowed to exist between the previous node and a designated passing resource); the total hop limit; hop first; link cost first, and no constraint, etc.
Conventional passing-type constraint is processed in a manner of segmentation. For example, for a constraint condition that is required to pass a designated node or link, firstly the routing from the head node to the designated resource is computed, and then the routing from the designated resource to the tail node is computed, and the above two routings are connected end to end to obtain the final result. However, such a method has a very low processing efficiency, and meanwhile cannot ensure the correctness of the routing computation result in some cases, and the condition that the routing cannot be found or the routing that has been found is not the optimal routing may occur.
The technical problem to be solved in the present invention is to provide a method and an apparatus for generating a constraint based routing, which can ensure the correctness of the routing computation result.
In order to solve the above problem, the present invention provides a method for generating a constraint based routing, which comprises:
when computing a routing with a constraint condition, directly computing paths from a head node to a tail node of the routing, and comparing the paths that are computed with the constraint conditions of the routing, and adding one or more paths which satisfy the constraint condition of the routing to a result set of routing computation.
Said step of directly computing paths from the head node to the tail node of the routing comprises: computing the paths one by one in a sequence of decreasing priorities starting from an optimal path according to priorities of the paths.
In said step of directly computing paths from the head node to the tail node of the routing, a K shortest path algorithm is adopted.
After said step of directly computing paths from the head node to the tail node of the routing, in the comparing step, once a path is computed, the path is compared with the constraint conditions of the routing starting from the optimal path,
if the constraint condition is satisfied, the path is added to the result set in the adding step until all paths are computed or an upper limit of a capacity of the result set is reached.
In order to solve the above problem, the present invention further provides an apparatus for generating a constraint based routing, which comprises a path computation module, a comparison module and a storage module;
the path computation module is configured to: directly compute paths from a head node to a tail node of a routing, and send the paths that are computed to the comparison module;
the comparison module is configured to: compare the paths computed by the routing computation module with a constraint condition of the routing, and store the paths which satisfy the constraint conditions to the storage module;
the storage module is configured to: store results of routing computation.
The routing computation module is configured to: compute the paths one by one in a sequence of decreasing priorities starting from an optimal path according to priorities of the paths when directly computing the paths from the head node to the tail node of the routing.
The routing computation module is configured to: adopt a K shortest path algorithm when directly computing the paths from the head node to the tail node of the routing.
The routing computation module is configured to: once a path is computed starting from the optimal path, send to the path to the comparison module for comparison.
With the present invention, when a routing query request with constraint conditions is processed, phenomena of omission or error can be avoided, i.e., the path is bound to be found as long as there is a path satisfying conditions, and meanwhile the efficiency of routing computation is increased. In an example, routings can also be computed based on priorities by using the K Shortest Path (KSP) algorithm to find one optimal result or N results sequenced according to priorities.
Specific examples of the present invention will be described below. A method for computing a routing with constraint conditions based on a K shortest path (KSP) algorithm is provided in the examples of the present invention.
The KSP algorithm is a method for computing a routing that can provide a result of multiple paths sequenced based on priorities, and this method can be used to provide a list of k alternate routings, wherein various paths are sequenced based on priorities.
The constraint conditions for computing a routing are one or more of the following conditions:
passing a certain node; passing a certain link; avoiding a certain node; avoiding a certain link; separating shared risk link groups; separating from a designated link (the above constraint conditions support the strict constraint and the loose constraint, wherein the strict constraint means that other nodes are not allowed to exist between the previous node and a designated passing resource, while the loose constraint means that other nodes are allowed to exist between the previous node and a designated passing resource); the total hop limit; hop first; link cost first, and no constraint, etc.
The example of the present invention comprises the following steps:
computing paths from a head node to a tail node of the routing one by one using a KSP algorithm, and obtaining the optimal path, the secondary optimal path, the third optimal path, . . . , until the kth optimal path in sequence;
once a path has been computed, comparing the constraint conditions of the routing with the path, and if it is judged that this path satisfies the constraint conditions of the routing, storing the path into a result set of routing computation, otherwise, discarding the path;
repeating the above two steps until all the paths satisfying the constraint conditions are computed or the number of paths in the result set reaches a set upper limit of the capacity of the result set.
It would be easily appreciated that the path may be compared with the constraint conditions of the routing after all paths from the head node to the tail node of the routing are computed, and the paths satisfying the constraint conditions are then stored into the result set of routing computation in other examples. Besides, the algorithm in the above example may obtain the computation result without having to compute all paths, which has a relatively high efficiency. In addition, the method for computing a routing is not limited to the KSP algorithm, and the problem that the path cannot be computed even though there are paths satisfying the constraint conditions due to the existing segmentation computation method can be avoided as long as a path from the head node to the tail node is computed and then is compared with the constraint conditions of the routing directly.
Specific application examples of the present invention will be described below with reference to the accompanying drawings, wherein the constraint condition of the passing node is taken as an example, and it is supposed that only one node is passed.
As shown in
If a conventional routing computation method is used, firstly, the routing from the head node to the passing node is computed, and then the routing from the passing node to the tail node is computed, and lastly the two segments of routings are connected together to form the final routing result. By taking
However, correct computation results can be obtained using the method adopted in the present invention. As shown in
firstly, an optimal path from node 1 to node 6 is computed using the KSP algorithm, obtaining a path of nodes 1, 3, 6;
then the computation result obtained in the above step is compared with the constraint condition which requires passing node 5, and the path of nodes 1, 3, 6 does not satisfy the condition and thus is discarded;
afterwards the next optimal path is sought, i.e., a secondary optimal path from node 1 to node 6 is computed, and a path of nodes 1, 2, 4, 5, 3, 6 is obtained;
the secondary optimal path is compared with the constraint condition, the secondary optimal path of nodes 1, 2, 4, 5, 3, 6 passes node 5 and thus satisfies the constraint condition, and the computation result is added to a result set;
if the upper limit of the result set is not reached, the above steps are repeated until all paths are computed; in this example, the third optimal path from node 1 to node 6 is computed, a result of null is obtained, and then the computation ends, a final result of nodes 1, 2, 4, 5, 3, 6 is obtained, and the routing computation succeeds.
Correspondingly, the present example provides an apparatus for generating a constraint based routing, and the apparatus comprises a path computation module, a comparison module and a storage module, as shown in
The path computation module is used to compute paths from a head node to a tail node of the routing. In this example, the paths are computed one by one starting from the optimal path using a KSP algorithm, and once a path is computed, it is sent to the comparison module for comparison. However, in other examples, all paths may be computed at one time and are then collectively sent to the comparison module for comparison.
The comparison module is used to compare the results computed by the routing computation module with constraint conditions of the routing, and store the routings which satisfy the constraint conditions to the storage module;
the storage module is used to store the results of routing computation.
This apparatus may be a Path Computation Entity (PCE), whose related service flow may be as follows: a PCE performs computation after receiving a routing computation request with constraint conditions initiated by a Path Computation Client (PCC), and returns results to the PCC.
Although the above examples are used to describe the present invention, they are not intended to limit the present invention, and for those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall fall into the protection scope of the present invention.
With the present invention, when a routing query request with constraint conditions is processed, phenomena of omission or error can be avoided, i.e., the path is bound to be found as long as there is a path satisfying conditions, and meanwhile the efficiency of routing computation is increased. In an example, routings can also be computed based on priorities by using the K Shortest Path (KSP) algorithm to find one optimal result or N results sequenced according to priorities.
| Number | Date | Country | Kind |
|---|---|---|---|
| 200910148673.0 | Jun 2009 | CN | national |
| Filing Document | Filing Date | Country | Kind | 371c Date |
|---|---|---|---|---|
| PCT/CN2010/072202 | 4/26/2010 | WO | 00 | 12/17/2011 |