docs: def setStateCodes(self):    
          """                
          Generates (sorted) codes for the states in the statespace
          This is used to quickly identify which states occur after a transition/action
          """
  
          #calculate the statespace and determine the minima and maxima each element in the state vector     
          statespace      = self.statespace()     
          self.minvalues  = np.amin(statespace,axis=0)
          self.maxvalues  = np.amax(statespace,axis=0)
          
          #calculate the largest number of values and create a state code        
          statesize       = statespace.shape[1]  
          largestRange    = 1+np.max(self.maxvalues-self.minvalues) 
          self.statecode  = np.power(largestRange, np.arange(statesize),dtype=int) 
     
          #Calculate the codes, sort them, and store them in self.codes
          codes           = self.getStateCode(statespace)         
          sorted_indices  = np.argsort(codes)
          self.codes      = codes[sorted_indices]  
          if np.unique(self.codes).shape != self.codes.shape:
              raise "Non-unique coding of states, results are unreliable"
              
          #For the end results, it is useful to put the indices and corresponding states in a dictionary        
          mapping = OrderedDict()
          for index,state in enumerate(statespace[sorted_indices]):
              mapping[index]  = state    
              
          self.mapping        = mapping