handling of duplicates in optimization