Path integral formulation of effective nonlinear media