[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

rectangles in rectangle problem

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 5
Thread images: 2

ANY GENIUS HERE?
we have n x m grid and a x b rectangles
how to determine if we're able to cover whole grid with these rectangles, and if not what is the biggest ammount of rectangles which would fit?

algorithm/code would be very helpful?
thanks


halp me pls
>>
all rectangles are the same size
>>
I believe that this is the criteria for tiling the whole grid, but correct me if I'm wrong.

Each of a and b must divide either n or m (they may divide the same number or different numbers). If they divide the same number, say a | n and b | n, then you must have m = ax + by for some non negative integers x,y.
>>
Engineer here (sorry).
Does this help?http://www.rmig.com/en/technical+info/formulae/calculation+open+area
>>
>>7778243
Do all the rectangles have the same size?
If they do than it's easy. max(floor(m/b)*floor(n/a), floor(m/a)*floor(n/b)) is the maximum number of rectangles can fit in the m x n grid.
Then you can just fit all of those rects into the grid, if there is any empty space left, then it's impossible to cover the grid with those a x b rectangles.

If the rectangles are not equal in size, then I have a bad news for you.
https://en.wikipedia.org/wiki/Cutting_stock_problem
To get the optimal solution, you have to run the algorithm for quite a long time.
Thread posts: 5
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.