similarity matching optimization