An optimization approach to the similarity criteria of flows and its application