def run(self):
        CSVFile = ReadCSV.ReadCSV(self.filePath, 3600, self.bbox)
        CSVFile.ReadCSV()
        items = CSVFile.items
        longIndex = CSVFile.title.index("Long")
        latIndex = CSVFile.title.index("Lat")
        colTimeIndex = CSVFile.title.index("CREATED_AT_LOCAL")
        beginTime = datetime.strptime(items[0][colTimeIndex],
                                      '%Y-%m-%d %H:%M:%S')
        endTime = datetime.strptime(items[len(items) - 1][colTimeIndex],
                                    '%Y-%m-%d %H:%M:%S')
        self.Grid(self.bbox, self.spanX, self.spanY, items, longIndex,
                  latIndex)

        # for i in range(10):
        #     print items[i]
        # print longIndex, latIndex
        # return

        ODMatrix = []
        neigh = {}
        for i in range(0, len(items)):
            neigh[i] = [-1, -1]
        tempItems = list(items[0:self.b])
        ODMatrix, neigh = CSVFile.ConstructODMatrix(tempItems, ODMatrix, neigh,
                                                    0, self.b)
        left, top, right, bottom, ratio = Utility.GetLTRB(
            self.bbox, self.scene)
        pen = QtGui.QPen(QtGui.QColor(GlobalParameters.PredictNodeBrushColor))
        brush = QtGui.QBrush(
            QtGui.QColor(GlobalParameters.PredictNodeBrushColor))

        for i in range(0, self.b):
            x, y = items[i][longIndex], items[i][latIndex]
            X, Y = Utility.ConvertPostion2(float(x), float(y), ratio, left,
                                           bottom, self.bbox[0], self.bbox[1])
            point = QtGui.QGraphicsEllipseItem(X, Y, GlobalParameters.NodeSize,
                                               GlobalParameters.NodeSize)
            point.setBrush(brush)
            point.setPen(pen)
            self.emit(
                QtCore.SIGNAL(
                    "AddItemToScene(PyQt_PyObject, QString, QString)"), point,
                "P", str(len(items) + i))

        for i in range(self.b, len(items)):
            # current NNR
            t = datetime.strptime(items[i][colTimeIndex], '%Y-%m-%d %H:%M:%S')
            t = GlobalParameters.RegressiontotalT * Utility.DeltaTime(
                t, beginTime) / Utility.DeltaTime(endTime, beginTime)
            currentNNR = self.params[0] * pow(t, 3) + self.params[1] * pow(
                t, 2) + self.params[2] * t + self.params[
                    3]  # call function to get this value

            minDiff = GlobalParameters.Infinite
            minDiffKey = None
            # select best position for next record
            if i % 10 == 0:
                minDiffKey = random.choice(self.fillGrid.keys())
            else:
                for key in self.fillGrid.keys():
                    tempODMatrix = list(ODMatrix)
                    tempNeigh = dict(neigh)
                    record = list(items[i])
                    record[longIndex], record[latIndex] = self.fullGrid[key]
                    tempItems.append(record)
                    tempODMatrix, tempNeigh = CSVFile.ConstructODMatrix(
                        tempItems, tempODMatrix, tempNeigh, i, i + 1)
                    tempItems.pop(len(tempItems) - 1)
                    NNR = CSVFile.NearestNeighborRatio(
                        tempODMatrix, tempNeigh,
                        GlobalParameters.RegressionArea)
                    v = abs(NNR - currentNNR)
                    if v < minDiff:
                        minDiff = abs(NNR - currentNNR)
                        minDiffKey = key
                        if v < 0.0001:
                            break
            record = list(items[i])

            record[longIndex], record[latIndex] = self.fullGrid[minDiffKey]
            print "Position1:", record[len(record) - 2], record[len(record) -
                                                                1]
            record[len(record) - 2], record[len(record) -
                                            1] = minDiffKey.split("_")
            print "Position2:", record[len(record) - 2], record[len(record) -
                                                                1]
            #print tempItems[len(tempItems) -1]
            tempItems.append(record)
            #print tempItems[len(tempItems) -1]
            ODMatrix, neigh = CSVFile.ConstructODMatrix(
                tempItems, ODMatrix, neigh, i, i + 1)

            print record[longIndex], record[latIndex]
            # output new point on the map
            x, y = record[longIndex], record[latIndex]
            x = x + (random.random() - 0.5) * self.spanX
            y = y + (random.random() - 0.5) * self.spanY
            X, Y = Utility.ConvertPostion2(x, y, ratio, left, bottom,
                                           self.bbox[0], self.bbox[1])
            point = QtGui.QGraphicsEllipseItem(X, Y, GlobalParameters.NodeSize,
                                               GlobalParameters.NodeSize)
            point.setBrush(brush)
            point.setPen(pen)
            self.emit(
                QtCore.SIGNAL(
                    "AddItemToScene(PyQt_PyObject, QString, QString)"), point,
                "P", str(len(items) + i))

        k1 = len(items[0])
        k2 = len(tempItems[0])
        # print items[0], tempItems[0]
        # k3 = len(items)
        # k4 = len(tempItems)
        #print "K1,2,3,4:", k1, k2, k3, k4
        count = 0
        for i in range(len(items)):
            print items[i][k1 -
                           2], tempItems[i][k2 -
                                            2], items[i][k1 -
                                                         1], tempItems[i][k2 -
                                                                          1]
            if items[i][k1 - 2] == tempItems[i][k2 - 2] and items[i][
                    k1 - 1] == tempItems[i][k2 - 1]:
                count += 1
        print count
        ##########      ^&&*  ##############
        self.emit(QtCore.SIGNAL("FinshedRun(QString)"),
                  "Simulation is finished!")