.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/example_piecewise_target_function.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_example_piecewise_target_function.py: Example for evolutionary regression on a piecewise target function ================================================================== Example demonstrating the use of Cartesian genetic programming for regression on a piecewise target function by using the conditional (if/else) operator. .. GENERATED FROM PYTHON SOURCE LINES 8-31 .. code-block:: default # The docopt str is added explicitly to ensure compatibility with # sphinx-gallery. docopt_str = """ Usage: example_piecewise_target_function.py [--max-generations=] Options: -h --help --max-generations= Maximum number of generations [default: 2000] """ import functools import matplotlib.pyplot as plt import numpy as np from docopt import docopt import cgp args = docopt(docopt_str) .. GENERATED FROM PYTHON SOURCE LINES 32-36 We define a piecewise target function. The function applies different transformations to the input depending whether the input is less or greater than zero. Thus to achieve high fitness, an individual must make use of the if/else operator. .. GENERATED FROM PYTHON SOURCE LINES 36-40 .. code-block:: default def f_target(x): return np.select([x >= 0, x < 0], [x ** 2 + 1.0, -x]) .. GENERATED FROM PYTHON SOURCE LINES 41-44 Then we define the objective function for the evolution. It uses the mean-squared error between the output of the expression represented by a given individual and the target function evaluated on a set of pseudo-random points. .. GENERATED FROM PYTHON SOURCE LINES 44-73 .. code-block:: default def objective(individual, rng): """Objective function of the regression task. Parameters ---------- individual : Individual Individual of the Cartesian Genetic Programming Framework. rng: numpy.random.RandomState Returns ------- Individual Modified individual with updated fitness value. """ if not individual.fitness_is_None(): return individual n_function_evaluations = 1000 f = individual.to_numpy() x = rng.uniform(-5, 5, size=n_function_evaluations) y = f(x) loss = np.mean((f_target(x) - y) ** 2) individual.fitness = -loss return individual .. GENERATED FROM PYTHON SOURCE LINES 74-77 Next, we set up the evolutionary search. First, we define the parameters for the population, the genomes of individuals, and the evolutionary algorithm. .. GENERATED FROM PYTHON SOURCE LINES 77-125 .. code-block:: default population_params = { "n_parents": 1, "seed": 8188211, } genome_params = { "n_inputs": 1, "n_outputs": 1, "n_columns": 20, "n_rows": 1, "levels_back": None, "primitives": (cgp.IfElse, cgp.Mul, cgp.Add, cgp.Sub, cgp.ConstantFloat,), } ea_params = {"n_offsprings": 4, "mutation_rate": 0.03, "n_processes": 2} evolve_params = {"max_generations": int(args["--max-generations"]), "termination_fitness": 0.0} # create population that will be evolved pop = cgp.Population(**population_params, genome_params=genome_params) # create instance of evolutionary algorithm ea = cgp.ea.MuPlusLambda(**ea_params) # define callback for recording of fitness over generations history = {} history["fitness_champion"] = [] history["expr_champion"] = [] def recording_callback(pop): history["fitness_champion"].append(pop.champion.fitness) try: sympy_expression = pop.champion.to_sympy() except TypeError: sympy_expression = pop.champion.to_sympy(simplify=False) history["expr_champion"].append(sympy_expression) # the objective passed to evolve should only accept one argument, # the individual rng = np.random.RandomState(seed=population_params["seed"]) obj = functools.partial(objective, rng=rng) # Perform the evolution cgp.evolve(pop, obj, ea, **evolve_params, print_progress=True, callback=recording_callback) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [2/2000] max fitness: -60.37530355791968 [3/2000] max fitness: -60.37530355791968 [4/2000] max fitness: -60.37530355791968 [5/2000] max fitness: -59.374353284890255 [6/2000] max fitness: -59.374353284890255 [7/2000] max fitness: -59.374353284890255 [8/2000] max fitness: -49.32607773281381 [9/2000] max fitness: -49.32607773281381 [10/2000] max fitness: -49.32607773281381 [11/2000] max fitness: -49.32607773281381 [12/2000] max fitness: -49.32607773281381 [13/2000] max fitness: -49.32607773281381 [14/2000] max fitness: -49.32607773281381 [15/2000] max fitness: -49.32607773281381 [16/2000] max fitness: -49.32607773281381 [17/2000] max fitness: -49.32607773281381 [18/2000] max fitness: -49.32607773281381 [19/2000] max fitness: -49.32607773281381 [20/2000] max fitness: -49.32607773281381 [21/2000] max fitness: -49.32607773281381 [22/2000] max fitness: -49.32607773281381 [23/2000] max fitness: -49.32607773281381 [24/2000] max fitness: -49.32607773281381 [25/2000] max fitness: -49.32607773281381 [26/2000] max fitness: -49.32607773281381 [27/2000] max fitness: -19.441133982365407 [28/2000] max fitness: -19.441133982365407 [29/2000] max fitness: -19.441133982365407 [30/2000] max fitness: -19.441133982365407 [31/2000] max fitness: -19.441133982365407 [32/2000] max fitness: -19.441133982365407 [33/2000] max fitness: -19.441133982365407 [34/2000] max fitness: -19.441133982365407 [35/2000] max fitness: -19.441133982365407 [36/2000] max fitness: -19.441133982365407 [37/2000] max fitness: -19.441133982365407 [38/2000] max fitness: -19.441133982365407 [39/2000] max fitness: -19.441133982365407 [40/2000] max fitness: -19.441133982365407 [41/2000] max fitness: -19.441133982365407 [42/2000] max fitness: -19.441133982365407 [43/2000] max fitness: -19.441133982365407 [44/2000] max fitness: -19.441133982365407 [45/2000] max fitness: -19.441133982365407 [46/2000] max fitness: -19.441133982365407 [47/2000] max fitness: -19.441133982365407 [48/2000] max fitness: -19.441133982365407 [49/2000] max fitness: -19.441133982365407 [50/2000] max fitness: -19.441133982365407 [51/2000] max fitness: -19.441133982365407 [52/2000] max fitness: -19.441133982365407 [53/2000] max fitness: -19.441133982365407 [54/2000] max fitness: -19.441133982365407 [55/2000] max fitness: -19.441133982365407 [56/2000] max fitness: -19.441133982365407 [57/2000] max fitness: -19.441133982365407 [58/2000] max fitness: -19.441133982365407 [59/2000] max fitness: -19.441133982365407 [60/2000] max fitness: -19.441133982365407 [61/2000] max fitness: -19.441133982365407 [62/2000] max fitness: -19.441133982365407 [63/2000] max fitness: -19.441133982365407 [64/2000] max fitness: -17.18511881304988 [65/2000] max fitness: -17.18511881304988 [66/2000] max fitness: -17.18511881304988 [67/2000] max fitness: -17.18511881304988 [68/2000] max fitness: -17.18511881304988 [69/2000] max fitness: -17.18511881304988 [70/2000] max fitness: -17.18511881304988 [71/2000] max fitness: -17.18511881304988 [72/2000] max fitness: -17.18511881304988 [73/2000] max fitness: -17.18511881304988 [74/2000] max fitness: -17.18511881304988 [75/2000] max fitness: -17.18511881304988 [76/2000] max fitness: -17.18511881304988 [77/2000] max fitness: -17.18511881304988 [78/2000] max fitness: -17.18511881304988 [79/2000] max fitness: -17.18511881304988 [80/2000] max fitness: -17.18511881304988 [81/2000] max fitness: -17.18511881304988 [82/2000] max fitness: -15.386034940661414 [83/2000] max fitness: -15.386034940661414 [84/2000] max fitness: -15.386034940661414 [85/2000] max fitness: -14.682251683373266 [86/2000] max fitness: -14.682251683373266 [87/2000] max fitness: -14.682251683373266 [88/2000] max fitness: -4.743915352062022 [89/2000] max fitness: -4.743915352062022 [90/2000] max fitness: -4.743915352062022 [91/2000] max fitness: -4.743915352062022 [92/2000] max fitness: -4.743915352062022 [93/2000] max fitness: -2.751433564838307 [94/2000] max fitness: -2.751433564838307 [95/2000] max fitness: -2.751433564838307 [96/2000] max fitness: -2.751433564838307 [97/2000] max fitness: -1.5513084535507968 [98/2000] max fitness: -1.550222342086938 [99/2000] max fitness: -1.550222342086938 [100/2000] max fitness: -1.550222342086938 [101/2000] max fitness: -1.550222342086938 [102/2000] max fitness: -1.550222342086938 [103/2000] max fitness: -1.550222342086938 [104/2000] max fitness: -1.550222342086938 [105/2000] max fitness: -1.550222342086938 [106/2000] max fitness: -1.543968421382895 [107/2000] max fitness: -1.543968421382895 [108/2000] max fitness: -1.543968421382895 [109/2000] max fitness: -1.543968421382895 [110/2000] max fitness: -1.543968421382895 [111/2000] max fitness: -1.543968421382895 [112/2000] max fitness: -1.543968421382895 [113/2000] max fitness: -1.543968421382895 [114/2000] max fitness: -1.543968421382895 [115/2000] max fitness: -1.543968421382895 [116/2000] max fitness: -1.543968421382895 [117/2000] max fitness: -1.543968421382895 [118/2000] max fitness: -1.5281760563828624 [119/2000] max fitness: -1.5281760563828624 [120/2000] max fitness: -1.5281760563828624 [121/2000] max fitness: -1.5281760563828624 [122/2000] max fitness: -1.5281760563828624 [123/2000] max fitness: -1.5281760563828624 [124/2000] max fitness: -1.5281760563828624 [125/2000] max fitness: -1.5281760563828624 [126/2000] max fitness: -1.5281760563828624 [127/2000] max fitness: -1.5281760563828624 [128/2000] max fitness: -1.5281760563828624 [129/2000] max fitness: -1.5281760563828624 [130/2000] max fitness: -1.5281760563828624 [131/2000] max fitness: -1.5281760563828624 [132/2000] max fitness: -1.5281760563828624 [133/2000] max fitness: -1.5281760563828624 [134/2000] max fitness: -1.5281760563828624 [135/2000] max fitness: -1.5281760563828624 [136/2000] max fitness: -1.5281760563828624 [137/2000] max fitness: -1.5281760563828624 [138/2000] max fitness: -1.5281760563828624 [139/2000] max fitness: -1.5281760563828624 [140/2000] max fitness: -1.5281760563828624 [141/2000] max fitness: -1.5281760563828624 [142/2000] max fitness: -1.5281760563828624 [143/2000] max fitness: -1.5281760563828624 [144/2000] max fitness: -1.5281760563828624 [145/2000] max fitness: -1.5281760563828624 [146/2000] max fitness: -1.5281760563828624 [147/2000] max fitness: -1.5281760563828624 [148/2000] max fitness: -1.5281760563828624 [149/2000] max fitness: -1.5281760563828624 [150/2000] max fitness: -1.5281760563828624 [151/2000] max fitness: -1.5281760563828624 [152/2000] max fitness: -1.5281760563828624 [153/2000] max fitness: -1.5281760563828624 [154/2000] max fitness: -1.5281760563828624 [155/2000] max fitness: -1.5281760563828624 [156/2000] max fitness: -1.5281760563828624 [157/2000] max fitness: -1.5281760563828624 [158/2000] max fitness: -1.1620765375214828 [159/2000] max fitness: -1.1620765375214828 [160/2000] max fitness: -1.1620765375214828 [161/2000] max fitness: -1.1620765375214828 [162/2000] max fitness: -1.1620765375214828 [163/2000] max fitness: -1.1620765375214828 [164/2000] max fitness: -1.1620765375214828 [165/2000] max fitness: -1.1620765375214828 [166/2000] max fitness: -1.1620765375214828 [167/2000] max fitness: -1.1620765375214828 [168/2000] max fitness: -1.1620765375214828 [169/2000] max fitness: -0.9167917794236682 [170/2000] max fitness: -0.9167917794236682 [171/2000] max fitness: -0.9167917794236682 [172/2000] max fitness: -0.9167917794236682 [173/2000] max fitness: -0.9167917794236682 [174/2000] max fitness: -0.9167917794236682 [175/2000] max fitness: -0.9167917794236682 [176/2000] max fitness: -0.9167917794236682 [177/2000] max fitness: -0.9167917794236682 [178/2000] max fitness: -0.8862937490498334 [179/2000] max fitness: -0.8862937490498334 [180/2000] max fitness: -0.8862937490498334 [181/2000] max fitness: -0.8862937490498334 [182/2000] max fitness: -0.8862937490498334 [183/2000] max fitness: -0.8862937490498334 [184/2000] max fitness: -0.8862937490498334 [185/2000] max fitness: -0.8862937490498334 [186/2000] max fitness: -0.8862937490498334 [187/2000] max fitness: -0.8862937490498334 [188/2000] max fitness: -0.8862937490498334 [189/2000] max fitness: -0.8862937490498334 [190/2000] max fitness: -0.8862937490498334 [191/2000] max fitness: -0.8862937490498334 [192/2000] max fitness: -0.8862937490498334 [193/2000] max fitness: -0.8862937490498334 [194/2000] max fitness: -0.8862937490498334 [195/2000] max fitness: -0.8862937490498334 [196/2000] max fitness: -0.8862937490498334 [197/2000] max fitness: -0.8862937490498334 [198/2000] max fitness: -0.8862937490498334 [199/2000] max fitness: -0.8862937490498334 [200/2000] max fitness: -0.8862937490498334 [201/2000] max fitness: -0.8862937490498334 [202/2000] max fitness: -0.8862937490498334 [203/2000] max fitness: -0.8862937490498334 [204/2000] max fitness: -0.8862937490498334 [205/2000] max fitness: -0.8862937490498334 [206/2000] max fitness: -0.8862937490498334 [207/2000] max fitness: -0.8862937490498334 [208/2000] max fitness: -0.8862937490498334 [209/2000] max fitness: -0.8862937490498334 [210/2000] max fitness: -0.8862937490498334 [211/2000] max fitness: -0.8862937490498334 [212/2000] max fitness: -0.8862937490498334 [213/2000] max fitness: -0.8862937490498334 [214/2000] max fitness: -0.8862937490498334 [215/2000] max fitness: -0.8862937490498334 [216/2000] max fitness: -0.8862937490498334 [217/2000] max fitness: -0.8862937490498334 [218/2000] max fitness: -0.8862937490498334 [219/2000] max fitness: -0.8862937490498334 [220/2000] max fitness: -0.8862937490498334 [221/2000] max fitness: -0.8862937490498334 [222/2000] max fitness: -0.8862937490498334 [223/2000] max fitness: -0.8862937490498334 [224/2000] max fitness: -0.8862937490498334 [225/2000] max fitness: -0.8862937490498334 [226/2000] max fitness: -0.8862937490498334 [227/2000] max fitness: -0.8862937490498334 [228/2000] max fitness: -0.8862937490498334 [229/2000] max fitness: -0.8862937490498334 [230/2000] max fitness: -0.8862937490498334 [231/2000] max fitness: -0.8862937490498334 [232/2000] max fitness: -0.8862937490498334 [233/2000] max fitness: -0.8862937490498334 [234/2000] max fitness: -0.8862937490498334 [235/2000] max fitness: -0.8862937490498334 [236/2000] max fitness: -0.8862937490498334 [237/2000] max fitness: -0.8862937490498334 [238/2000] max fitness: -0.8862937490498334 [239/2000] max fitness: -0.8862937490498334 [240/2000] max fitness: -0.8862937490498334 [241/2000] max fitness: -0.8862937490498334 [242/2000] max fitness: -0.8862937490498334 [243/2000] max fitness: -0.8862937490498334 [244/2000] max fitness: -0.8862937490498334 [245/2000] max fitness: -0.8862937490498334 [246/2000] max fitness: -0.8862937490498334 [247/2000] max fitness: -0.8862937490498334 [248/2000] max fitness: -0.8862937490498334 [249/2000] max fitness: -0.8862937490498334 [250/2000] max fitness: -0.8862937490498334 [251/2000] max fitness: -0.8862937490498334 [252/2000] max fitness: -0.8862937490498334 [253/2000] max fitness: -0.8862937490498334 [254/2000] max fitness: -0.8862937490498334 [255/2000] max fitness: -0.8862937490498334 [256/2000] max fitness: -0.8862937490498334 [257/2000] max fitness: -0.8862937490498334 [258/2000] max fitness: -0.8862937490498334 [259/2000] max fitness: -0.8862937490498334 [260/2000] max fitness: -0.8862937490498334 [261/2000] max fitness: -0.8862937490498334 [262/2000] max fitness: -0.8862937490498334 [263/2000] max fitness: -0.8862937490498334 [264/2000] max fitness: -0.8862937490498334 [265/2000] max fitness: -0.8862937490498334 [266/2000] max fitness: -0.8862937490498334 [267/2000] max fitness: -0.8862937490498334 [268/2000] max fitness: -0.8862937490498334 [269/2000] max fitness: -0.8862937490498334 [270/2000] max fitness: -0.8862937490498334 [271/2000] max fitness: -0.8862937490498334 [272/2000] max fitness: -0.8862937490498334 [273/2000] max fitness: -0.8862937490498334 [274/2000] max fitness: -0.8862937490498334 [275/2000] max fitness: -0.8862937490498334 [276/2000] max fitness: -0.8862937490498334 [277/2000] max fitness: -0.8862937490498334 [278/2000] max fitness: -0.8862937490498334 [279/2000] max fitness: -0.8862937490498334 [280/2000] max fitness: -0.8862937490498334 [281/2000] max fitness: -0.8862937490498334 [282/2000] max fitness: -0.8862937490498334 [283/2000] max fitness: -0.8862937490498334 [284/2000] max fitness: -0.8862937490498334 [285/2000] max fitness: -0.8862937490498334 [286/2000] max fitness: -0.8862937490498334 [287/2000] max fitness: -0.8862937490498334 [288/2000] max fitness: -0.8862937490498334 [289/2000] max fitness: -0.8862937490498334 [290/2000] max fitness: -0.8862937490498334 [291/2000] max fitness: -0.8862937490498334 [292/2000] max fitness: -0.8862937490498334 [293/2000] max fitness: -0.8862937490498334 [294/2000] max fitness: -0.8862937490498334 [295/2000] max fitness: -0.8862937490498334 [296/2000] max fitness: -0.8862937490498334 [297/2000] max fitness: -0.8862937490498334 [298/2000] max fitness: -0.8862937490498334 [299/2000] max fitness: -0.8862937490498334 [300/2000] max fitness: -0.8862937490498334 [301/2000] max fitness: -0.8862937490498334 [302/2000] max fitness: -0.8862937490498334 [303/2000] max fitness: -0.8862937490498334 [304/2000] max fitness: -0.8862937490498334 [305/2000] max fitness: -0.8862937490498334 [306/2000] max fitness: -0.8862937490498334 [307/2000] max fitness: -0.8862937490498334 [308/2000] max fitness: -0.8862937490498334 [309/2000] max fitness: -0.8862937490498334 [310/2000] max fitness: -0.8862937490498334 [311/2000] max fitness: -0.8862937490498334 [312/2000] max fitness: -0.8862937490498334 [313/2000] max fitness: -0.8862937490498334 [314/2000] max fitness: -0.8862937490498334 [315/2000] max fitness: -0.8862937490498334 [316/2000] max fitness: -0.8862937490498334 [317/2000] max fitness: -0.8862937490498334 [318/2000] max fitness: -0.8862937490498334 [319/2000] max fitness: -0.8862937490498334 [320/2000] max fitness: -0.8862937490498334 [321/2000] max fitness: -0.8862937490498334 [322/2000] max fitness: -0.8862937490498334 [323/2000] max fitness: -0.8862937490498334 [324/2000] max fitness: -0.8862937490498334 [325/2000] max fitness: -0.8862937490498334 [326/2000] max fitness: -0.8862937490498334 [327/2000] max fitness: -0.8862937490498334 [328/2000] max fitness: -0.8862937490498334 [329/2000] max fitness: -0.8862937490498334 [330/2000] max fitness: -0.8862937490498334 [331/2000] max fitness: -0.8862937490498334 [332/2000] max fitness: -0.8862937490498334 [333/2000] max fitness: -0.8862937490498334 [334/2000] max fitness: -0.8862937490498334 [335/2000] max fitness: -0.8862937490498334 [336/2000] max fitness: -0.8862937490498334 [337/2000] max fitness: -0.8862937490498334 [338/2000] max fitness: -0.8862937490498334 [339/2000] max fitness: -0.8862937490498334 [340/2000] max fitness: -0.8862937490498334 [341/2000] max fitness: -0.8862937490498334 [342/2000] max fitness: -0.8862937490498334 [343/2000] max fitness: -0.8862937490498334 [344/2000] max fitness: -0.8862937490498334 [345/2000] max fitness: -0.8862937490498334 [346/2000] max fitness: -0.8862937490498334 [347/2000] max fitness: -0.8862937490498334 [348/2000] max fitness: -0.8862937490498334 [349/2000] max fitness: -0.8862937490498334 [350/2000] max fitness: -0.8862937490498334 [351/2000] max fitness: -0.8862937490498334 [352/2000] max fitness: -0.8862937490498334 [353/2000] max fitness: -0.8862937490498334 [354/2000] max fitness: -0.8862937490498334 [355/2000] max fitness: -0.8862937490498334 [356/2000] max fitness: -0.524 [357/2000] max fitness: -0.524 [358/2000] max fitness: -0.524 [359/2000] max fitness: -0.524 [360/2000] max fitness: -0.524 [361/2000] max fitness: -0.524 [362/2000] max fitness: -0.524 [363/2000] max fitness: -0.524 [364/2000] max fitness: -0.524 [365/2000] max fitness: -0.524 [366/2000] max fitness: -0.524 [367/2000] max fitness: -0.524 [368/2000] max fitness: -0.524 [369/2000] max fitness: -0.524 [370/2000] max fitness: -0.524 [371/2000] max fitness: -0.524 [372/2000] max fitness: -0.524 [373/2000] max fitness: -0.524 [374/2000] max fitness: -0.524 [375/2000] max fitness: -0.524 [376/2000] max fitness: -0.524 [377/2000] max fitness: -0.524 [378/2000] max fitness: -0.524 [379/2000] max fitness: -0.524 [380/2000] max fitness: -0.524 [381/2000] max fitness: -0.524 [382/2000] max fitness: -0.524 [383/2000] max fitness: -0.524 [384/2000] max fitness: -0.524 [385/2000] max fitness: -0.524 [386/2000] max fitness: -0.524 [387/2000] max fitness: -0.524 [388/2000] max fitness: -0.524 [389/2000] max fitness: -0.524 [390/2000] max fitness: -0.524 [391/2000] max fitness: -0.524 [392/2000] max fitness: -0.524 [393/2000] max fitness: -0.524 [394/2000] max fitness: -0.524 [395/2000] max fitness: -0.524 [396/2000] max fitness: -0.524 [397/2000] max fitness: -0.524 [398/2000] max fitness: -0.524 [399/2000] max fitness: -0.524 [400/2000] max fitness: -0.524 [401/2000] max fitness: -0.524 [402/2000] max fitness: -0.524 [403/2000] max fitness: -0.524 [404/2000] max fitness: -0.524 [405/2000] max fitness: -0.524 [406/2000] max fitness: -0.524 [407/2000] max fitness: -0.524 [408/2000] max fitness: -0.524 [409/2000] max fitness: -0.524 [410/2000] max fitness: -0.524 [411/2000] max fitness: -0.524 [412/2000] max fitness: -0.524 [413/2000] max fitness: -0.524 [414/2000] max fitness: -0.524 [415/2000] max fitness: -0.524 [416/2000] max fitness: -0.524 [417/2000] max fitness: -0.524 [418/2000] max fitness: -0.524 [419/2000] max fitness: -0.524 [420/2000] max fitness: -0.524 [421/2000] max fitness: -0.524 [422/2000] max fitness: -0.524 [423/2000] max fitness: -0.524 [424/2000] max fitness: -0.524 [425/2000] max fitness: -0.524 [426/2000] max fitness: -0.524 [427/2000] max fitness: -0.524 [428/2000] max fitness: -0.524 [429/2000] max fitness: -0.524 [430/2000] max fitness: -0.524 [431/2000] max fitness: -0.524 [432/2000] max fitness: -0.524 [433/2000] max fitness: -0.524 [434/2000] max fitness: -0.524 [435/2000] max fitness: -0.524 [436/2000] max fitness: -0.524 [437/2000] max fitness: -0.524 [438/2000] max fitness: -0.524 [439/2000] max fitness: -0.524 [440/2000] max fitness: -0.524 [441/2000] max fitness: -0.524 [442/2000] max fitness: -0.524 [443/2000] max fitness: -0.524 [444/2000] max fitness: -0.524 [445/2000] max fitness: -0.524 [446/2000] max fitness: -0.524 [447/2000] max fitness: -0.524 [448/2000] max fitness: -0.524 [449/2000] max fitness: -0.524 [450/2000] max fitness: -0.524 [451/2000] max fitness: -0.524 [452/2000] max fitness: -0.524 [453/2000] max fitness: -0.524 [454/2000] max fitness: -0.524 [455/2000] max fitness: -0.524 [456/2000] max fitness: -0.524 [457/2000] max fitness: -0.524 [458/2000] max fitness: -0.524 [459/2000] max fitness: -0.524 [460/2000] max fitness: -0.524 [461/2000] max fitness: -0.524 [462/2000] max fitness: -0.524 [463/2000] max fitness: -0.524 [464/2000] max fitness: -0.524 [465/2000] max fitness: -0.524 [466/2000] max fitness: -0.524 [467/2000] max fitness: -0.524 [468/2000] max fitness: -0.524 [469/2000] max fitness: -0.524 [470/2000] max fitness: -0.524 [471/2000] max fitness: -0.524 [472/2000] max fitness: -0.524 [473/2000] max fitness: -0.524 [474/2000] max fitness: -0.524 [475/2000] max fitness: -0.524 [476/2000] max fitness: -0.524 [477/2000] max fitness: -0.524 [478/2000] max fitness: -0.524 [479/2000] max fitness: -0.524 [480/2000] max fitness: -0.524 [481/2000] max fitness: -0.524 [482/2000] max fitness: -0.524 [483/2000] max fitness: -0.524 [484/2000] max fitness: -0.524 [485/2000] max fitness: -0.524 [486/2000] max fitness: -0.524 [487/2000] max fitness: -0.524 [488/2000] max fitness: -0.524 [489/2000] max fitness: -0.524 [490/2000] max fitness: -0.524 [491/2000] max fitness: -0.524 [492/2000] max fitness: -0.524 [493/2000] max fitness: -0.524 [494/2000] max fitness: -0.524 [495/2000] max fitness: -0.524 [496/2000] max fitness: -0.524 [497/2000] max fitness: -0.524 [498/2000] max fitness: -0.524 [499/2000] max fitness: -0.524 [500/2000] max fitness: -0.524 [501/2000] max fitness: -0.524 [502/2000] max fitness: -0.524 [503/2000] max fitness: -0.524 [504/2000] max fitness: -0.524 [505/2000] max fitness: -0.524 [506/2000] max fitness: -0.524 [507/2000] max fitness: -0.524 [508/2000] max fitness: -0.524 [509/2000] max fitness: -0.524 [510/2000] max fitness: -0.524 [511/2000] max fitness: -0.524 [512/2000] max fitness: -0.524 [513/2000] max fitness: -0.524 [514/2000] max fitness: -0.524 [515/2000] max fitness: -0.524 [516/2000] max fitness: -0.524 [517/2000] max fitness: -0.524 [518/2000] max fitness: -0.524 [519/2000] max fitness: -0.524 [520/2000] max fitness: -0.524 [521/2000] max fitness: -0.524 [522/2000] max fitness: -0.524 [523/2000] max fitness: -0.524 [524/2000] max fitness: -0.524 [525/2000] max fitness: -0.524 [526/2000] max fitness: -0.524 [527/2000] max fitness: -0.524 [528/2000] max fitness: -0.524 [529/2000] max fitness: -0.524 [530/2000] max fitness: -0.524 [531/2000] max fitness: -0.524 [532/2000] max fitness: -0.524 [533/2000] max fitness: -0.524 [534/2000] max fitness: -0.524 [535/2000] max fitness: -0.524 [536/2000] max fitness: -0.524 [537/2000] max fitness: -0.524 [538/2000] max fitness: -0.524 [539/2000] max fitness: -0.524 [540/2000] max fitness: -0.524 [541/2000] max fitness: -0.524 [542/2000] max fitness: -0.524 [543/2000] max fitness: -0.524 [544/2000] max fitness: -0.524 [545/2000] max fitness: -0.524 [546/2000] max fitness: -0.524 [547/2000] max fitness: -0.524 [548/2000] max fitness: -0.524 [549/2000] max fitness: -0.524 [550/2000] max fitness: -0.524 [551/2000] max fitness: -0.524 [552/2000] max fitness: -0.524 [553/2000] max fitness: -0.524 [554/2000] max fitness: -0.524 [555/2000] max fitness: -0.524 [556/2000] max fitness: -0.524 [557/2000] max fitness: -0.524 [558/2000] max fitness: -0.524 [559/2000] max fitness: -0.524 [560/2000] max fitness: -0.524 [561/2000] max fitness: -0.524 [562/2000] max fitness: -0.524 [563/2000] max fitness: -0.524 [564/2000] max fitness: -0.524 [565/2000] max fitness: -0.524 [566/2000] max fitness: -0.524 [567/2000] max fitness: -0.524 [568/2000] max fitness: -0.524 [569/2000] max fitness: -0.524 [570/2000] max fitness: -0.524 [571/2000] max fitness: -0.524 [572/2000] max fitness: -0.524 [573/2000] max fitness: -0.524 [574/2000] max fitness: -0.524 [575/2000] max fitness: -0.524 [576/2000] max fitness: -0.524 [577/2000] max fitness: -0.524 [578/2000] max fitness: -0.524 [579/2000] max fitness: -0.524 [580/2000] max fitness: -0.524 [581/2000] max fitness: -0.524 [582/2000] max fitness: -0.524 [583/2000] max fitness: -0.524 [584/2000] max fitness: -0.524 [585/2000] max fitness: -0.524 [586/2000] max fitness: -0.524 [587/2000] max fitness: -0.524 [588/2000] max fitness: -0.524 [589/2000] max fitness: -0.524 [590/2000] max fitness: -0.524 [591/2000] max fitness: -0.524 [592/2000] max fitness: -0.524 [593/2000] max fitness: -0.524 [594/2000] max fitness: -0.524 [595/2000] max fitness: -0.524 [596/2000] max fitness: -0.524 [597/2000] max fitness: -0.524 [598/2000] max fitness: -0.524 [599/2000] max fitness: -0.524 [600/2000] max fitness: -0.524 [601/2000] max fitness: -0.524 [602/2000] max fitness: -0.524 [603/2000] max fitness: -0.524 [604/2000] max fitness: -0.524 [605/2000] max fitness: -0.524 [606/2000] max fitness: -0.524 [607/2000] max fitness: -0.524 [608/2000] max fitness: -0.524 [609/2000] max fitness: -0.524 [610/2000] max fitness: -0.524 [611/2000] max fitness: -0.524 [612/2000] max fitness: -0.524 [613/2000] max fitness: -0.524 [614/2000] max fitness: -0.524 [615/2000] max fitness: -0.524 [616/2000] max fitness: -0.524 [617/2000] max fitness: -0.524 [618/2000] max fitness: -0.524 [619/2000] max fitness: -0.524 [620/2000] max fitness: -0.524 [621/2000] max fitness: -0.524 [622/2000] max fitness: -0.524 [623/2000] max fitness: -0.524 [624/2000] max fitness: -0.524 [625/2000] max fitness: -0.524 [626/2000] max fitness: -0.524 [627/2000] max fitness: -0.524 [628/2000] max fitness: -0.524 [629/2000] max fitness: -0.524 [630/2000] max fitness: -0.524 [631/2000] max fitness: -0.524 [632/2000] max fitness: -0.524 [633/2000] max fitness: -0.524 [634/2000] max fitness: -0.524 [635/2000] max fitness: -0.524 [636/2000] max fitness: -0.524 [637/2000] max fitness: -0.524 [638/2000] max fitness: -0.524 [639/2000] max fitness: -0.524 [640/2000] max fitness: -0.524 [641/2000] max fitness: -0.524 [642/2000] max fitness: -0.524 [643/2000] max fitness: -0.524 [644/2000] max fitness: -0.524 [645/2000] max fitness: -0.524 [646/2000] max fitness: -0.524 [647/2000] max fitness: -0.524 [648/2000] max fitness: -0.524 [649/2000] max fitness: -0.524 [650/2000] max fitness: -0.524 [651/2000] max fitness: -0.524 [652/2000] max fitness: -0.524 [653/2000] max fitness: -0.524 [654/2000] max fitness: -0.524 [655/2000] max fitness: -0.524 [656/2000] max fitness: -0.524 [657/2000] max fitness: -0.524 [658/2000] max fitness: -0.524 [659/2000] max fitness: -0.524 [660/2000] max fitness: -0.524 [661/2000] max fitness: -0.524 [662/2000] max fitness: -0.524 [663/2000] max fitness: -0.524 [664/2000] max fitness: -0.524 [665/2000] max fitness: -0.524 [666/2000] max fitness: -0.524 [667/2000] max fitness: -0.524 [668/2000] max fitness: -0.524 [669/2000] max fitness: -0.524 [670/2000] max fitness: -0.524 [671/2000] max fitness: -0.524 [672/2000] max fitness: -0.524 [673/2000] max fitness: -0.524 [674/2000] max fitness: -0.524 [675/2000] max fitness: -0.524 [676/2000] max fitness: -0.524 [677/2000] max fitness: -0.524 [678/2000] max fitness: -0.524 [679/2000] max fitness: -0.524 [680/2000] max fitness: -0.524 [681/2000] max fitness: -0.524 [682/2000] max fitness: -0.524 [683/2000] max fitness: -0.524 [684/2000] max fitness: -0.524 [685/2000] max fitness: -0.524 [686/2000] max fitness: -0.524 [687/2000] max fitness: -0.524 [688/2000] max fitness: -0.524 [689/2000] max fitness: -0.524 [690/2000] max fitness: -0.524 [691/2000] max fitness: -0.524 [692/2000] max fitness: -0.524 [693/2000] max fitness: -0.524 [694/2000] max fitness: -0.524 [695/2000] max fitness: -0.524 [696/2000] max fitness: -0.524 [697/2000] max fitness: -0.524 [698/2000] max fitness: -0.524 [699/2000] max fitness: -0.524 [700/2000] max fitness: -0.524 [701/2000] max fitness: -0.524 [702/2000] max fitness: -0.524 [703/2000] max fitness: -0.524 [704/2000] max fitness: -0.524 [705/2000] max fitness: -0.524 [706/2000] max fitness: -0.524 [707/2000] max fitness: -0.524 [708/2000] max fitness: -0.524 [709/2000] max fitness: -0.524 [710/2000] max fitness: -0.524 [711/2000] max fitness: -0.524 [712/2000] max fitness: -0.524 [713/2000] max fitness: -0.524 [714/2000] max fitness: -0.524 [715/2000] max fitness: -0.524 [716/2000] max fitness: -0.524 [717/2000] max fitness: -0.524 [718/2000] max fitness: -0.524 [719/2000] max fitness: -0.524 [720/2000] max fitness: -0.524 [721/2000] max fitness: -0.524 [722/2000] max fitness: -0.524 [723/2000] max fitness: -0.524 [724/2000] max fitness: -0.524 [725/2000] max fitness: -0.524 [726/2000] max fitness: -0.524 [727/2000] max fitness: -0.524 [728/2000] max fitness: -0.524 [729/2000] max fitness: -0.524 [730/2000] max fitness: -0.524 [731/2000] max fitness: -0.524 [732/2000] max fitness: -0.524 [733/2000] max fitness: -0.524 [734/2000] max fitness: -0.524 [735/2000] max fitness: -0.524 [736/2000] max fitness: -0.524 [737/2000] max fitness: -0.524 [738/2000] max fitness: -0.524 [739/2000] max fitness: -0.524 [740/2000] max fitness: -0.524 [741/2000] max fitness: -0.524 [742/2000] max fitness: -0.524 [743/2000] max fitness: -0.524 [744/2000] max fitness: -0.524 [745/2000] max fitness: -0.524 [746/2000] max fitness: -0.524 [747/2000] max fitness: -0.524 [748/2000] max fitness: -0.524 [749/2000] max fitness: -0.524 [750/2000] max fitness: -0.524 [751/2000] max fitness: -0.524 [752/2000] max fitness: -0.524 [753/2000] max fitness: -0.524 [754/2000] max fitness: -0.524 [755/2000] max fitness: -0.524 [756/2000] max fitness: -0.524 [757/2000] max fitness: -0.524 [758/2000] max fitness: -0.524 [759/2000] max fitness: -0.524 [760/2000] max fitness: -0.524 [761/2000] max fitness: -0.524 [762/2000] max fitness: -0.524 [763/2000] max fitness: -0.524 [764/2000] max fitness: -0.524 [765/2000] max fitness: -0.524 [766/2000] max fitness: -0.524 [767/2000] max fitness: -0.524 [768/2000] max fitness: -0.524 [769/2000] max fitness: -0.524 [770/2000] max fitness: -0.524 [771/2000] max fitness: -0.524 [772/2000] max fitness: -0.524 [773/2000] max fitness: -0.524 [774/2000] max fitness: -0.524 [775/2000] max fitness: -0.524 [776/2000] max fitness: -0.524 [777/2000] max fitness: -0.524 [778/2000] max fitness: -0.524 [779/2000] max fitness: -0.524 [780/2000] max fitness: -0.524 [781/2000] max fitness: -0.524 [782/2000] max fitness: -0.524 [783/2000] max fitness: -0.524 [784/2000] max fitness: -0.524 [785/2000] max fitness: -0.524 [786/2000] max fitness: -0.524 [787/2000] max fitness: -0.524 [788/2000] max fitness: -0.524 [789/2000] max fitness: -0.524 [790/2000] max fitness: -0.524 [791/2000] max fitness: -0.524 [792/2000] max fitness: -0.524 [793/2000] max fitness: -0.524 [794/2000] max fitness: -0.524 [795/2000] max fitness: -0.524 [796/2000] max fitness: -0.524 [797/2000] max fitness: -0.524 [798/2000] max fitness: -0.524 [799/2000] max fitness: -0.524 [800/2000] max fitness: -0.524 [801/2000] max fitness: -0.524 [802/2000] max fitness: -0.524 [803/2000] max fitness: -0.524 [804/2000] max fitness: -0.524 [805/2000] max fitness: -0.524 [806/2000] max fitness: -0.524 [807/2000] max fitness: -0.524 [808/2000] max fitness: -0.524 [809/2000] max fitness: -0.524 [810/2000] max fitness: -0.524 [811/2000] max fitness: -0.524 [812/2000] max fitness: -0.524 [813/2000] max fitness: -0.524 [814/2000] max fitness: -0.524 [815/2000] max fitness: -0.524 [816/2000] max fitness: -0.524 [817/2000] max fitness: -0.524 [818/2000] max fitness: -0.524 [819/2000] max fitness: -0.524 [820/2000] max fitness: -0.524 [821/2000] max fitness: -0.524 [822/2000] max fitness: -0.524 [823/2000] max fitness: -0.524 [824/2000] max fitness: -0.524 [825/2000] max fitness: -0.524 [826/2000] max fitness: -0.524 [827/2000] max fitness: -0.524 [828/2000] max fitness: -0.524 [829/2000] max fitness: -0.524 [830/2000] max fitness: -0.524 [831/2000] max fitness: -0.524 [832/2000] max fitness: -0.524 [833/2000] max fitness: -0.524 [834/2000] max fitness: -0.524 [835/2000] max fitness: -0.524 [836/2000] max fitness: -0.524 [837/2000] max fitness: -0.524 [838/2000] max fitness: -0.524 [839/2000] max fitness: -0.524 [840/2000] max fitness: -0.524 [841/2000] max fitness: -0.524 [842/2000] max fitness: -0.524 [843/2000] max fitness: -0.524 [844/2000] max fitness: -0.524 [845/2000] max fitness: -0.524 [846/2000] max fitness: -0.524 [847/2000] max fitness: -0.524 [848/2000] max fitness: -0.524 [849/2000] max fitness: -0.524 [850/2000] max fitness: -0.524 [851/2000] max fitness: -0.524 [852/2000] max fitness: -0.524 [853/2000] max fitness: -0.524 [854/2000] max fitness: -0.524 [855/2000] max fitness: -0.524 [856/2000] max fitness: -0.524 [857/2000] max fitness: -0.524 [858/2000] max fitness: -0.524 [859/2000] max fitness: -0.524 [860/2000] max fitness: -0.524 [861/2000] max fitness: -0.524 [862/2000] max fitness: -0.524 [863/2000] max fitness: -0.524 [864/2000] max fitness: -0.524 [865/2000] max fitness: -0.524 [866/2000] max fitness: -0.524 [867/2000] max fitness: -0.524 [868/2000] max fitness: -0.524 [869/2000] max fitness: -0.524 [870/2000] max fitness: -0.524 [871/2000] max fitness: -0.524 [872/2000] max fitness: -0.524 [873/2000] max fitness: -0.524 [874/2000] max fitness: -0.524 [875/2000] max fitness: -0.524 [876/2000] max fitness: -0.524 [877/2000] max fitness: -0.524 [878/2000] max fitness: -0.524 [879/2000] max fitness: -0.524 [880/2000] max fitness: -0.524 [881/2000] max fitness: -0.524 [882/2000] max fitness: -0.524 [883/2000] max fitness: -0.524 [884/2000] max fitness: -0.524 [885/2000] max fitness: -0.524 [886/2000] max fitness: -0.524 [887/2000] max fitness: -0.524 [888/2000] max fitness: -0.524 [889/2000] max fitness: -0.524 [890/2000] max fitness: -0.524 [891/2000] max fitness: -0.524 [892/2000] max fitness: -0.524 [893/2000] max fitness: -0.524 [894/2000] max fitness: -0.524 [895/2000] max fitness: -0.524 [896/2000] max fitness: -0.524 [897/2000] max fitness: -0.524 [898/2000] max fitness: -0.524 [899/2000] max fitness: -0.524 [900/2000] max fitness: -0.524 [901/2000] max fitness: -0.524 [902/2000] max fitness: -0.524 [903/2000] max fitness: -0.524 [904/2000] max fitness: -0.524 [905/2000] max fitness: -0.524 [906/2000] max fitness: -0.524 [907/2000] max fitness: -0.524 [908/2000] max fitness: -0.524 [909/2000] max fitness: -0.524 [910/2000] max fitness: -0.524 [911/2000] max fitness: -0.524 [912/2000] max fitness: -0.524 [913/2000] max fitness: -0.524 [914/2000] max fitness: -0.524 [915/2000] max fitness: -0.524 [916/2000] max fitness: -0.524 [917/2000] max fitness: -0.524 [918/2000] max fitness: -0.524 [919/2000] max fitness: -0.524 [920/2000] max fitness: -0.524 [921/2000] max fitness: -0.524 [922/2000] max fitness: -0.524 [923/2000] max fitness: -0.524 [924/2000] max fitness: -0.524 [925/2000] max fitness: -0.524 [926/2000] max fitness: -0.524 [927/2000] max fitness: -0.524 [928/2000] max fitness: -0.524 [929/2000] max fitness: -0.524 [930/2000] max fitness: -0.524 [931/2000] max fitness: -0.524 [932/2000] max fitness: -0.524 [933/2000] max fitness: -0.524 [934/2000] max fitness: -0.524 [935/2000] max fitness: -0.524 [936/2000] max fitness: -0.524 [937/2000] max fitness: -0.524 [938/2000] max fitness: -0.524 [939/2000] max fitness: -0.524 [940/2000] max fitness: -0.524 [941/2000] max fitness: -0.524 [942/2000] max fitness: -0.524 [943/2000] max fitness: -0.524 [944/2000] max fitness: -0.524 [945/2000] max fitness: -0.524 [946/2000] max fitness: -0.524 [947/2000] max fitness: -0.524 [948/2000] max fitness: -0.524 [949/2000] max fitness: -0.524 [950/2000] max fitness: -0.524 [951/2000] max fitness: -0.524 [952/2000] max fitness: -0.524 [953/2000] max fitness: -0.524 [954/2000] max fitness: -0.524 [955/2000] max fitness: -0.524 [956/2000] max fitness: -0.524 [957/2000] max fitness: -0.524 [958/2000] max fitness: -0.524 [959/2000] max fitness: -0.524 [960/2000] max fitness: -0.524 [961/2000] max fitness: -0.524 [962/2000] max fitness: -0.524 [963/2000] max fitness: -0.524 [964/2000] max fitness: -0.524 [965/2000] max fitness: -0.524 [966/2000] max fitness: -0.524 [967/2000] max fitness: -0.524 [968/2000] max fitness: -0.524 [969/2000] max fitness: -0.524 [970/2000] max fitness: -0.524 [971/2000] max fitness: -0.524 [972/2000] max fitness: -0.524 [973/2000] max fitness: -0.524 [974/2000] max fitness: -0.524 [975/2000] max fitness: -0.524 [976/2000] max fitness: -0.524 [977/2000] max fitness: -0.524 [978/2000] max fitness: -0.524 [979/2000] max fitness: -0.524 [980/2000] max fitness: -0.524 [981/2000] max fitness: -0.524 [982/2000] max fitness: -0.524 [983/2000] max fitness: -0.524 [984/2000] max fitness: -0.524 [985/2000] max fitness: -0.524 [986/2000] max fitness: -0.524 [987/2000] max fitness: -0.524 [988/2000] max fitness: -0.524 [989/2000] max fitness: -0.524 [990/2000] max fitness: -0.524 [991/2000] max fitness: -0.524 [992/2000] max fitness: -0.524 [993/2000] max fitness: -0.524 [994/2000] max fitness: -0.524 [995/2000] max fitness: -0.524 [996/2000] max fitness: -0.524 [997/2000] max fitness: -0.524 [998/2000] max fitness: -0.524 [999/2000] max fitness: -0.524 [1000/2000] max fitness: -0.524 [1001/2000] max fitness: -0.524 [1002/2000] max fitness: -0.524 [1003/2000] max fitness: -0.524 [1004/2000] max fitness: -0.524 [1005/2000] max fitness: -0.524 [1006/2000] max fitness: -0.524 [1007/2000] max fitness: -0.524 [1008/2000] max fitness: -0.524 [1009/2000] max fitness: -0.524 [1010/2000] max fitness: -0.524 [1011/2000] max fitness: -0.524 [1012/2000] max fitness: -0.524 [1013/2000] max fitness: -0.524 [1014/2000] max fitness: -0.524 [1015/2000] max fitness: -0.524 [1016/2000] max fitness: -0.524 [1017/2000] max fitness: -0.524 [1018/2000] max fitness: -0.524 [1019/2000] max fitness: -0.524 [1020/2000] max fitness: -0.524 [1021/2000] max fitness: -0.524 [1022/2000] max fitness: -0.524 [1023/2000] max fitness: -0.524 [1024/2000] max fitness: -0.524 [1025/2000] max fitness: -0.524 [1026/2000] max fitness: -0.524 [1027/2000] max fitness: -0.524 [1028/2000] max fitness: -0.524 [1029/2000] max fitness: -0.524 [1030/2000] max fitness: -0.524 [1031/2000] max fitness: -0.524 [1032/2000] max fitness: -0.524 [1033/2000] max fitness: -0.524 [1034/2000] max fitness: -0.524 [1035/2000] max fitness: -0.524 [1036/2000] max fitness: -0.524 [1037/2000] max fitness: -0.524 [1038/2000] max fitness: -0.524 [1039/2000] max fitness: -0.524 [1040/2000] max fitness: -0.524 [1041/2000] max fitness: -0.524 [1042/2000] max fitness: -0.524 [1043/2000] max fitness: -0.524 [1044/2000] max fitness: -0.524 [1045/2000] max fitness: -0.524 [1046/2000] max fitness: -0.524 [1047/2000] max fitness: -0.524 [1048/2000] max fitness: -0.524 [1049/2000] max fitness: -0.524 [1050/2000] max fitness: -0.524 [1051/2000] max fitness: -0.524 [1052/2000] max fitness: -0.524 [1053/2000] max fitness: -0.524 [1054/2000] max fitness: -0.524 [1055/2000] max fitness: -0.524 [1056/2000] max fitness: -0.524 [1057/2000] max fitness: -0.524 [1058/2000] max fitness: -0.524 [1059/2000] max fitness: -0.524 [1060/2000] max fitness: -0.524 [1061/2000] max fitness: -0.524 [1062/2000] max fitness: -0.524 [1063/2000] max fitness: -0.524 [1064/2000] max fitness: -0.524 [1065/2000] max fitness: -0.524 [1066/2000] max fitness: -0.524 [1067/2000] max fitness: -0.524 [1068/2000] max fitness: -0.524 [1069/2000] max fitness: -0.524 [1070/2000] max fitness: -0.524 [1071/2000] max fitness: -0.524 [1072/2000] max fitness: -0.524 [1073/2000] max fitness: -0.524 [1074/2000] max fitness: -0.524 [1075/2000] max fitness: -0.524 [1076/2000] max fitness: -0.524 [1077/2000] max fitness: -0.524 [1078/2000] max fitness: -0.524 [1079/2000] max fitness: -0.524 [1080/2000] max fitness: -0.524 [1081/2000] max fitness: -0.524 [1082/2000] max fitness: -0.524 [1083/2000] max fitness: -0.524 [1084/2000] max fitness: -0.524 [1085/2000] max fitness: -0.524 [1086/2000] max fitness: -0.524 [1087/2000] max fitness: -0.524 [1088/2000] max fitness: -0.524 [1089/2000] max fitness: -0.524 [1090/2000] max fitness: -0.524 [1091/2000] max fitness: -0.524 [1092/2000] max fitness: -0.524 [1093/2000] max fitness: -0.524 [1094/2000] max fitness: -0.524 [1095/2000] max fitness: -0.524 [1096/2000] max fitness: -0.524 [1097/2000] max fitness: -0.524 [1098/2000] max fitness: -0.524 [1099/2000] max fitness: -0.524 [1100/2000] max fitness: -0.524 [1101/2000] max fitness: -0.524 [1102/2000] max fitness: -0.524 [1103/2000] max fitness: -0.524 [1104/2000] max fitness: -0.524 [1105/2000] max fitness: -0.524 [1106/2000] max fitness: -0.524 [1107/2000] max fitness: -0.524 [1108/2000] max fitness: -0.524 [1109/2000] max fitness: -0.524 [1110/2000] max fitness: -0.524 [1111/2000] max fitness: -0.524 [1112/2000] max fitness: -0.524 [1113/2000] max fitness: -0.524 [1114/2000] max fitness: -0.524 [1115/2000] max fitness: -0.524 [1116/2000] max fitness: -0.524 [1117/2000] max fitness: -0.524 [1118/2000] max fitness: -0.524 [1119/2000] max fitness: -0.524 [1120/2000] max fitness: -0.524 [1121/2000] max fitness: -0.524 [1122/2000] max fitness: -0.524 [1123/2000] max fitness: -0.524 [1124/2000] max fitness: -0.524 [1125/2000] max fitness: -0.524 [1126/2000] max fitness: -0.524 [1127/2000] max fitness: -0.524 [1128/2000] max fitness: -0.524 [1129/2000] max fitness: -0.524 [1130/2000] max fitness: -0.524 [1131/2000] max fitness: -0.524 [1132/2000] max fitness: -0.524 [1133/2000] max fitness: -0.524 [1134/2000] max fitness: -0.524 [1135/2000] max fitness: -0.524 [1136/2000] max fitness: -0.524 [1137/2000] max fitness: -0.524 [1138/2000] max fitness: -0.524 [1139/2000] max fitness: -0.524 [1140/2000] max fitness: -0.524 [1141/2000] max fitness: -0.524 [1142/2000] max fitness: -0.524 [1143/2000] max fitness: -0.524 [1144/2000] max fitness: -0.524 [1145/2000] max fitness: -0.524 [1146/2000] max fitness: -0.524 [1147/2000] max fitness: -0.524 [1148/2000] max fitness: -0.524 [1149/2000] max fitness: -0.524 [1150/2000] max fitness: -0.524 [1151/2000] max fitness: -0.524 [1152/2000] max fitness: -0.524 [1153/2000] max fitness: -0.524 [1154/2000] max fitness: -0.524 [1155/2000] max fitness: -0.524 [1156/2000] max fitness: -0.524 [1157/2000] max fitness: -0.524 [1158/2000] max fitness: -0.524 [1159/2000] max fitness: -0.524 [1160/2000] max fitness: -0.524 [1161/2000] max fitness: -0.524 [1162/2000] max fitness: -0.524 [1163/2000] max fitness: -0.524 [1164/2000] max fitness: -0.524 [1165/2000] max fitness: -0.524 [1166/2000] max fitness: -0.524 [1167/2000] max fitness: -0.524 [1168/2000] max fitness: -0.524 [1169/2000] max fitness: -0.524 [1170/2000] max fitness: -0.524 [1171/2000] max fitness: -0.524 [1172/2000] max fitness: -0.524 [1173/2000] max fitness: -0.524 [1174/2000] max fitness: -0.524 [1175/2000] max fitness: -0.524 [1176/2000] max fitness: -0.524 [1177/2000] max fitness: -0.524 [1178/2000] max fitness: -0.524 [1179/2000] max fitness: -0.524 [1180/2000] max fitness: -0.524 [1181/2000] max fitness: -0.524 [1182/2000] max fitness: -0.524 [1183/2000] max fitness: -0.524 [1184/2000] max fitness: -0.524 [1185/2000] max fitness: -0.524 [1186/2000] max fitness: -0.524 [1187/2000] max fitness: -0.524 [1188/2000] max fitness: -0.524 [1189/2000] max fitness: -0.524 [1190/2000] max fitness: -0.524 [1191/2000] max fitness: -0.524 [1192/2000] max fitness: -0.524 [1193/2000] max fitness: -0.524 [1194/2000] max fitness: -0.524 [1195/2000] max fitness: -0.524 [1196/2000] max fitness: -0.524 [1197/2000] max fitness: -0.524 [1198/2000] max fitness: -0.524 [1199/2000] max fitness: -0.524 [1200/2000] max fitness: -0.524 [1201/2000] max fitness: -0.524 [1202/2000] max fitness: -0.524 [1203/2000] max fitness: -0.524 [1204/2000] max fitness: -0.524 [1205/2000] max fitness: -0.524 [1206/2000] max fitness: -0.524 [1207/2000] max fitness: -0.524 [1208/2000] max fitness: -0.524 [1209/2000] max fitness: -0.524 [1210/2000] max fitness: -0.524 [1211/2000] max fitness: -0.524 [1212/2000] max fitness: -0.524 [1213/2000] max fitness: -0.524 [1214/2000] max fitness: -0.524 [1215/2000] max fitness: -0.524 [1216/2000] max fitness: -0.524 [1217/2000] max fitness: -0.524 [1218/2000] max fitness: -0.524 [1219/2000] max fitness: -0.524 [1220/2000] max fitness: -0.524 [1221/2000] max fitness: -0.524 [1222/2000] max fitness: -0.524 [1223/2000] max fitness: -0.524 [1224/2000] max fitness: -0.524 [1225/2000] max fitness: -0.524 [1226/2000] max fitness: -0.524 [1227/2000] max fitness: -0.524 [1228/2000] max fitness: -0.524 [1229/2000] max fitness: -0.524 [1230/2000] max fitness: -0.524 [1231/2000] max fitness: -0.524 [1232/2000] max fitness: -0.524 [1233/2000] max fitness: -0.524 [1234/2000] max fitness: -0.524 [1235/2000] max fitness: -0.524 [1236/2000] max fitness: -0.524 [1237/2000] max fitness: -0.524 [1238/2000] max fitness: -0.524 [1239/2000] max fitness: -0.524 [1240/2000] max fitness: -0.524 [1241/2000] max fitness: -0.524 [1242/2000] max fitness: -0.524 [1243/2000] max fitness: -0.524 [1244/2000] max fitness: -0.524 [1245/2000] max fitness: -0.524 [1246/2000] max fitness: -0.524 [1247/2000] max fitness: -0.524 [1248/2000] max fitness: -0.524 [1249/2000] max fitness: -0.524 [1250/2000] max fitness: -0.524 [1251/2000] max fitness: -0.524 [1252/2000] max fitness: -0.524 [1253/2000] max fitness: -0.524 [1254/2000] max fitness: -0.524 [1255/2000] max fitness: -0.524 [1256/2000] max fitness: -0.524 [1257/2000] max fitness: -0.524 [1258/2000] max fitness: -0.524 [1259/2000] max fitness: -0.524 [1260/2000] max fitness: -0.524 [1261/2000] max fitness: -0.524 [1262/2000] max fitness: -0.524 [1263/2000] max fitness: -0.524 [1264/2000] max fitness: -0.524 [1265/2000] max fitness: -0.524 [1266/2000] max fitness: -0.524 [1267/2000] max fitness: -0.524 [1268/2000] max fitness: -0.524 [1269/2000] max fitness: -0.524 [1270/2000] max fitness: -0.524 [1271/2000] max fitness: -0.524 [1272/2000] max fitness: -0.524 [1273/2000] max fitness: -0.524 [1274/2000] max fitness: -0.524 [1275/2000] max fitness: -0.524 [1276/2000] max fitness: -0.524 [1277/2000] max fitness: -0.524 [1278/2000] max fitness: -0.524 [1279/2000] max fitness: -0.524 [1280/2000] max fitness: -0.524 [1281/2000] max fitness: -0.524 [1282/2000] max fitness: -0.524 [1283/2000] max fitness: -0.524 [1284/2000] max fitness: -0.524 [1285/2000] max fitness: -0.524 [1286/2000] max fitness: -0.524 [1287/2000] max fitness: -0.524 [1288/2000] max fitness: -0.524 [1289/2000] max fitness: -0.524 [1290/2000] max fitness: -0.524 [1291/2000] max fitness: -0.524 [1292/2000] max fitness: -0.524 [1293/2000] max fitness: -0.524 [1294/2000] max fitness: -0.524 [1295/2000] max fitness: -0.524 [1296/2000] max fitness: -0.524 [1297/2000] max fitness: -0.524 [1298/2000] max fitness: -0.524 [1299/2000] max fitness: -0.524 [1300/2000] max fitness: -0.524 [1301/2000] max fitness: -0.524 [1302/2000] max fitness: -0.524 [1303/2000] max fitness: -0.524 [1304/2000] max fitness: -0.524 [1305/2000] max fitness: -0.524 [1306/2000] max fitness: -0.524 [1307/2000] max fitness: -0.524 [1308/2000] max fitness: -0.524 [1309/2000] max fitness: -0.524 [1310/2000] max fitness: -0.524 [1311/2000] max fitness: -0.524 [1312/2000] max fitness: -0.524 [1313/2000] max fitness: -0.524 [1314/2000] max fitness: -0.524 [1315/2000] max fitness: -0.524 [1316/2000] max fitness: -0.524 [1317/2000] max fitness: -0.524 [1318/2000] max fitness: -0.524 [1319/2000] max fitness: -0.524 [1320/2000] max fitness: -0.524 [1321/2000] max fitness: -0.524 [1322/2000] max fitness: -0.524 [1323/2000] max fitness: -0.524 [1324/2000] max fitness: -0.524 [1325/2000] max fitness: -0.524 [1326/2000] max fitness: -0.524 [1327/2000] max fitness: -0.524 [1328/2000] max fitness: -0.524 [1329/2000] max fitness: -0.524 [1330/2000] max fitness: -0.524 [1331/2000] max fitness: -0.524 [1332/2000] max fitness: -0.524 [1333/2000] max fitness: -0.524 [1334/2000] max fitness: -0.524 [1335/2000] max fitness: -0.524 [1336/2000] max fitness: -0.524 [1337/2000] max fitness: -0.524 [1338/2000] max fitness: -0.524 [1339/2000] max fitness: -0.524 [1340/2000] max fitness: -0.524 [1341/2000] max fitness: -0.524 [1342/2000] max fitness: -0.524 [1343/2000] max fitness: -0.524 [1344/2000] max fitness: -0.524 [1345/2000] max fitness: -0.524 [1346/2000] max fitness: -0.524 [1347/2000] max fitness: -0.524 [1348/2000] max fitness: -0.524 [1349/2000] max fitness: -0.524 [1350/2000] max fitness: -0.524 [1351/2000] max fitness: -0.524 [1352/2000] max fitness: -0.524 [1353/2000] max fitness: -0.524 [1354/2000] max fitness: -0.524 [1355/2000] max fitness: -0.524 [1356/2000] max fitness: -0.524 [1357/2000] max fitness: -0.524 [1358/2000] max fitness: -0.524 [1359/2000] max fitness: -0.524 [1360/2000] max fitness: -0.524 [1361/2000] max fitness: -0.524 [1362/2000] max fitness: -0.524 [1363/2000] max fitness: -0.524 [1364/2000] max fitness: -0.524 [1365/2000] max fitness: -0.524 [1366/2000] max fitness: -0.524 [1367/2000] max fitness: -0.524 [1368/2000] max fitness: -0.524 [1369/2000] max fitness: -0.524 [1370/2000] max fitness: -0.524 [1371/2000] max fitness: -0.524 [1372/2000] max fitness: -0.524 [1373/2000] max fitness: -0.524 [1374/2000] max fitness: -0.524 [1375/2000] max fitness: -0.524 [1376/2000] max fitness: -0.524 [1377/2000] max fitness: -0.524 [1378/2000] max fitness: -0.524 [1379/2000] max fitness: -0.524 [1380/2000] max fitness: -0.524 [1381/2000] max fitness: -0.524 [1382/2000] max fitness: -0.524 [1383/2000] max fitness: -0.524 [1384/2000] max fitness: -0.524 [1385/2000] max fitness: -0.524 [1386/2000] max fitness: -0.524 [1387/2000] max fitness: -0.524 [1388/2000] max fitness: -0.524 [1389/2000] max fitness: -0.524 [1390/2000] max fitness: -0.524 [1391/2000] max fitness: -0.524 [1392/2000] max fitness: -0.524 [1393/2000] max fitness: -0.524 [1394/2000] max fitness: -0.524 [1395/2000] max fitness: -0.524 [1396/2000] max fitness: -0.524 [1397/2000] max fitness: -0.524 [1398/2000] max fitness: -0.524 [1399/2000] max fitness: -0.524 [1400/2000] max fitness: -0.524 [1401/2000] max fitness: -0.524 [1402/2000] max fitness: -0.524 [1403/2000] max fitness: -0.524 [1404/2000] max fitness: -0.524 [1405/2000] max fitness: -0.524 [1406/2000] max fitness: -0.524 [1407/2000] max fitness: -0.524 [1408/2000] max fitness: -0.524 [1409/2000] max fitness: -0.524 [1410/2000] max fitness: -0.524 [1411/2000] max fitness: -0.524 [1412/2000] max fitness: -0.524 [1413/2000] max fitness: -0.524 [1414/2000] max fitness: -0.524 [1415/2000] max fitness: -0.524 [1416/2000] max fitness: -0.524 [1417/2000] max fitness: -0.524 [1418/2000] max fitness: -0.524 [1419/2000] max fitness: -0.524 [1420/2000] max fitness: -0.524 [1421/2000] max fitness: -0.524 [1422/2000] max fitness: -0.524 [1423/2000] max fitness: -0.524 [1424/2000] max fitness: -0.524 [1425/2000] max fitness: -0.524 [1426/2000] max fitness: -0.524 [1427/2000] max fitness: -0.524 [1428/2000] max fitness: -0.524 [1429/2000] max fitness: -0.524 [1430/2000] max fitness: -0.524 [1431/2000] max fitness: -0.524 [1432/2000] max fitness: -0.524 [1433/2000] max fitness: -0.524 [1434/2000] max fitness: -0.524 [1435/2000] max fitness: -0.524 [1436/2000] max fitness: -0.524 [1437/2000] max fitness: -0.524 [1438/2000] max fitness: -0.524 [1439/2000] max fitness: -0.524 [1440/2000] max fitness: -0.524 [1441/2000] max fitness: -0.524 [1442/2000] max fitness: -0.524 [1443/2000] max fitness: -0.524 [1444/2000] max fitness: -0.524 [1445/2000] max fitness: -0.524 [1446/2000] max fitness: -0.524 [1447/2000] max fitness: -0.524 [1448/2000] max fitness: -0.524 [1449/2000] max fitness: -0.524 [1450/2000] max fitness: -0.524 [1451/2000] max fitness: -0.524 [1452/2000] max fitness: -0.524 [1453/2000] max fitness: -0.524 [1454/2000] max fitness: -0.524 [1455/2000] max fitness: -0.524 [1456/2000] max fitness: -0.524 [1457/2000] max fitness: -0.524 [1458/2000] max fitness: -0.524 [1459/2000] max fitness: -0.524 [1460/2000] max fitness: -0.524 [1461/2000] max fitness: -0.524 [1462/2000] max fitness: -0.524 [1463/2000] max fitness: -0.524 [1464/2000] max fitness: -0.524 [1465/2000] max fitness: -0.524 [1466/2000] max fitness: -0.524 [1467/2000] max fitness: -0.524 [1468/2000] max fitness: -0.524 [1469/2000] max fitness: -0.524 [1470/2000] max fitness: -0.524 [1471/2000] max fitness: -0.524 [1472/2000] max fitness: -0.524 [1473/2000] max fitness: -0.524 [1474/2000] max fitness: -0.524 [1475/2000] max fitness: -0.524 [1476/2000] max fitness: -0.524 [1477/2000] max fitness: -0.524 [1478/2000] max fitness: -0.524 [1479/2000] max fitness: -0.524 [1480/2000] max fitness: -0.524 [1481/2000] max fitness: -0.524 [1482/2000] max fitness: -0.524 [1483/2000] max fitness: -0.524 [1484/2000] max fitness: -0.524 [1485/2000] max fitness: -0.524 [1486/2000] max fitness: -0.524 [1487/2000] max fitness: -0.524 [1488/2000] max fitness: -0.524 [1489/2000] max fitness: -0.524 [1490/2000] max fitness: -0.524 [1491/2000] max fitness: -0.524 [1492/2000] max fitness: -0.524 [1493/2000] max fitness: -0.524 [1494/2000] max fitness: -0.524 [1495/2000] max fitness: -0.524 [1496/2000] max fitness: -0.524 [1497/2000] max fitness: -0.476 [1498/2000] max fitness: -0.476 [1499/2000] max fitness: -0.476 [1500/2000] max fitness: -0.476 [1501/2000] max fitness: -0.476 [1502/2000] max fitness: -0.476 [1503/2000] max fitness: -0.476 [1504/2000] max fitness: -0.476 [1505/2000] max fitness: -0.476 [1506/2000] max fitness: -0.476 [1507/2000] max fitness: -0.476 [1508/2000] max fitness: -0.476 [1509/2000] max fitness: -0.476 [1510/2000] max fitness: -0.476 [1511/2000] max fitness: -0.476 [1512/2000] max fitness: -0.476 [1513/2000] max fitness: -0.476 [1514/2000] max fitness: -0.476 [1515/2000] max fitness: -0.476 [1516/2000] max fitness: -0.476 [1517/2000] max fitness: -0.476 [1518/2000] max fitness: -0.476 [1519/2000] max fitness: -0.476 [1520/2000] max fitness: -0.476 [1521/2000] max fitness: -0.476 [1522/2000] max fitness: -0.476 [1523/2000] max fitness: -0.476 [1524/2000] max fitness: -0.476 [1525/2000] max fitness: -0.476 [1526/2000] max fitness: -0.476 [1527/2000] max fitness: -0.476 [1528/2000] max fitness: -0.476 [1529/2000] max fitness: -0.476 [1530/2000] max fitness: -0.476 [1531/2000] max fitness: -0.476 [1532/2000] max fitness: -0.476 [1533/2000] max fitness: -0.476 [1534/2000] max fitness: -0.476 [1535/2000] max fitness: -0.476 [1536/2000] max fitness: -0.476 [1537/2000] max fitness: -0.476 [1538/2000] max fitness: -0.476 [1539/2000] max fitness: -0.476 [1540/2000] max fitness: -0.476 [1541/2000] max fitness: -0.476 [1542/2000] max fitness: -0.476 [1543/2000] max fitness: -0.476 [1544/2000] max fitness: -0.476 [1545/2000] max fitness: -0.476 [1546/2000] max fitness: -0.476 [1547/2000] max fitness: -0.476 [1548/2000] max fitness: -0.476 [1549/2000] max fitness: -0.476 [1550/2000] max fitness: -0.476 [1551/2000] max fitness: -0.476 [1552/2000] max fitness: -0.476 [1553/2000] max fitness: -0.476 [1554/2000] max fitness: -0.476 [1555/2000] max fitness: -0.476 [1556/2000] max fitness: -0.476 [1557/2000] max fitness: -0.476 [1558/2000] max fitness: -0.476 [1559/2000] max fitness: -0.476 [1560/2000] max fitness: -0.476 [1561/2000] max fitness: -0.476 [1562/2000] max fitness: -0.476 [1563/2000] max fitness: -0.476 [1564/2000] max fitness: -0.476 [1565/2000] max fitness: -0.476 [1566/2000] max fitness: -0.476 [1567/2000] max fitness: -0.476 [1568/2000] max fitness: -0.476 [1569/2000] max fitness: -0.476 [1570/2000] max fitness: -0.476 [1571/2000] max fitness: -0.476 [1572/2000] max fitness: -0.476 [1573/2000] max fitness: -0.476 [1574/2000] max fitness: -0.476 [1575/2000] max fitness: -0.476 [1576/2000] max fitness: -0.476 [1577/2000] max fitness: -0.476 [1578/2000] max fitness: -0.476 [1579/2000] max fitness: -0.476 [1580/2000] max fitness: -0.476 [1581/2000] max fitness: -0.476 [1582/2000] max fitness: -0.476 [1583/2000] max fitness: -0.476 [1584/2000] max fitness: -0.476 [1585/2000] max fitness: -0.476 [1586/2000] max fitness: -0.476 [1587/2000] max fitness: -0.476 [1588/2000] max fitness: -0.476 [1589/2000] max fitness: -0.476 [1590/2000] max fitness: 0.0 .. GENERATED FROM PYTHON SOURCE LINES 126-128 After the evolutionary search has ended, we print the expression with the highest fitness and plot the search progression and target and evolved functions. .. GENERATED FROM PYTHON SOURCE LINES 128-156 .. code-block:: default print(f"Final expression {pop.champion.to_sympy()} with fitness {pop.champion.fitness}") fig = plt.figure(1) plt.plot(history["fitness_champion"]) plt.ylim(1.1 * min(history["fitness_champion"]), 5) plt.xlabel("Generation") plt.ylabel("Loss (Fitness)") plt.legend(["Champion loss per generation"]) plt.title({pop.champion.to_sympy()}) fig.savefig("example_piecewise_fitness_history.pdf") x = np.arange(-5, 5, 0.01) champion_numpy = pop.champion.to_numpy() fig = plt.figure(2) plt.subplot(121) plt.plot(x, f_target(x), "b") plt.xlabel("x") plt.ylabel("y") plt.title("Target function") plt.legend(["target"]) plt.subplot(122) plt.plot(x, champion_numpy(x), "r") plt.xlabel("x") plt.ylabel("y") plt.title("Evolved function") plt.legend(["champion"]) fig.savefig("example_piecewise_target_function.pdf", dpi=300) .. rst-class:: sphx-glr-horizontal * .. image:: /auto_examples/images/sphx_glr_example_piecewise_target_function_001.png :alt: {Piecewise((x_0**2 + 1.0, x_0 >= 0), (-x_0, True))} :class: sphx-glr-multi-img * .. image:: /auto_examples/images/sphx_glr_example_piecewise_target_function_002.png :alt: Target function, Evolved function :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Final expression Piecewise((x_0**2 + 1.0, x_0 >= 0), (-x_0, True)) with fitness 0.0 .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 2 minutes 44.778 seconds) .. _sphx_glr_download_auto_examples_example_piecewise_target_function.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_piecewise_target_function.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_piecewise_target_function.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_