DETERRENT: detecting trojans using reinforcement learning