本文整理汇总了Python中simulation.Simulation.write方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.write方法的具体用法?Python Simulation.write怎么用?Python Simulation.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.Simulation
的用法示例。
在下文中一共展示了Simulation.write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import write [as 别名]
def main(argv):
R = 500
try:
opts, args = getopt.getopt(argv, "hr:", ["help", "reps="])
except getopt.GetoptError:
sys.exit(2)
for opt, arg in opts:
if opt in ('-h', '--help'):
usage()
sys.exit(2)
if opt in ('-r', '-replications'):
R = int(arg)
# Instantiate ruler ideology parameters
rid0 = float(np.random.beta(2, 2, 1))
rid1 = float(np.random.beta(2, 2, 1))
params0 = {'ideology': 1, 'quality': 0, 'seniority': 0}
params1 = {'ideology': 1, 'quality': 0, 'seniority': 0}
leonidasr = Ruler(rid0, params0)
spartar = Army(3, 3, 4, 30, [2, 4], leonidasr)
leonidasl = Ruler(rid1, params1)
spartal = Army(3, 3, 4, 30, [4, 2], leonidasl)
print('Replication: ruler0-params {}, \
ruler1-params {}'.
format(rid0,
rid1))
for oo in [True]:
# print 'Inits: {}, Ordered: {}'.format(params, oo)
population = Population().population
sargs = {'R': R, 'method': 'none'}
simp = Simulation(spartar, spartal, population, sargs)
simp.run()
simp.write()