title: How to implement Q-learning to approximate an optimal control?
body: <p>I am interested in implementing Q-learning (or some form of reinforcement learning) to find an optimal protocol. Currently, I have a function written in Python where I can take in the protocol or "action" and "state" and returns a new state and a "reward". However, I am having trouble finding a Python implementation of Q-learning that I can use in this situation (i.e. something that can learn the function as if it is a black box). I have looked at OpenAI gym but that would require writing a new environment. Would anyone know of a simpler package or script that I can adopt for this?</p>
  
  <p>My code is of the form: </p>
  
  <pre><code>def myModel (state, action, param1, param2):
      ...
      return (state, reward)
  </code></pre>
  
  <p>What I am looking for would be an algorithm of the form:</p>
  
  <pre><code>def QLearning (state, reward):
      ...
      return (action)
  </code></pre>
  
  <p>And some way to keeping the actions that transition between states. If anyone has any idea where to look for this, I would be very excited!</p>