This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm using AStarPathfinder like this: public class CustomConnection : FlowDiagramConnection
This pathfinder is good, but often make a collisions like shown in attached image. You can see that 3 connection arranged in one line. I want that connections were allocated on small distance from each other.
|
|
|
Hello Indeed this would be great to have. The current version of the A* pathfinder only considers node collisions when creating the paths. I have increased the priority of this feature, but not sure when we will be able to produce this. - Jason |
|
|
Are there any news? |
|
|
Hello shuraz Sorry for the long wait. I have looked into this now and have updated the AStarPathfinder to greatly minimise overlapping parallel connections. This update will be available through the nightly builds from tomorrow the 5th of August. The AStarPathfinder now has a new constructor where you can pass in the desired separation distance between parallel connections. Start by using a small value such as 6, and then increase or decrease it if desired. Now rather than using AStarPathfinder.Instance, you can create a new instance with the custom connection separation value. Make sure that all connection instances return the same AStarPathfinder instance. You could create a static or constant variable in your custom connection class to store this AStarPathfinder instance. Let us know how well this update works for you and if there are any significant performance issues. - Jason |
|
|
Thanks for the update, I see improvement. But problems still remain, see attached file.
In custom connection class i write this code:
private static readonly IPathfinder _pathfinder = new AStarPathfinder(20);
public override IPathfinder Pathfinder { get { return _pathfinder; } }
|
|
|
Hello shuraz There are some situations where the A* pathfinder will fail to find a collision free route. In these situations, a fall-back pathfinder is used so that the connection can still have a path to follow. From what I can see in your image, all the overlaps you have pointed out seem to be using the fall-back pathfinder. The overlap on the left of your image may be caused by the connection-seperation value you are using. The algorithm is trying to keep 20 pixels (at 100% zoom) between each connection, but here there is not enough room and so it settles for overlapping the connections. To solve this, you could try using a smaller connection seperation value for now, or move the top trapezium node further to the right to see if the problem is solved. Let me know what you find here. Not sure what's happening to the other overlaps, I havn't been able to reproduce these. I can't see why the A* pathfinder would fail to find a collision free route here. One thing to note is that the connection paths are only re-calculated when either the source or destination nodes are moved. Moving some other node to overlap a connection will not cause that connection to be re-caculated. If you are able to send me a sample that demonstrates these overlaps I'll be able to investigate it more easily. - Jason |
|
|
At last, I was able to create a test project, which is very similar to the real one. Bad 1 : to the left of the node #5 a lot of space, the overlap of the connections are not needed. Bad 2 : connections cross the node #8
I see source code, and see line in AStarPathfinder.cs: while (openSet.Count > 0 && count < 1000) if I change the last number from 1000 to 10000, the diagram is getting better, but the program is running slower
|
|
|
Hello shuraz Thanks for the sample it is helping a lot. I have modified some parts of the algorithm to improve the connection routing. I'm currently looking at improving the performance where possible and will get back to you soon. |
|
|
Hello All the improvements I have made to the A* pathfinder will be available through the nightly builds from tomorrow the 12th of August. I have reduced the possibility of connections overlapping nodes, further reduced overlapping parallel connections, and also improved the performance overall. Moving node '9' in your demo is still a bit slow due to having so many connections that it needs to update. Let us know how it goes. |
|
|
If change left coordinate of node '5' to 300 i see bad picture.
var node5 = new CustomNode(Edge.Left) { Bounds = new Rect(300, 10, 200, 100), Data = "5" };
|
|
|
Hello Thanks for pointing this out. I have fixed a bug which solves this issue and many others. This update will be available through the nightly builds from tomorrow the 16th of August. |
|
|
Thank you, Jason. Unfortunately not everything works as it should be. 1. this problem reappeared http://www.mindscapehq.com/forums/Post.aspx?ThreadID=4318&PostID=15197 Connections segments are deserialized, UpdateConnectionPointCalculators called, and then pathfinder reconstructs the path. I can even see for my eyes good deserialized segments, then all connections are rebuilt. This occurs in a fraction of a second 2. AStarPathfinder makes too tangled connections. See attached file. 3. Is it possible to delete or straightening of the excess segments of the connection? For example, i select unnecessary mover and press "shift-delete" key. |
|
|
Hello 1. I havn't been able to reproduce this. Since you are seeing this issue unfold within a fraction of a second, it suggests that a dispatcher is involved. Do you have any dispatcher calls that could be causing this issue? Send me a repro if the problem remains. 2. I have seen such tangled scenarios before too. I partly know why this is ocurring, but it will take some further research and experimentation to fully solve this, so not sure when we can have this updated for you at this stage. 3. This would be a nice little feature. I'll look into how feasable this will be when I have time. - Jason |
|
|
1. Thank you, I found a forgotten dispatcher in my code. 2,3. Thank you, I hope you do not forget about your regular customer :)
|
|
|
Good to hear you got number 1 fixed. I'll be away for most of this week, so there will be a delay with getting the other issues started. - Jason |
|
|
Hello I have recently looked into improving the A* pathfinder. In your scenario, the A* pathfinder tries to minimize the number of parallel connection overlaps, and also minimize the number of corners in the connection path. To do this, the algorithm applies a cost penalty to these characteristics when constructing possible paths. Unfortunitly, these cost penalties can conflict with each other. If the cost penalty for putting a corner in the path is too high, then the algorithm will find that it's cheaper to overlap some of the connections. Or if the cost penalty for overlapping connections is too high, then the paths can end up with lots of corners. This is what is causing the tangled connections. I have tried to balance out the cost functions and have produced better results, but I havn't been able to make it perfect. You can download this update through the nightly builds from tomorrow the 30th of August. Let me know if you see better, worse or unchanged results in terms of the tangled connections. This update will also include a HeuristicFunction property on the AStarPathfinder. You can either set this to be one of the common heuristic functions found in the HeuristicFunctions class, or create your own functions if you know any that might work well. Different heuristic functions can change the outcome of the path routing, but it is not gauranteed that a particular function will produce perfect results. As for deleting / straightening excess segments, we do not provide a way to do this and I wouldn't recomend it in the UI. Once a connection is re-routed due to moving a node, more excess segments could be generated anyway. - Jason |
|
|
Thank you, Jason. I see a better picture of all time. |
|
|
Jason, let me return to this issue. I have built a huge diagram which contains a lot of nodes and connection. I have arranged all the connection manually. If I add a new connection all the existing connections will be rearranged automatically. Is there any way to remain the existing connections unchanged? Shuraz. |
|
|
Hello Shuraz In the next nightly build, the AStarPathfinder will respect the IsUserModified property on connections. Once you've manually arranged a connection, set the IsUserModified property on that connection to true, then when the AStarAlgorithm runs, it will ignore those such connections. Keep in mind that the framework will automatically set this property back to false in some situations such as if a node moves in a way that a "User Modified" connection path no longer works. Jason Fauchelle |
|
|
How can I detect when user arranged a connection manually ? Is there any event? |
|
|
Hello shuraz To listen to when the user modifies a connection, you can attach an event handler to the DiagramSurface like this:
And the event handler would look like this:
Then in the event handler, check that e.OriginalSource is an instance of ConnectionSegmentThumb. Jason Fauchelle |
|
|
By chance I have found that this code was already present in the file DiagramSurface.cs in the function OnSegmentMoved.
So I need not change anything in my code, do I? |
|
|
That is correct, the DiagramSurface sets the IsUserModified property when the user modifies a connection path. Jason Fauchelle |
|