modify sat++ algorithm