def doT1nT2n(self, Community_Coordinate):
        nPnt = 10  #1000
        nLink = 11  #40

        tests = ""
        s = Simulator(nPnt)
        s.genPoints(Community_Coordinate)
        #s.genRandomLinks(nLink*nPnt)

        return s.pAll

        ##        f2=    open('doT1nT2n2.txt', 'w')
        ##        for i in range(0,100):
        ##            for j in range(0,i+1):
        ##                nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
        ##                print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
        ##                f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
        ##                tests=tests+str(nSteps)+"\t"
        ##            for j in range(i,101):
        ##                tests=tests+"0\t"
        ##            tests=tests+("\n")
        ##        f = open('doT1nT2n.txt', 'w')
        ##        f.write(tests)

        return
Esempio n. 2
0
    def doT1pT2p(self):
        nPnt = 1000
        nLink = 40
        nT1 = 40
        nT2 = 20
        tests = ""
        s = Simulator(nPnt)
        s.genPoints()
        s.genRandomLinks(nLink * nPnt)

        f2 = open('doT1pT2p2.txt', 'w')
        for i in range(0, 101):
            for j in range(0, i + 1):
                nSteps = self.MutiTimesNoGen(s, 1, nT1, nT2, 0.01 * i,
                                             0.01 * j)
                print str(i) + "\t" + str(j) + "\t" + str(nSteps)
                f2.write(str(i) + "\t" + str(j) + "\t" + str(nSteps) + "\n")
                tests = tests + str(nSteps) + "\t"
            for j in range(i, 101):
                tests = tests + "0\t"
            tests = tests + ("\n")
        f = open('doT1pT2p.txt', 'w')
        f.write(tests)

        return
    def doT1nT2n(self,Community_Coordinate):
        nPnt= 10   #1000
        nLink= 11  #40
        
        tests=""
        s=Simulator(nPnt)
        s.genPoints(Community_Coordinate)
        #s.genRandomLinks(nLink*nPnt)

        return s.pAll
        
        
##        f2=    open('doT1nT2n2.txt', 'w')
##        for i in range(0,100):
##            for j in range(0,i+1):   
##                nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
##                print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
##                f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
##                tests=tests+str(nSteps)+"\t"
##            for j in range(i,101):  
##                tests=tests+"0\t"
##            tests=tests+("\n")    
##        f = open('doT1nT2n.txt', 'w')
##        f.write(tests)
                  
        return    
 def doT1pT2p(self):
     print Community_Coordinate
     nPnt=1000
     nLink=40
     nT1=40
     nT2=20
     tests=""
     s=Simulator(nPnt)
     s.genPoints()
     s.genRandomLinks(nLink*nPnt) 
     
     f2 = open('doT1pT2p2.txt', 'w')               
     for i in range(0,101):     
         for j in range(0,i+1):   
             nSteps=self.MutiTimesNoGen(s,1,nT1,nT2,0.01*i,0.01*j)
             print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
             f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
             tests=tests+str(nSteps)+"\t"
         for j in range(i,101):  
             tests=tests+"0\t"
         tests=tests+("\n")    
     f = open('doT1pT2p.txt', 'w')
     f.write(tests)
               
     return       
Esempio n. 5
0
 def doT2P(self):
     tests = []
     s = Simulator(1000, 40)
     s.genPoints()
     s.genLinks()
     for i in range(10, 51):
         nSteps = self.MutiTimesNoGen(s, 1, 20, 0.5, 0.01 * i)
         print str(i * 0.01) + "\t" + str(nSteps)
         tests.append(nSteps)
     print tests
     return
Esempio n. 6
0
 def doT2Number(self):
     tests = []
     s = Simulator(1000, 40, 1)
     s.genPoints()
     s.genRandomLinks(40)
     for i in range(10, 31):
         nSteps = self.MutiTimesNoGen(s, 2, 30, i, 0.5, 0.2)
         print str(i) + "\t" + str(nSteps)
         tests.append(nSteps)
     print tests
     return
 def doT2P(self):
     tests=[]
     s=Simulator(1000,40)
     s.genPoints()
     s.genLinks()
     for i in range(10,51):        
         nSteps=self.MutiTimesNoGen(s,1,20,0.5,0.01*i)
         print str(i*0.01) +"\t"+str(nSteps)
         tests.append(nSteps)
     print tests               
     return         
 def doT2Number(self):            
     tests=[]
     s=Simulator(1000,40,1)
     s.genPoints()
     s.genRandomLinks(40)
     for i in range(10,31):        
         nSteps=self.MutiTimesNoGen(s,2,30,i,0.5,0.2)
         print str(i) +"\t"+str(nSteps)
         tests.append(nSteps)
     print tests               
     return 
Esempio n. 9
0
 def doT1P(self):
     tests = []
     s = Simulator(1000)
     s.genPoints()
     #s.genLinks(10*1000)
     s.genRandomLinks(10 * 1000)
     #s.setPointType(nOrigins, nLink1, nLink2, p1, p2)
     for i in range(20, 101):
         nSteps = self.MutiTimesNoGen(s, 1, 30, 10, 0.01 * i, 0.2)
         print str(i * 0.01) + "\t" + str(nSteps)
         tests.append(nSteps)
     print tests
     return
Esempio n. 10
0
 def doT1P(self):
     tests=[]
     s=Simulator(1000)
     s.genPoints()
     #s.genLinks(10*1000)
     s.genRandomLinks(10*1000)
     #s.setPointType(nOrigins, nLink1, nLink2, p1, p2)
     for i in range(20,101):        
         nSteps=self.MutiTimesNoGen(s,1,30,10,0.01*i,0.2)
         print str(i*0.01) +"\t"+str(nSteps)
         tests.append(nSteps)
     print tests               
     return 
Esempio n. 11
0
    def testSimulator(self):
        s = Simulator(10000, 5, 2, 1000, 2000)
        s.genPoints()
        s.genLinks()

        #plt.subplot(121)
        fig, axes = plt.subplots(1, 2, figsize=(12, 3))
        axes[0].scatter(s.getX1(1200),
                        s.getY1(1200),
                        s=10,
                        color='red',
                        alpha=0.5)
        axes[0].set_title("scatter")

        #         plt.plot(s.getX1(1200),s.getY1(1200),color='red', marker='o', markersize=20)
        #         plt.plot(s.getX2(1200),s.getY2(1200),'-',color='blue')
        #         plt.title('plot of y=x^2')

        #         for p in s.pAll:
        #             p
        s.goSimulate("a")

        s.printSummary()

        x2s = s.getX2(1200)
        y2s = s.getY2(1200)

        print(len(x2s))
        print(len(y2s))

        axes[1].scatter(x2s, y2s)

        axes[1].set_title("simulated")

        #         plt.subplot(122)
        #         plt.plot(s.getX1(1200),s.getY1(1200),'-',color='red')
        #         plt.plot(s.getX2(1200),s.getY2(1200),'-',color='blue')
        #         plt.title('plot of y=x^2')
        plt.savefig("beauty.png")
        plt.show()

        pass
Esempio n. 12
0
    def testSimulator(self):
        s=Simulator(10000,5,2,1000,2000)
        s.genPoints()
        s.genLinks()

        #plt.subplot(121)
        fig, axes = plt.subplots(1, 2, figsize=(12,3))
        axes[0].scatter(s.getX1(1200),s.getY1(1200),s = 10, color='red',alpha=0.5)
        axes[0].set_title("scatter")

        
#         plt.plot(s.getX1(1200),s.getY1(1200),color='red', marker='o', markersize=20)
#         plt.plot(s.getX2(1200),s.getY2(1200),'-',color='blue')
#         plt.title('plot of y=x^2')
        
#         for p in s.pAll:
#             p       
        s.goSimulate("a")
     
        s.printSummary()
        
        x2s=s.getX2(1200)
        y2s=s.getY2(1200)
        
        print(len(x2s))
        print(len(y2s))
        
        axes[1].scatter(x2s,y2s)
        
        axes[1].set_title("simulated")

        
#         plt.subplot(122)
#         plt.plot(s.getX1(1200),s.getY1(1200),'-',color='red')
#         plt.plot(s.getX2(1200),s.getY2(1200),'-',color='blue')
#         plt.title('plot of y=x^2')
        plt.savefig("beauty.png")      
        plt.show()  

        pass
Esempio n. 13
0
 def doT1nT2n(self):
     nPnt=1000
     nLink=40
     
     tests=""
     s=Simulator(nPnt)
     s.genPoints()
     s.genRandomLinks(nLink*nPnt)    
     f2=    open('doT1nT2n2.txt', 'w')
     for i in range(0,100):     
         for j in range(0,i+1):   
             nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
             print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
             f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
             tests=tests+str(nSteps)+"\t"
         for j in range(i,101):  
             tests=tests+"0\t"
         tests=tests+("\n")    
     f = open('doT1nT2n.txt', 'w')
     f.write(tests)
               
     return