Adaptive coordination of working-memory and reinforcement learning in non-human primates performing a trial-and-error problem solving task