This class provides the cost penalties that are applied for violating restrictions during a PathSearch.
Remarks
The PathSearch calculates the shortest path from the source to the target, where shortest path means the path with the lowest costs. Costs result from violations of restrictions that are defined by the different PathSearchExtensions. This class defines penalties for the various violations. The PathSearch can be adapted to specific needs by varying these penalties. In order to avoid a certain violation, the appropriate penalty must be increased.
There are some predefined penalty settings which set a different focus for the path search: OPTIMIZATION_BALANCED, OPTIMIZATION_EDGE_BENDS, OPTIMIZATION_EDGE_LENGTHS and OPTIMIZATION_EDGE_CROSSINGS.
Default Values of Properties
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.router.PenaltySettings
See Also
Constructors
Creates a new instance of PenaltySettings.
Properties
Gets or sets the penalty for a crossing of two edges that are adjacent, that is, share a common node.
Remarks
This penalty only induces costs for crossings between edges that have a common end point, i.e., where one of the source/target nodes is equal. Crossings between non-adjacent edges are weighted using edgeCrossingPenalty. By default, avoiding crossing between adjacent edges is much more important and it is favored to introduce bends. Crossings between unrelated edges less expensive and a crossing is preferred over an additional bend.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
7
.See Also
Gets or sets the penalty for an edge bend.
Remarks
This penalty will make routes with many bends more expensive than routes with few or no bends. Hence, edges will have preferably few bends.
Increasing bend penalty will raise the importance of avoiding bends in relation to other penalties while decreasing this penalty will raise the importance of all other restrictions. A high bend penalty will result in routes that will preferably cross other edges instead of bending to avoid other edges. When increasing the edge bend penalty, the resulting routes will have more edge crossings.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
3
.1
) can lead to squiggles when the algorithm tries to avoid more expensive restrictions.Gets or sets the penalty for an edge bend being closer to the border of the source node, the target node or one of their ancestor group nodes than the minimum node to edge distance.
Remarks
This penalty will make routes that bend too close to their source or target node more expensive than routes that maintain the specified minimum node to edge distance.
Increasing the bends in node to edge distance penalty will raise the importance of avoiding bends that violate the minimum node to edge distance, while decreasing this penalty will raise the importance of all other restrictions. This penalty supports minimumNodeToEdgeDistance. In case the path search finally reaches the target node, the minimum node to edge distance for this node must be violated. Penalizing bends that are too close to the node forces the edge to directly cross this distance and connect to the node.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
10
.See Also
Gets or sets the penalty for a crossing of two edges.
Remarks
This penalty will make routes that cross many other edges more expensive than routes that cross few other edges or no edges at all. Hence, edges preferably won't cross other edges. Crossings between adjacent edges (edges having a common end node) are not covered by this penalty - their cost is defined by adjacentEdgeCrossingPenalty and, by default, they are more expensive.
Increasing the edge crossing penalty will raise the importance of avoiding edge crossings in relation to other penalties, while decreasing this penalty will raise the importance of all other restrictions. When increasing the edge crossing penalty, the resulting route will be longer and have more bends because crossing other edges needs to be avoided.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
1
.See Also
Gets or sets the penalty for an edge crossing an edge label.
Remarks
This penalty will make routes that cross edge labels of fixed edges more expensive than routes that avoid crossing edge labels, so edges won't preferably cross any edge labels that belong to fixed edges.
Increasing the edge label crossing penalty will raise the importance of avoiding edge labels crossings in relation to other penalties, while decreasing this penalty will raise the importance of all other restrictions. A high label crossing penalty will cause edges to bend more often to avoid passing straight through labels.
The crossing penalty can be weighted for each label individually using the LABEL_CROSSING_PENALTY_FACTOR_DP_KEY.
Use considerEdgeLabels to set whether edge labels should be considered when routing the edges.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
13
.See Also
Gets or sets the penalty for the edge length.
Remarks
This penalty will make long routes more expensive than short routes so edges will preferably be kept short.
Increasing the edge length penalty will raise the importance of short edges in relation to all other penalties while decreasing this penalty will raise the importance of all other restrictions. A high edge length penalty will result in routes that have less bends and more edge crossings to maintain the edge as short as possible.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
2
.Gets or sets the penalty for an edge crossing a group node.
Remarks
This penalty will make routes that cross group nodes more expensive than routes that avoid crossing group nodes. Hence, edges won't preferably cross any group nodes.
Increasing the group node crossing penalty will raise the importance of avoiding group node crossings in relation to other penalties, while decreasing this penalty will raise the importance of all other restrictions.
Default Value
60
.Gets or sets the penalty for an edge with a group ID that is not grouped at source or target side.
Remarks
This penalty will make routes for grouped edges that don't use partly the same path as the other edges in this group more expensive than routes that stick to the group.
Increasing the invalid edge grouping penalty will raise the importance of grouping edges with the same group ID, while decreasing this penalty will raise the importance of all other restrictions. As edge groups require that the route of an edge belonging to an edge group stays partly identical to the other edges of the group, the route may not be optimal with respect to the other restrictions. To maintain the edges together as long as possible, this penalty should be higher than most others.
Grouped edges have the same source or target group ID assigned in the data provider registered with the graph with the SOURCE_GROUP_ID_DP_KEY or TARGET_GROUP_ID_DP_KEY key.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
25
.See Also
Gets or sets the penalty for violations of the minimum distance between any two edges.
Remarks
This penalty will make routes that pass other edges too close more expensive than routes that maintain the specified minimum edge to edge distance.
Increasing the minimum edge to edge distance penalty will raise the importance of maintaining the minimum distance to other edges, while decreasing this penalty will raise the importance of all other restrictions. When this penalty has a high value, edges will maintain the specified distance. This may also reduce the number of edges that pass through a small channel between nodes. So, if such a channel is part of the shortest routes for many edges, some of them will take a longer way.
Use minimumEdgeToEdgeDistance to set the minimum distance for a certain edge to any other edge.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
5
.See Also
Gets or sets the penalty for violations of the minimum length of the first and last segment of an edge.
Remarks
This penalty will make routes whose first/last bend is too close to their source or target node more expensive than routes that maintain the specified minimum first/last segment length.
Increasing the minimum first last segment length penalty will raise the importance of maintaining the first and last segment as long as they fit the minimum first/last segment length, while decreasing this penalty will raise the importance of all other restrictions.
Use minimumFirstSegmentLength to set the minimum length of the first segment and minimumLastSegmentLength to set the minimum length of the last segment of a certain edge.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
12
.See Also
Gets or sets the penalty for violations of the minimum distance between any edge and any group node side.
Remarks
This penalty will make routes that pass group nodes too close more expensive than routes that maintain the specified minimum node to edge distance.
Increasing the minimum group node to edge distance penalty will raise the importance of maintaining the minimum distance to group nodes, while decreasing this penalty will raise the importance of all other restrictions. A high penalty for violating the minimum distance between edges and group nodes will produce edges that rather use a long route around group nodes to maintain the specified distance than pass through a small channel between two group nodes.
Use minimumNodeToEdgeDistance to set the minimum distance.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
10
.See Also
Gets or sets the penalty for violations of the minimum distance the edge shall maintain from node corners when entering or leaving the node.
Remarks
This penalty will make routes that end too close to the corner of their source or target node more expensive than routes that maintain the specified minimum node corner distance.
Increasing the node corner distance penalty will raise the importance of maintaining the minimum distance to the corner of the adjacent nodes, while decreasing this penalty will raise the importance of all other restrictions.
Use minimumNodeCornerDistance to set the minimum node corner distance for a certain edge.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
6
.See Also
Gets or sets the penalty for violations of the minimum distance between any edge and any normal node side.
Remarks
This penalty will make routes that pass too close to normal nodes more expensive than routes that maintain the specified minimum node to edge distance.
Increasing the minimum node to edge distance penalty will raise the importance of maintaining the minimum distance to nodes, while decreasing this penalty will raise the importance of all other restrictions. A high penalty for violating the minimum distance between edges and nodes will produce edges that rather use a long route around nodes to maintain the specified distance than pass through a small channel between two nodes.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
10
.See Also
Gets or sets the penalty for violating the monotonic path restrictions of an edge.
Remarks
This penalty will make routes with detours m ore expensive than routes that stay monotone.
Increasing the monotony violation penalty will raise the importance of avoiding detours in the specified direction, while decreasing this penalty will raise the importance of all other restrictions.
Use monotonicPathRestriction to set the monotonic path restrictions of a certain edge.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
14
.See Also
Gets or sets the penalty for an edge crossing a regular node.
Remarks
This penalty will make routes that cross normal nodes more expensive than routes that avoid crossing nodes. Hence, edges won't preferably cross any nodes.
Increasing the node crossing penalty will raise the importance of avoiding node crossings in relation to other penalties, while decreasing this penalty will raise the importance of all other restrictions.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
3000
.Gets or sets the penalty for an edge crossing a node label.
Remarks
This penalty will make routes that cross node labels more expensive than routes that avoid crossing node labels. Hence, edges won't preferably cross any node labels.
Increasing the node label crossing penalty will raise the importance of avoiding node labels crossings in relation to other penalties, while decreasing this penalty will raise the importance of all other restrictions. A high label crossing penalty will cause edges to bend more often to avoid passing straight through labels.
The crossing penalty can be weighted for each label individually using the LABEL_CROSSING_PENALTY_FACTOR_DP_KEY.
Use considerNodeLabels to set whether node labels should be considered when routing the edges.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
13
.See Also
Gets or sets the penalty for an edge leaving and reentering in the same partition grid cell.
Remarks
This penalty will make routes that re-enter the same partition grid cell more expensive than routes taking a more direct way.
Increasing the partition grid reentrance penalty will raise the importance of taking the most direct way through the partition grid, while decreasing this penalty will raise the importance of all other restrictions.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
7
.See Also
Gets or sets the penalty for an edge that crosses a fixed port location of another edge.
Remarks
This setting affects only ports that are not at the borders of the associated node. More specifically, affected ports are fixed external ports of other edges and fixed internal ports of edges at group nodes. Such ports are induced by a fixed PortCandidate or a strong PortConstraint).
This penalty will make routes that cross the mentioned ports more expensive than routes that avoid them. Hence, edges won't preferably cross those ports.
Increasing this penalty will raise the importance of avoiding port crossings in relation to other penalties, while decreasing this penalty will raise the importance of all other restrictions.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
13
.Gets or sets the penalty if an edge does not comply with its PortCandidates or PortConstraints.
Remarks
This penalty will make routes that start or end at a point that doesn't comply with its port constraints more expensive than routes that obey them.
Increasing the port violation penalty will raise the importance of maintaining port constraints, while decreasing this penalty will raise the importance of all other restrictions. It is recommended to have high penalties for port violation since the constraints lose purpose if they are disregarded.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
10000
.See Also
Gets or sets the penalty for a crossing of two segments that belong the same edge.
Remarks
This penalty only induces costs for crossings between edge segments that are part of the same actual edge. Avoiding such self-crossings is, by default, very important and associated with high costs. Therefore, it is recommended to only reduce this for very specific cases. The costs of other crossings can be controlled with properties edgeCrossingPenalty and adjacentEdgeCrossingPenalty.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
50
.See Also
Gets or sets the penalty for bends of a self-loop edge.
Remarks
This penalty will make self-loops leave and enter the node at different sides unless they are forced to one side by PortConstraints or PortCandidates.
Increasing this penalty will stronger enforce routing the self-loops between two sides of the node but it will also require more time for determining the edge path. Decreasing the penalty may result in self-loops that only connect to one side of the node.
By default this value is set to 9
. The value must be >= 0
, otherwise the default value will be assigned.
Gets or sets the penalty for deviating from the original edge path if the routing policy is set to SEGMENTS_AS_NEEDED.
Remarks
For other policies this value is ignored.
This penalty is mainly considered during a post-processing step that tries to correct the current route. For larger penalty values, the algorithm may remove tiny non-orthogonal segments. In addition, larger values make it more likely that the algorithm considers a non-orthogonal segment to be either vertical/horizontal and tries to fix the route accordingly.
The value must be greater than or equal to 0
, otherwise the default value will be assigned.
Default Value
4.5
.See Also
Methods
Creates a copy of this PenaltySettings instance.
Remarks
Returns
- ↪PenaltySettings
- a copy of this instance
Creates a new instance of PenaltySettings.
Remarks
Returns
- ↪PenaltySettings
- a specialized PenaltySettings
Constants
Optimization strategy that balances bends and edge crossings in the edge routes.
Remarks
Optimization strategy that minimizes bends in the edge routes.
Remarks
Optimization strategy that minimizes edge crossings in the edge routes.
Remarks
Optimization strategy that minimizes the length of the edge routes.