**0**

# 2d bin packing + selective grouping of objects (?)

###
#1
Members - Reputation: **101**

Posted 04 December 2012 - 11:50 AM

Let me introduce myself, my name is Francisco and I'm an architecture student. I've recently become interested in algorithmic design, which is basically utilizing math to help design (an example would be structure or space optimization). To contextualize, I'm a noob with numbers, so as far as algorithmic architecture goes, I´ve just played with some tools that help with it (Rhino Grasshopper for example, which is a 3d parametric modeler).

I want to develop a software in which I input areas (represented by rectangles) and it organizes them and presents me various possible solutions to a floor plan. I will learn programming to try and develop this, but I have so little knowledge in programming that I don't know how to tackle the problem directly.

The problem consists in trying to group a bunch of rectangles in the least possible space (not within a container, no boundaries). at the same time, I want some of these rectangles to be closer to others, so there is a hierarchy of proximity between rectangles. For example, if I wanted various possibilites of a house floor plan, I'd input spaces such as kitchen, dinning room, living room, bedrooms, etc., and it would not only group them in little space, but also ubicate them according to desirable proximities (kitchen - dinning room for example) and viceversa.

So basically, it would be some sort of 2d bin packing, but is there a way to control how the objects "pack" so I have the desirable proximities between them?

Is it possible to develop a genetic algorithm with multiple fitnesses? so it searches for various solutions taking into consideration ALL of the desirable conditions (least total space, and all the proximity conditions between objects).

Thanks in advance, open to suggestions,ideas or anything.

###
#2
Crossbones+ - Reputation: **18618**

Posted 04 December 2012 - 12:18 PM

Is it possible to develop a genetic algorithm with multiple fitnesses? so it searches for various solutions taking into consideration ALL of the desirable conditions (least total space, and all the proximity conditions between objects).

I think this is the key of what you are asking. You need to combine your fitness functions into a single function, which expresses how satisfied you are with a hypothetical solution. This requires careful thought, but it's basically always possible. Then you need an optimization algorithm to find configurations that reach high values of your fitness function. Genetic algorithms are only one possibly optimization algorithm, and probably not my first choice here. But figuring out what you are optimizing for is much more important than how you optimize it.

In some contexts it helps to put a dollar value on things. For instance, imagine the value of a house is increased if the kitchen is close to the dining room, and if the bedrooms are far away from the washing machine. Put a dollar value on those things, and then design the floor plan that is worth the most money.

###
#3
Crossbones+ - Reputation: **1416**

Posted 04 December 2012 - 05:31 PM

You'll have to give an exact definition of "least possible space". A bunch of rectangles always takes the same area no matter how you put them down.The problem consists in trying to group a bunch of rectangles in the least possible space (not within a container, no boundaries).

This isn't a bin packing problem. Rather, it's akin to VLSI layout problems. Hardcore applied math and algorithm tuning, very challenging stuff. Here's a paper that has some discussion of alternative approaches and has a ton of citations and keywords with which you can find out more.

http://cs.stanford.e...181-merrell.pdf

I am heading towards a M.Sc. in computer science, and frankly this would be too painful for me at my current skill level. The challenge is in understanding the relevant math and CS theory; implementing/coding is easy in comparison, since in this application you don't need a fast implementation.

###
#4
Crossbones+ - Reputation: **18618**

Posted 04 December 2012 - 07:07 PM

You'll have to give an exact definition of "least possible space". A bunch of rectangles always takes the same area no matter how you put them down.The problem consists in trying to group a bunch of rectangles in the least possible space (not within a container, no boundaries).

Good point. The two obvious ones are the area of the convex hull and the area of the bounding axis-aligned rectangle.

I am heading towards a M.Sc. in computer science, and frankly this would be too painful for me at my current skill level. The challenge is in understanding the relevant math and CS theory; implementing/coding is easy in comparison, since in this application you don't need a fast implementation.

Getting started with optimization problems is not as hard as you might think. I give you two ideas.

For the first idea, you need a procedure to build a configuration step by step (adding a rectangle at a time), and then you can use some version of Monte Carlo search. As a first approach, throw all the rectangles at random a few million times and see what configuration gets the highest score. You can also collect statistics about the first steps and try promising steps more often. I have used the UCT algorithm for this kind of thing before.

The second idea is to use simulated annealing. If you have a way to make small changes to existing configurations (change the location of one rectangle?), you can get something working in a couple of hours.

###
#5
Crossbones+ - Reputation: **1416**

Posted 05 December 2012 - 10:53 AM

I don't think it's hard to get started with optimization problems. What I suspect is hard is designing and tuning an algorithm for the OP's question that produces actually useful results.Getting started with optimization problems is not as hard as you might think. I give you two ideas.

If you manage to find great ready-made solutions which just need to be implemented, that's a different matter.

###
#6
Crossbones+ - Reputation: **18618**

Posted 05 December 2012 - 10:59 AM

I don't think it's hard to get started with optimization problems. What I suspect is hard is designing and tuning an algorithm for the OP's question that produces actually useful results.Getting started with optimization problems is not as hard as you might think. I give you two ideas.

My experience has always been the opposite. If you know what you are optimizing for, it doesn't take much effort to put together an optimization algorithm that will produce useful results. When the results are not useful, it's usually because the fitness function wasn't properly described, and you need to think of ways to describe what you don't like about the solution as a term in the fitness function. After a few iterations, the results are usually perfectly good.