In this talk, a hybrid optimization method is presented to maximize band gaps for photonic crystals with transverse magnetic and transverse electric waves simultaneously. The method is based on gradient flow and the gradient is computed from the discrete system. Since photonic crystals are usually made by two or more materials with specific shapes, we search the optimized parameters of the shapes. Some optimal configurations for different bands are shown.