本文整理汇总了Python中Simulator.Simulator.genPoints方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.genPoints方法的具体用法?Python Simulator.genPoints怎么用?Python Simulator.genPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.genPoints方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doT1nT2n
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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
示例2: doT1pT2p
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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
示例3: doT2P
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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
示例4: doT2Number
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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
示例5: doT1P
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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
示例6: testSimulator
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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
示例7: doT1nT2n
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import genPoints [as 别名]
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