adds solve function to Problem class