Getting someone out of your thoughts.

After being a relationship with someone, I am having trouble getting them out of my thoughts. I miss the person and my mind wants to think about the memories, the good times, the bad times, resolve the unanswered questions, etc. I want to move on and not miss them or have continual thoughts about them. Please advise.