Pratition rectangle into smaller ones containig exactly 1 point, maximize wastelands area

荒凉一梦 提交于 2019-12-04 14:31:25

问题


Given a rectangle R containing P points, orthogonal with axes, points are natural numbers.

Parcel is a rectangle which:

  • is totally inside R
  • sides are orthgonal with axes
  • contains exactly ONE point inside
  • its sides must be adjacent to sides of R or contain point(s) from P

Find an algorithm to find all possible parcels inside R, so their total area is minimal (maximize wastelands area).

Example: One of many ways of division, 5 points(*), 2 parcels

    R
|-----------------------------------------------|
|                   |                   |       |
|                   |                   |   *   |
|                   *                   |       |
|                   |                   *       |
|                   |               *   |       |
|                   |                   |       |
|                   |                   |       |
|                   |-----------*-------|       |
|    wastelands                         |       |
|                                       |       |
|                                       |       |
|-----------------------------------------------|

Firstly, lets skip optimizing(max/min). Is there any good way to partition a rectangle?

Edit

It looks like it might be NP-hard. I got some feedback from initiator of this problem and finding all possible parcels is pointless. I think the only way is to use some heuristic (e.g. finding biggest parcels or parcels which sides contain most of points) and check the results.


回答1:


I can think of a backtracking and exponentially hard method for starters. You pick your points in some order and each time do either of the following:

1- Decide to pass a vertical line 2- Decide to pass a horizontal line 3- Decide to ignore

Until you end-up with 3^n different cases.

For your own application, you could think of applying some bounding conditions at each iteration, e.g., verify if you have ended up with a parcel with no point inside, then backtrack.




回答2:


Brute force is to find for each point all possible rectangles that contain that point (in inside) and solve exact cover set problem on collection of all rectangles.

To find all rectangles that contain given point is 'relatively' simple :-)

Start with a rectangle that have maximal one side. E.g. for point (a,b) rectangle with maximal y side is one that has vertical boundaries on points which x coordinate is nearest to a (from both sides) and horizontal boundaries are on R. That is not case if there is other point(s) with x coordinate equal a, but that will only move horizontal boundary to the nearest point in y direction.

Next rectangle has to have smaller y side, that means that boundary point (B) that was used for vertical boundary in shorter rectangle is used for horizontal boundary. Point for vertical boundary is choose from point from same side as B to support rectangle constraints (create rectangle, no other point in rectangle area.)



来源:https://stackoverflow.com/questions/20362658/pratition-rectangle-into-smaller-ones-containig-exactly-1-point-maximize-wastel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!