optimization + z_function