One critical validation is to verify that the user-defined constraints function does not create a dead-end in the search or training of Q-learning. The function constraints establish the list of states that can be accessed from a given state through actions. If the constraints are too tight, some of the possible search paths may not reach the goal state. Here is a simple validation of the constraints function:
def validateConstraints(numStates: Int, constraint: Int => List[Int]): Boolean = {require(numStates > 1, s"QLearning validateConstraints found $numStates states should be >1")!Range(0, numStates).exists(constraint(_).isEmpty)}