• No results found

A position-based compaction algorithm using MIP formulation.

Input \force"

f

i for polygon

i

(

i

= 1

;:::;N

); /*

f

i's are constants */

Assign a positional variable

p

i for polygon

i

(

i

= 1

;:::;N

);

do

L

:= the list of all pairs of polygons;

S

:= ;; /* S is the set of linear constraints generated so far */

foreach

pair of polygons (

P;Q

) in

L

do

Compute

P

(

Q

);

Find a convex coveringC 1,

C 2,

:::

,

Ck of

P

(

Q

);

Assign a Boolean variable

B

i forCi (1

i



k

);

S

0 := the MIP constraints generated from

Ci (1

i



k

) according to (8.2);

S

:=

S

[

S

0;

Add the constraintP

ki=1

B

i = 1;

end

foreach

polygon

P

do

S

1 := the non-overlapping constraints between

P

the boundaries of the container;

S

:=

S

[

S

1;

end

Set up a mixed integer program maximize P

Ni=1

f

i 

p

i

subject to

S

;

Get the set of new positions

p

i (

i

= 1

;:::;N

) by solving the mixed integer program;

Place polygon

i

at

p

i (

i

= 1

;:::;N

);

until

the objective function P

Ni=1

f

i



p

i stops increasing.

It follows from the algorithm that the following theorem holds.

Theorem 8.2

A feasible solution to the MIP model built in the above algorithm gives a non- overlapping placement of the polygons in the container. Conversely, from a non-overlapping placement of the polygons, we can obtain a feasible solution to the MIP model.

The following theorem is the main result of this section.

Theorem 8.3

The position-based compaction algorithm using MIP formulation solves the two-dimensional strip packing problem2 for non-convex polygons.

Figure 8.4: Length cannot be shortened without exchanging the positions of the polygons

Proof:

As before, we view the right boundary of the container as the front-end of a \piston" piece and assign a positional variable

p

N+1 to it. The constraints of the polygons

with the container ensure that every polygon lies to the left of the piston piece. The objective function of the MIP model becomes

minimize

p

N+1

:

Let

l

 be the length of the optimal solution of a two-dimensional strip packing problem.

Since the optimal solution of the two-dimensional strip packing is also a non-overlapping placement of the polygons, from the previous theorem it has a corresponding feasible so- lution of the MIP model. Therefore,

p



N+1, the optimal solution of the MIP model for a

layout, is of equal or lesser length than

l

. But

p



N+1 cannot be smaller since it is already

optimal. Therefore

p



N+1 equals

l

.

2

We note here that in the solution of the MIP model two polygons can exchange positions, attaining positions which might not be possible given only continuous motion of the two polygons. Therefore the optimal solution of the MIP model is foremost the optimal solution of the two-dimensional strip packing problem. Whether it is also an optimal solution to the compaction problem depends on whether there is continuous motion that translates the polygons from their initial positions to the positions given by the optimal solution of the MIP. If such a continuous motion does not exist, then the optimal solution to the compaction may have longer length than the optimal solution to the strip packing. As we shall see in the next chapter, nding the optimal solution to compaction is harder than nding the optimal solution to strip packing.

For example, for the layout shown in Figure 8.1(a), the optimal solution for strip packing is also a solution for compaction because we can push polygon

Q

all the way to the left. However, for the layout shown in Figure 8.4, exchanging the position of the two polygons,

Figure 8.5: Example of nding optimal compaction using MIP formulation

which is the only way to improve the length of the layout, can not be achieve by continuous coordinated motion of the two polygons.

Figure 8.5 shows an example of nding the optimal compaction using the position-based compaction with MIP formulation.

8.2.1 Algorithms for Finding Convex Covering

We now specify how to construct the convex subsetsCi (1

i



k

) which cover the free

space

P

(

Q

). The general problem of decomposing of polygon into minimal number of

convex polygons has been studied in computational geometry. There exists a polynomial time algorithm to decompose a simple polygon into minimal the number of convex poly- gons [Kei85]. Note that a linear number of convex polygons is sucient since triangulation is a convex decomposition.

For simplicity, we assume that

P

(

Q

) does not have holes. To apply the existing

algorithms, we make a rectangle that contains

P

(

Q

). The rectangle is made suciently

large such that we will not encounter the need to place

q p

outside the rectangle during the Compaction/Packing algorithm. We then take out

P

(

Q

) from the rectangle. The result

is a polygon with a hole that approximates

P

(

Q

). We can use a simple transformation

to convert the polygon with a hole to a simple polygon and then decompose the converted simple polygon. If

P

(

Q

) has multiple holes, the process is similar.

a convex covering of the whole free space

P

(

Q

). The algorithm proceeds as follows.

Let us number the edges of

P

(

Q

) as

e

1

;e

2

;:::;e

L. We start from edge

e

1. We use

e

1

as a starting edge in the locality heuristic to nd a convex subset. Once a convex subset is found, we output the subset and mark all the edges that appear in subset. Then, we start from the next unmarked edge and use it as the starting edge of the next convex subset. We stop when all the edges have been marked. In the worst case, such an algorithm runs in