In triangle $ABC$, let $I$ be the incenter of triangle $ABC$. The line through $I$ parallel to $BC$ intersects $AB$ and $AC$ at $M$ and $N$, respectively. If $AB = 5$, $AC = 5$, and $BC = 8$, then find the perimeter of triangle $AMN$.

Let $s$ be the semiperimeter of triangle $ABC$, so $s = \frac{AB + AC + BC}{2} = 9$. As shown below, let $D$ and $E$ be the feet of the perpendiculars from $I$ to $AB$ and $AC$, respectively, and let $F$ be the foot of the perpendicular from $D$ to $AC$. Similarly, let $G$ be the foot of the perpendicular from $E$ to $AB$. [asy]

unitsize(1 cm);

pair A, B, C, D, E, F, G, I, M, N;

A = (0,0);
B = (3,4);
C = (10,0);
I = incenter(A,B,C);
D = (A + I)/2;
E = (C + I)/2;
F = (2*D + I)/3;
G = (2*E + I)/3;
M = extension(A,B,I,I + (10,8)/3);
N = extension(A,C,I,I + (10,8)/3);

draw(A--B--C--cycle);
draw(A--I--C);
draw(D--F);
draw(E--G);

label("$A$", A, S);
label("$B$", B, N);
label("$C$", C, NE);
label("$D$", D, NW);
label("$E$", E, NE);
label("$F$", F, S);
label("$G$", G, SW);
label("$I$", I, NW);
label("$M$", M, N);
label("$N$", N, NE);
[/asy]

Since $\angle BID$ and $\angle CIE$ are right angles, quadrilaterals $DIIM$ and $EIIN$ are cyclic. We can find the radius of the circumcircle of triangle $DIIM$ by drawing the perpendicular bisectors of $IM$ and $ID$, as shown below. We can find the radius of the circumcircle of cyclic quadrilateral $DIIM$ by drawing the perpendicular from the center of this circumcircle to $IM$, as shown below. [asy]
unitsize(1 cm);

pair D, I, M, O, P;

D = (0,0);
M = (1,0);
I = (1,0.8);
O = (1/2,0);
P = (1,0);

draw(Circle(O,1/2));
draw(M--P);

label("$D$", D, SW);
label("$M$", M, S);
label("$I$", I, N);
label("$O$", O, SW);
[/asy]

Since angle $MDP$ is right, we have $MP = \frac{DI}{2} = \frac{IN}{2}$, so the radius of the circumcircle of triangle $DIIM$ is $\frac{DN}{2}$. Similarly, the radius of the circumcircle of triangle $EIIN$ is $\frac{DM}{2}$. It follows that triangles $DEM$ and $DEN$ are 8-15-17 triangles, so triangles $DMN$ and $DEN$ are 3-4-5 triangles, as shown below. [asy]
unitsize(1 cm);

pair A, B, C, D, E, F, N, L, M;

A = (0,0);
B = (3,4);
C = (8,0);
D = (A + B)/2;
E = (A + C)/2;
F = (B + C)/2;
N = extension(B,C,D,D + 5*dir(F - D));
L = extension(B,C,E,E + 4*dir(F - E));
M = extension(A,L,B,C);

draw(A--B--C--cycle);
draw(A--D);
draw(A--E);
draw(D--M);
draw(E--N);

label("$A$", A, SW);
label("$B$", B, NW);
label("$C$", C, NE);
label("$D$", D, NW);
label("$E$", E, S);
label("$F$", F, SE);
label("$N$", N, NE);
label("$L$", L, N);
label("$M$", M, S);
label("$s - b = \frac{9}{2} - \frac{5}{2} = 2$", (B + D)/2, NW);
label("$s - c = \frac{9}{2} - \frac{4}{2} = 2.5$", (C + E)/2, SW);
label("$2.5$", (E + L)/2, SW);
label("$2 + 2.5 = 4.5$", (M + N)/2, NE);
[/asy] Hence, the perimeter of triangle $AMN$ is $AM + MN + NA = \boxed{4.5}$.

Notice that $4.5$ is small compared to $18$, which is the perimeter of triangle $ABC$. This is because $MN$ is parallel to $BC$, so triangle $AMN$ is similar to triangle $ABC$.

To find the perimeter of triangle $AMN$, we need to know the lengths of sides $AM$ and $AN$.

Let's start by finding the length of segment $AM$. Since $IM$ is parallel to $BC$, we can use the Intercept Theorem.

The Intercept Theorem states that if two or more parallel lines intersect two transversals, then they divide these transversals proportionally.

Since $IM$ is parallel to $BC$, using the Intercept Theorem, we have $\frac{BI}{IM} = \frac{BC}{CM}$.

Since $I$ is the incenter of triangle $ABC$, $BI$ and $CI$ bisect angles $ABC$ and $ACB$ respectively. Therefore, $\angle BIC = 90^{\circ} + \frac{1}{2} \angle ABC$ and $\angle CIM = 90^{\circ} + \frac{1}{2} \angle ACB$.

Hence, $\angle BIM = \angle CIM$ (as they form a straight angle).

So, we have $\triangle BIM \cong \triangle CIM$ by ASA congruency (using congruent angles and the equal angles in the triangle).

Then, $BM=CM$ and so $BM=\frac{BC}{2}=4$.

Since $AB=5$, $AM=AB-BM=5-4=1$.

Now, let's find the length of segment $AN$.

Using similar reasoning, we can find that $CN$ is also equal to $BC/2 = 4$.

Therefore, $AC=AN-CN=5-4=1$.

Now we can calculate the perimeter of triangle $AMN$.

The perimeter is given by $AM + AN + MN$.

Substituting the values we found, we have $1 + 1 + MN$.

To find $MN$, we can use the fact that $MN$ is parallel to $BC$.

Again using the Intercept Theorem, we have $\frac{BI}{IN} = \frac{BC}{CN}$.

Since $BI$ and $CI$ bisect angles $ABC$ and $ACB$ respectively, $\angle BIN = \angle CIN$ (because they form a straight angle).

Hence, $\triangle BIN \cong \triangle CIN$ by ASA congruency.

It follows that $BN = CN$, so $BN = 4$.

Since $AB = 5$, $AN = AB - BN = 5 - 4 = 1$.

Now, using the fact that $BC = 8$, we can find $MN$ as $MN = BC = 8$.

Therefore, the perimeter of triangle $AMN$ is $AM + AN + MN = 1 + 1 + 8 = 10$.

Hence, the perimeter of triangle $AMN$ is $\boxed{10}$.

To determine the perimeter of triangle $AMN$, we can start by finding the lengths of $AM$ and $AN$.

Since $M$ and $N$ lie on the line parallel to $BC$ passing through $I$, we can conclude that triangles $BIN$ and $CIM$ are similar to triangle $ABC$, by the property that corresponding angles between parallel lines are equal.

Let $BN = x$. Since triangle $BIN$ is similar to triangle $ABC$, we can set up the following proportional relationship:

\[\frac{BI}{BA} = \frac{BN}{BC}.\]

Substituting the given values, we have:

\[\frac{BI}{5} = \frac{x}{8}.\]

Similarly, using triangle $CIM$, we can set up the following proportional relationship:

\[\frac{CI}{CA} = \frac{CM}{CB}.\]

Again, substituting the given values, we have:

\[\frac{CI}{5} = \frac{(5 - x)}{8}.\]

Solving these two equations for $BI$ and $CI$, we find $BI = \frac{5}{8}x$ and $CI = \frac{5(5 - x)}{8}$.

Since $I$ is the incenter of triangle $ABC$, we know that $BI$ and $CI$ are both inradii of triangle $ABC$. Therefore, $BI = CI = r$, where $r$ is the inradius of triangle $ABC$.

Using the formula $A = rs$, where $A$ is the area of a triangle, $r$ is the inradius, and $s$ is the semi-perimeter, we can find the inradius $r$ in terms of the lengths $a$, $b$, and $c$ of the sides of the triangle:

\[r = \sqrt{\frac{(s - a)(s - b)(s - c)}{s}}.\]

Plugging in the given values $AB = 5$, $AC = 5$, and $BC = 8$, we find $s = \frac{5 + 5 + 8}{2} = 9$. Therefore,

\[r = \sqrt{\frac{(9 - 5)(9 - 5)(9 - 8)}{9}} = \sqrt{\frac{16}{9}} = \frac{4}{3}.\]

Since $BI = r = \frac{4}{3}$, we have:

\[\frac{5}{8}x = \frac{4}{3}.\]

Solving for $x$, we find $x = \frac{32}{15}$.

Therefore, $BN = \frac{32}{15}$, and $AN = 5 - BN = 5 - \frac{32}{15} = \frac{63}{15}$.

The perimeter of triangle $AMN$ is $AM + AN + MN$. Since $AB = 5$, and $AM = AN$, we have $AM = \frac{63}{15}$. Therefore, the perimeter of triangle $AMN$ is $AM + AN + MN = \frac{63}{15} + \frac{63}{15} + \frac{32}{15} = \frac{158}{15}$.