Turbomachinery has been widely used in the energy systems as an energy conversion device, such as gas turbine and aero-engine. The losses in the turbomachinery, especially in the multi-stage conditions, restrict the energy conversion efficiency and corresponding fuel economy. Previous studies show that non-axisymmetric endwall could be used to decrease the losses in compressors, but the real effects in the rig tests are usually inconsistent with the numerical simulation. In this paper, a shroud profiled endwall optimization method with the strategy of local loss as the objective function is proposed, aiming at reducing the tip loss of an embedded stator under the operating point. The traditional total loss coefficient and four local loss functions are studied to investigate how the objective functions influence the optimization results. Three optimized endwall geometries are tested in the embedded test platform. It showed that the strategy of loss coefficient above 90% span as the objective function was best at decreasing the stator loss in the tip region as well as the whole span. Under this strategy, the loss above 90% span was suppressed by 48.17% and the loss of the whole span decreased 9.27%, which proved the PEW optimization design method with the strategy of local loss as the objective function is potential.