Re: Help! - rectangle packing problem
- From: David Kinny <dnk@xxxxxxxxxxxxxxxx>
- Date: Tue, 19 Jun 2007 13:26:24 GMT
In <1182234140.728635.299230@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> snow <rok.sibanc@xxxxxxxxx> writes:
On Jun 19, 5:41 am, ihinayana <edward...@xxxxxxxx> wrote:
Description:
Given a group of rectangles with different integer width and
height,such as 5*4, 2*3,1*7,etc. The total number of rectangles is
like 10 or more.The problem is how to find a bigger rectangle with a
minimal area which can hold all those given ones. To fix them in,those
rectangles can be rotated with 90 degree and the order is regardless.
Did anybody solve a similar problem?
I was a part of circle packing online competition once, which sounds
very similar.
So you have to place your squares somewhere - x,y coordinates of let
say bottom left corner and also determine rotation.
So your genome would be N times (x,y,angle) where N is the number of
rectangles.
Now for your containing rectangle you will have to find: min x, max x,
min y, max y of all rectangles.
And you have to minimize this rectangle area.
Your fitness also has to take into account possible overlapping areas!
Just add some error for overlapping area.
Simple combinatorial problems like these can be solved to obtain
exact solutions with no need for the complexity of GA's, although they
of course present a perfect opportunity for playing around with them.
All that's needed here is backtracking search. As a trivial example,
suppose the blocks are 5*4, 2*3, and 1*7.
Sum the areas of the rectangles to get the the minimum area that could
hold them all if they fitted together with no gaps, namely 33 units,
then round this up to a multiple of the longest side of any of the
component rectangles, namely 7, so start with a 7*5 rectangle. Now
explore the possible packings of the rectangles into this boundary;
in this trivial case they actually fit. Otherwise, expand the
rectangle to consider 7*6, 7*7, 7*8, 7*9, 8*8, 7*10, 8*9, etc.
HTH,
David
.
- Follow-Ups:
- Re: Help! - rectangle packing problem
- From: ihinayana
- Re: Help! - rectangle packing problem
- From: Prophet
- Re: Help! - rectangle packing problem
- References:
- Help! - rectangle packing problem
- From: ihinayana
- Re: Help! - rectangle packing problem
- From: snow
- Help! - rectangle packing problem
- Prev by Date: Re: Help! - rectangle packing problem
- Next by Date: Re: Help! - rectangle packing problem
- Previous by thread: Re: Help! - rectangle packing problem
- Next by thread: Re: Help! - rectangle packing problem
- Index(es):
Relevant Pages
|
|