We propose and compare two new methods for synthesizing piecewise-uniform long period fiber gratings. The proposed methods, which employ the optimization algorithm based on the lattice filter model, are used to design the equalizer which compensates for the nonflat gain characteristics of the erbium-doped fiber amplifiers (EDFA). We have obtained design parameters of piecewise-uniform long period fiber gratings which fit the inverted erbium gain spectrum of a commercially available EDFA over the entire 1525 nm-1570 nm range. We analyze the sensitivity of the two proposed methods with respect to the parameter variations.