implemented cost() and applicable() methods for CTPProblem. Fixed some memory leaks