  The paper is devoted to optimization of resonances associated with 1-D wave
equations in inhomogeneous media. The medium's structure is represented by a
nonnegative function B. The problem is to design for a given $\alpha \in \R$ a
medium that generates a resonance on the line $\alpha + \i \R$ with a minimal
possible modulus of the imaginary part. We consider an admissible family of
mediums that arises in a problem of optimal design for photonic crystals. This
admissible family is defined by the constraints $0\leq b_1 \leq B (x) \leq b_2$
with certain constants $b_{1,2}$. The paper gives an accurate definition of
optimal structures that ensures their existence. We prove that optimal
structures are piecewise constant functions taking only two extreme possible
values $b_1$ and $b_2$. This result explains an effect recently observed in
numerical experiments. Then we show that intervals of constancy of an optimal
structure are tied to the phase of the corresponding resonant mode and write
this connection as a nonlinear eigenvalue problem.
