Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Non-graph layout optimisation (Read 2076 times)
TimNZ
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Feb 23rd, 2009
Non-graph layout optimisation
Apr 20th, 2010 at 3:22am
Print Post  
Hi, this is not graph related but I'm struggling here..

Can I use Diagramming to solve this:

Given a maximum dimension of 2800x2800 pixels per diagram, minimize the number of diagrams to contain X number of different shaped squares (nodes) without node overlap (obviously).

This is a 'pure' layout optimisation, no nodes are connected.

If I can't do it with diagramming, I'm after any c# code that will do it.

I'm on 5.3.3

Cheers,
Tim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Non-graph layout optimisation
Reply #1 - Apr 20th, 2010 at 7:18am
Print Post  
Hi Tim,

If you need to minimize the diagram size, try running any of the layout algorithms with MultipleGraphsPlacement set to MiminalArea. For this to work you must also set SplitGraph = true for layouts that support this property, and there shouldn't be any links between the nodes.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
TimNZ
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Feb 23rd, 2009
Re: Non-graph layout optimisation
Reply #2 - Apr 20th, 2010 at 7:16pm
Print Post  
Not quite, but I've now discovered I'm trying to solve a 2D version of the 'Bin Packing' problem.

http://en.wikipedia.org/wiki/Bin_packing_problem

Surprisingly, sample code is hard to find.

Cheers,
Tim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Non-graph layout optimisation
Reply #3 - Apr 20th, 2010 at 8:13pm
Print Post  
The algorithms look easy enough, and you could still use the MinimialArea layout feature to determine whether the currently tested node would fit into a diagram.

So you loop over a list of nodes, an internal loop adds them to a diagram and runs MinimalArea layout. Then you accept the current node in the current diagram if GetContentBounds is smaller than your max size. If it's larger, you try the next diagram in the list, and if no diagram accommodates the node, create a new one for it.

The problem is we have never optimized the MinArea layout for frequent use, and this will probably be very slow.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint