parameters: (self, lb, ub, domain=None, index=None, Name=None)
return_statement: return idx
docstring: Creates a variable in the variable list for the XML. If the domain
          has already been specified it uses the previously specified domain.
          Otherwise it also creates a domain, automatically reducing sequencial
          numbers in the domain to intervals
docstring_summary: Creates a variable in the variable list for the XML. If the domain
          has already been specified it uses the previously specified domain.
          Otherwise it also creates a domain, automatically reducing sequencial
          numbers in the domain to intervals
docstring_tokens: Creates a variable in the variable list for the XML . If the domain has already been specified it uses the previously specified domain . Otherwise it also creates a domain automatically reducing sequencial numbers in the domain to intervals
function: def create_variable(self, lb, ub, domain=None, index=None, Name=None):
          """
          Creates a variable in the variable list for the XML. If the domain
          has already been specified it uses the previously specified domain.
          Otherwise it also creates a domain, automatically reducing sequencial
          numbers in the domain to intervals
          """
  
          if domain is None:
              domain = [lb,ub]
  
          dom_string = ""
  
          if index is None:
              idx = self.__local_var_idx
              self.__local_var_idx += 1
          else:
              idx = index
              self.__local_var_idx = index + 1
  
          d_idx = len(self.__domains)
  
          nbvalues = 0
          dom_list = []
          if len(domain) == 2:
              nbvalues = len(list(range(lb, ub+1)))
              if lb != ub:
                  dom_list.append("%d..%d" % (lb, ub))
              else:
                  dom_list.append(str(ub))
          else:
              clean_domain = []
              for i in set(domain):
                  if i not in clean_domain:
                      clean_domain.append(i)
              domain = sorted(clean_domain)
              nbvalues = len(domain)
              for interval in change_to_intervals(domain):
                  if interval[0] != interval[1]:
                      dom_list.append("%d..%d" % (interval[0], interval[1]))
                  else:
                      dom_list.append("%d" % interval[0])
  
          dom_string += "\n\t<domain name=\"D%d\" nbValues=\"%d\">\n\t\t" % (
                  d_idx, nbvalues)
  
          dom_list_string = " ".join(dom_list)
          dom_string += dom_list_string
  
          dom_string += "\n\t</domain>\n"
  
          if self.dom_map.get(dom_list_string) is None:
              self.dom_map[dom_list_string] = d_idx
              self.__domains.append(dom_string)
          else:
              d_idx = self.dom_map.get(dom_list_string)
  
          var_string = "\t<variable name=\"V%d\" domain=\"D%d\"/>" % (idx, d_idx)
          if Name is not None and Name != "x":
              var_string += "\t<!-- %s -->" % Name
          var_string += "\n"
  
          self.__variables.append(var_string)
          return idx
function_tokens: def create_variable ( self , lb , ub , domain = None , index = None , Name = None ) : if domain is None : domain = [ lb , ub ] dom_string = "" if index is None : idx = self . __local_var_idx self . __local_var_idx += 1 else : idx = index self . __local_var_idx = index + 1 d_idx = len ( self . __domains ) nbvalues = 0 dom_list = [ ] if len ( domain ) == 2 : nbvalues = len ( list ( range ( lb , ub + 1 ) ) ) if lb != ub : dom_list . append ( "%d..%d" % ( lb , ub ) ) else : dom_list . append ( str ( ub ) ) else : clean_domain = [ ] for i in set ( domain ) : if i not in clean_domain : clean_domain . append ( i ) domain = sorted ( clean_domain ) nbvalues = len ( domain ) for interval in change_to_intervals ( domain ) : if interval [ 0 ] != interval [ 1 ] : dom_list . append ( "%d..%d" % ( interval [ 0 ] , interval [ 1 ] ) ) else : dom_list . append ( "%d" % interval [ 0 ] ) dom_string += "\n\t<domain name=\"D%d\" nbValues=\"%d\">\n\t\t" % ( d_idx , nbvalues ) dom_list_string = " " . join ( dom_list ) dom_string += dom_list_string dom_string += "\n\t</domain>\n" if self . dom_map . get ( dom_list_string ) is None : self . dom_map [ dom_list_string ] = d_idx self . __domains . append ( dom_string ) else : d_idx = self . dom_map . get ( dom_list_string ) var_string = "\t<variable name=\"V%d\" domain=\"D%d\"/>" % ( idx , d_idx ) if Name is not None and Name != "x" : var_string += "\t<!-- %s -->" % Name var_string += "\n" self . __variables . append ( var_string ) return idx