# This function chooses at random which action to be performed within the range # of all the available actions. def ActionChoice(available_actions_range): if(sum(PossibleAction)>0): next_action = int(ql.random.choice(PossibleAction,1)) if(sum(PossibleAction)<=0): next_action = int(ql.random.choice(5,1)) return next_action # Sample next action to be performed action = ActionChoice(PossibleAction)