Skip to content

Commit

Permalink
Fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bata committed Feb 18, 2020
1 parent bb7a950 commit a7205c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/quadratic_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ def quadratic(x1, x2):

def main():
cma_es = CMA(mean=np.zeros(2), sigma=1.3)
print(" g f(x1,x2) x1 x2 ")
print("=== ========== ====== ======")

for generation in range(50):
solutions = []
for _ in range(cma_es.population_size):
x = cma_es.ask()
value = quadratic(x[0], x[1])
solutions.append((x, value))
print("#{g} {value} (x1={x1}, x2 = {x2})".format(

msg = "{g:3d} {value:10.5f} {x1:6.2f} {x2:6.2f}".format(
g=generation, value=value, x1=x[0], x2=x[1],
))
)
print(msg)
cma_es.tell(solutions)


Expand Down

0 comments on commit a7205c0

Please sign in to comment.