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

后端 未结 2 934
面向向阳花
面向向阳花 2021-02-11 06:10

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

Parcel is a rectangle which:

  • is totally inside
相关标签:
2条回答
  • 2021-02-11 06:35

    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.)

    0 讨论(0)
  • 2021-02-11 06:50

    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.

    0 讨论(0)
提交回复
热议问题