update assign algorithm.