Resource coordination in wireless sensor networks by cooperative reinforcement learning