Implement cp solver