rewrite cost function for swapping slots for preference satisfaction