Skip to content

Commit

Permalink
fixation simulation heavywatal#15
Browse files Browse the repository at this point in the history
  • Loading branch information
hamazaki1990 committed May 3, 2017
1 parent 3f93381 commit 07407b7
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions hamazaki1990/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from individual import Individual
from population import Population


Expand All @@ -16,16 +14,45 @@ def get_heterogeneity(Population):


def simulate_fixwf(Population):
cnt = 1
cnt = 0
while get_heterogeneity(Population):
Population = Population.next_genwf()
Population.next_genwf()
Population.print_ids()
cnt += 1
print(Population._inds)
else:
print(cnt)


def simulate_fixmo(Population):
cnt = 0
while get_heterogeneity(Population):
Population.next_genmo()
Population.print_ids()
cnt += 1
else:
print(cnt)


p = Population(5)
p.print_ids()
print(get_heterogeneity(p))
cnt = 1
while get_heterogeneity(p):
p.next_genwf()
p.print_ids()
print(get_heterogeneity(p))
print(cnt)
cnt += 1
winner = p._inds[0]
print(winner.get_id())

p1 = Population(5)
p1.print_ids()
print(get_heterogeneity(p1))
simulate_fixwf(p1)


p2 = Population(5)
p2.print_ids()
print(get_heterogeneity(p2))
simulate_fixmo(p2)

0 comments on commit 07407b7

Please sign in to comment.