code: public int getOrCreateVarIndex(final Variable var) {
          Integer index = this.name2idx.get(var.name());
          if (index == null) {
              index = this.name2idx.size() + 1;
              this.name2idx.put(var.name(), index);
              this.idx2name.put(index, var.name());
          }
          return index;
      }
docs: Returns the existing internal solver index for a variable or creates a new one if the variable is yet unknown.
  @param var the variable
  @return the (old or new) internal variable index