id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36,800 | pbil.py | DEAP_deap/examples/eda/pbil.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 2,789 | Python | .py | 65 | 37.646154 | 88 | 0.686021 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,801 | coop_base.py | DEAP_deap/examples/coev/coop_base.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,822 | Python | .py | 92 | 36.902174 | 91 | 0.686676 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,802 | coop_adapt.py | DEAP_deap/examples/coev/coop_adapt.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,952 | Python | .py | 110 | 37.590909 | 92 | 0.615704 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,803 | coop_gen.py | DEAP_deap/examples/coev/coop_gen.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,762 | Python | .py | 104 | 38.625 | 80 | 0.626295 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,804 | symbreg.py | DEAP_deap/examples/coev/symbreg.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,542 | Python | .py | 101 | 38.247525 | 88 | 0.653121 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,805 | coop_niche.py | DEAP_deap/examples/coev/coop_niche.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,365 | Python | .py | 79 | 36.936709 | 87 | 0.666054 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,806 | coop_evol.py | DEAP_deap/examples/coev/coop_evol.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 6,150 | Python | .py | 140 | 35.357143 | 105 | 0.607065 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,807 | hillis.py | DEAP_deap/examples/coev/hillis.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 5,679 | Python | .py | 129 | 39.674419 | 90 | 0.723481 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,808 | mo_rhv.py | DEAP_deap/examples/ga/mo_rhv.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 7,038 | Python | .py | 151 | 40.682119 | 108 | 0.676161 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,809 | onemax_short.py | DEAP_deap/examples/ga/onemax_short.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 2,067 | Python | .py | 49 | 39.183673 | 92 | 0.739022 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,810 | evoknn_jmlr.py | DEAP_deap/examples/ga/evoknn_jmlr.py | #!/usr/bin/env python2.7
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
... | 1,929 | Python | .py | 40 | 45.85 | 86 | 0.751992 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,811 | evoknn.py | DEAP_deap/examples/ga/evoknn.py | #!/usr/bin/env python2.7
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
... | 2,905 | Python | .py | 73 | 36.082192 | 109 | 0.713068 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,812 | kursawefct.py | DEAP_deap/examples/ga/kursawefct.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 2,940 | Python | .py | 73 | 34.890411 | 91 | 0.675202 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,813 | onemax_mp.py | DEAP_deap/examples/ga/onemax_mp.py | #!/usr/bin/env python2.7
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
... | 2,353 | Python | .py | 58 | 36.87931 | 96 | 0.725318 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,814 | sortingnetwork.py | DEAP_deap/examples/ga/sortingnetwork.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,361 | Python | .py | 103 | 33.300971 | 83 | 0.590705 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,815 | nsga3.py | DEAP_deap/examples/ga/nsga3.py | from math import factorial
import random
import matplotlib.pyplot as plt
import numpy
import pymop.factory
from deap import algorithms
from deap import base
from deap.benchmarks.tools import igd
from deap import creator
from deap import tools
# Problem definition
PROBLEM = "dtlz2"
NOBJ = 3
K = 10
NDIM = NOBJ + K - 1... | 4,200 | Python | .py | 101 | 37.425743 | 112 | 0.696903 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,816 | knn.py | DEAP_deap/examples/ga/knn.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,438 | Python | .py | 90 | 31.633333 | 103 | 0.608696 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,817 | xkcd.py | DEAP_deap/examples/ga/xkcd.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,336 | Python | .py | 97 | 40.896907 | 107 | 0.711511 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,818 | onemax_island_scoop.py | DEAP_deap/examples/ga/onemax_island_scoop.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 2,336 | Python | .py | 56 | 38.678571 | 92 | 0.746466 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,819 | evosn.py | DEAP_deap/examples/ga/evosn.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,982 | Python | .py | 113 | 38.336283 | 86 | 0.698016 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,820 | knapsack.py | DEAP_deap/examples/ga/knapsack.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,564 | Python | .py | 91 | 35.307692 | 81 | 0.693109 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,821 | onemax.py | DEAP_deap/examples/ga/onemax.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 5,307 | Python | .py | 121 | 38.380165 | 76 | 0.663105 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,822 | onemax_island.py | DEAP_deap/examples/ga/onemax_island.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 5,253 | Python | .py | 123 | 37.186992 | 143 | 0.692685 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,823 | onemax_multidemic.py | DEAP_deap/examples/ga/onemax_multidemic.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,148 | Python | .py | 78 | 35.589744 | 85 | 0.690718 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,824 | nsga2.py | DEAP_deap/examples/ga/nsga2.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 5,160 | Python | .py | 112 | 41.357143 | 108 | 0.689394 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,825 | tsp.py | DEAP_deap/examples/ga/tsp.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 2,494 | Python | .py | 59 | 39.40678 | 86 | 0.7378 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,826 | onemax_numpy.py | DEAP_deap/examples/ga/onemax_numpy.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,166 | Python | .py | 74 | 38.486486 | 94 | 0.703451 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,827 | nqueens.py | DEAP_deap/examples/ga/nqueens.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 3,343 | Python | .py | 77 | 39.558442 | 90 | 0.724669 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,828 | test_benchmarks.py | DEAP_deap/tests/test_benchmarks.py | """Test functions from deap/benchmarks."""
import sys
import unittest
from deap import base
from deap import creator
from deap.benchmarks import binary
class BenchmarkTest(unittest.TestCase):
"""Test object for unittest of deap/benchmarks."""
def setUp(self):
@binary.bin2float(0, 1023, 10)
... | 2,356 | Python | .py | 49 | 39.408163 | 79 | 0.652723 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,829 | test_mutation.py | DEAP_deap/tests/test_mutation.py | import unittest
from unittest import mock
from deap.tools.mutation import mutInversion
class MutationTest(unittest.TestCase):
def test_mutInverstion_size_zero_chromosome_returns_unchanged_chromosome_in_tuple(self):
chromosome = []
expected = []
self.assertEqual((expected,), mutInversion(... | 1,937 | Python | .py | 36 | 46.555556 | 119 | 0.651691 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,830 | test_algorithms.py | DEAP_deap/tests/test_algorithms.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 8,745 | Python | .py | 182 | 42.252747 | 114 | 0.693366 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,831 | test_statistics.py | DEAP_deap/tests/test_statistics.py | from operator import itemgetter
import unittest
import numpy
from deap import tools
class LogbookTest(unittest.TestCase):
def test_statistics_compile(self):
s = tools.Statistics()
s.register("mean", numpy.mean)
s.register("max", max)
res = s.compile([1, 2, 3, 4])
self.ass... | 957 | Python | .py | 21 | 38.571429 | 105 | 0.61828 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,832 | test_operators.py | DEAP_deap/tests/test_operators.py | import unittest
from unittest import mock
import random
from deap.tools import crossover
class TestCxOrdered(unittest.TestCase):
def setUp(self):
pass
def test_crossover(self):
a = [8, 7, 3, 4, 5, 6, 0, 2, 1, 9]
b = [7, 6, 0, 1, 2, 9, 8, 4, 3, 5]
expected_ap = [4, 5, 6, 1, 2,... | 1,069 | Python | .py | 26 | 33.115385 | 66 | 0.592449 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,833 | test_logbook.py | DEAP_deap/tests/test_logbook.py | import unittest
from deap import tools
class LogbookTest(unittest.TestCase):
def setUp(self):
self.logbook = tools.Logbook()
print()
def test_multi_chapters(self):
self.logbook.record(gen=0, evals=100, fitness={'obj 1': {'avg': 1.0, 'max': 10},
... | 1,732 | Python | .py | 31 | 42.870968 | 123 | 0.516854 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,834 | test_creator.py | DEAP_deap/tests/test_creator.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 2,611 | Python | .py | 62 | 36.225806 | 73 | 0.619574 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,835 | test_pickle.py | DEAP_deap/tests/test_pickle.py |
import sys
import unittest
import array
import pickle
import operator
import functools
import numpy
from deap import creator
from deap import base
from deap import gp
from deap import tools
def func():
return "True"
class Pickling(unittest.TestCase):
def setUp(self):
creator.create("FitnessMax",... | 7,281 | Python | .py | 138 | 44.891304 | 135 | 0.655323 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,836 | test_convergence.py | DEAP_deap/tests/test_convergence.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 16,010 | Python | .py | 326 | 38.04908 | 118 | 0.620825 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,837 | test_init.py | DEAP_deap/tests/test_init.py | from functools import partial
import random
import unittest
from deap import tools
class LogbookTest(unittest.TestCase):
def test_statistics_compile(self):
length = 10
gen_idx = partial(random.sample, list(range(length)), length)
i = tools.initIterate(list, gen_idx)
self.assertSet... | 354 | Python | .py | 10 | 30.5 | 69 | 0.727273 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,838 | test_multiproc.py | DEAP_deap/tests/test_multiproc.py | import multiprocessing
from deap import base
from deap import creator
def _evalOneMax(individual):
return sum(individual),
def test_multiproc():
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
to... | 644 | Python | .py | 17 | 33.352941 | 66 | 0.709208 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,839 | conf.py | DEAP_deap/doc/conf.py | # -*- coding: utf-8 -*-
#
# DEAP documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 30 13:21:43 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | 8,295 | Python | .py | 189 | 41.968254 | 120 | 0.719543 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,840 | copybutton.js | DEAP_deap/doc/_static/copybutton.js | $(document).ready(function() {
/* Add a [>>>] button on the top-right corner of code samples to hide
* the >>> and ... prompts and the output and thus make the code
* copyable. */
var div = $('.highlight-python .highlight,' +
'.highlight-python3 .highlight')
var pre = div.find('pre... | 2,495 | Python | .py | 53 | 38.415094 | 94 | 0.564807 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,841 | ga_onemax_numpy.rst | DEAP_deap/doc/examples/ga_onemax_numpy.rst | ============================
One Max Problem: Using Numpy
============================
The numpy version one max genetic algorithm example is very similar to one max
short example. The individual class is inherited from the :class:`numpy.ndarray`.
.. literalinclude:: /../examples/ga/onemax_numpy.py
:lines: 18,26
... | 1,036 | Python | .py | 21 | 47.380952 | 81 | 0.734856 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,842 | nsga3_ref_points_combined.py | DEAP_deap/doc/code/examples/nsga3_ref_points_combined.py | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy
from deap import tools
NOBJ = 3
P = [2, 1]
SCALES = [1, 0.5]
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(111, projection="3d")
# the coordinate origin
ax.scatter(0, 0, 0, c="k", marker="+", s=100)
# reference points
# Pa... | 1,080 | Python | .py | 33 | 31.333333 | 115 | 0.691715 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,843 | nsga3_ref_points_combined_plot.py | DEAP_deap/doc/code/examples/nsga3_ref_points_combined_plot.py | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy
from deap import tools
NOBJ = 3
P = [2, 1]
SCALES = [1, 0.5]
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(111, projection="3d")
# the coordinate origin
ax.scatter(0, 0, 0, c="k", marker="+", s=100)
# reference points
# Pa... | 1,086 | Python | .py | 33 | 31.515152 | 115 | 0.687739 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,844 | nsga3_ref_points.py | DEAP_deap/doc/code/examples/nsga3_ref_points.py | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy
from deap import tools
NOBJ = 3
P = [12]
SCALES = [1]
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(111, projection="3d")
# the coordinate origin
ax.scatter(0, 0, 0, c="k", marker="+", s=100)
# reference points
ref_points ... | 875 | Python | .py | 25 | 33.68 | 84 | 0.712589 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,845 | rastrigin.py | DEAP_deap/doc/code/benchmarks/rastrigin.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def rastrigin_arg0(sol):
return benchmarks.rastrigin(sol)[0]
fig = plt.figure()
ax = Axes3D(fig, azim = -29, elev = 50)
X = np.arange(-5, 5... | 614 | Python | .py | 20 | 28.8 | 115 | 0.712585 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,846 | kursawe.py | DEAP_deap/doc/code/benchmarks/kursawe.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
X = np.arange(-5, 5, 0.1)
Y = np.arange(-5, 5, 0.1)
X, Y = np.meshgrid(X, Y)
Z1 = np.zeros(X.shape)
Z2 = np.zeros(X.shape)
for i in range(X.sha... | 855 | Python | .py | 27 | 29.666667 | 75 | 0.682095 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,847 | himmelblau.py | DEAP_deap/doc/code/benchmarks/himmelblau.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def himmelblau_arg0(sol):
return benchmarks.himmelblau(sol)[0]
fig = plt.figure()
ax = Axes3D(fig, az... | 671 | Python | .py | 21 | 30.095238 | 116 | 0.723602 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,848 | schwefel.py | DEAP_deap/doc/code/benchmarks/schwefel.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def schwefel_arg0(sol):
return benchmarks.schwefel(sol)[0]
fig = plt.figure()
# ax = Axes3D(fig, azim = -29, elev = 50)
ax = Axes3D(fig)
X ... | 636 | Python | .py | 21 | 28.428571 | 114 | 0.714286 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,849 | schaffer.py | DEAP_deap/doc/code/benchmarks/schaffer.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def schaffer_arg0(sol):
return benchmarks.schaffer(sol)[0]
fig = plt.figure()
ax = Axes3D(fig, azim = -29, elev = 60)
# ax = Axes3D(fig)
X ... | 636 | Python | .py | 21 | 28.428571 | 114 | 0.711002 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,850 | shekel.py | DEAP_deap/doc/code/benchmarks/shekel.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
#NUMMAX = 5
#A = 10 * np.random.rand(NUMMAX, 2)
#C = np.random.rand(NUMMAX)
A = [[0.5, 0.5], [0.25, 0.25]... | 876 | Python | .py | 27 | 30.703704 | 112 | 0.674197 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,851 | ackley.py | DEAP_deap/doc/code/benchmarks/ackley.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def ackley_arg0(sol):
return benchmarks.ackley(sol)[0]
fig = plt.figure()
# ax = Axes3D(fig, azim = -... | 683 | Python | .py | 22 | 29.227273 | 112 | 0.716031 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,852 | h1.py | DEAP_deap/doc/code/benchmarks/h1.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def h1_arg0(sol):
return benchmarks.h1(sol)[0]
fig = plt.figure()
# ax = Axes3D(fig, azim = -29, elev... | 671 | Python | .py | 22 | 28.681818 | 108 | 0.710731 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,853 | bohachevsky.py | DEAP_deap/doc/code/benchmarks/bohachevsky.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def bohachevsky_arg0(sol):
return benchmarks.bohachevsky(sol)[0]
fig = plt.figure()
ax = Axes3D(fig, ... | 699 | Python | .py | 22 | 29.909091 | 117 | 0.722388 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,854 | rosenbrock.py | DEAP_deap/doc/code/benchmarks/rosenbrock.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def rosenbrock_arg0(sol):
return benchmarks.rosenbrock(sol)[0]
fig = plt.figure()
# ax = Axes3D(fig, ... | 691 | Python | .py | 22 | 29.590909 | 116 | 0.719457 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,855 | griewank.py | DEAP_deap/doc/code/benchmarks/griewank.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def griewank_arg0(sol):
return benchmarks.griewank(sol)[0]
fig = plt.figure()
ax = Axes3D(fig, azim = -29, elev = 40)
# ax = Axes3D(fig)
X ... | 634 | Python | .py | 21 | 28.333333 | 114 | 0.710049 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,856 | movingsc1.py | DEAP_deap/doc/code/benchmarks/movingsc1.py | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
import random
rnd = random.Random()
rnd.seed(128)
from deap.benchmarks import movingpeaks
sc = movingpeaks.SCENARIO_1
sc["uniform_height"] = 0
sc["uniform_width"] = 0
mp ... | 727 | Python | .py | 25 | 27.44 | 119 | 0.721902 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,857 | 2_2_2_permutation.py | DEAP_deap/doc/code/tutorials/part_2/2_2_2_permutation.py | ## 2.2.2 Permutation
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, fitness=creator.FitnessMin)
IND_SIZE=10
toolbox = base.Toolbox()
toolbox.register("indices", random.sample, range(IN... | 443 | Python | .py | 12 | 34.166667 | 69 | 0.772834 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,858 | 2_3_2_grid.py | DEAP_deap/doc/code/tutorials/part_2/2_3_2_grid.py | ## 2.3.2 Grid
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, fitness=creator.FitnessMin)
IND_SIZE = 20
toolbox = base.Toolbox()
toolbox.register("attr_float", random.random)
toolbox.re... | 658 | Python | .py | 17 | 36.294118 | 76 | 0.763407 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,859 | 2_2_5_particle.py | DEAP_deap/doc/code/tutorials/part_2/2_2_5_particle.py | ## 2.2.6 Particle
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0))
creator.create("Particle", list, fitness=creator.FitnessMax, speed=None,
smin=None, smax=None, best=None)
def initParticle(pcls, size, pm... | 679 | Python | .py | 17 | 35.647059 | 72 | 0.700608 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,860 | 2_2_6_funky_one.py | DEAP_deap/doc/code/tutorials/part_2/2_2_6_funky_one.py | ## 2.2.6 Funky one
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0))
creator.create("Individual", list, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
INT_MIN, INT_MAX = 5, 10
FLT_MIN, FLT_MAX = -0.2, 0.8
N_CYCLES... | 587 | Python | .py | 15 | 36.666667 | 67 | 0.740741 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,861 | 2_3_3_swarm.py | DEAP_deap/doc/code/tutorials/part_2/2_3_3_swarm.py | ## 2.2.6 Particle
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0))
creator.create("Particle", list, fitness=creator.FitnessMax, speed=None,
smin=None, smax=None, best=None)
creator.create("Swarm", list, gb... | 827 | Python | .py | 19 | 39.578947 | 76 | 0.720149 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,862 | 2_3_1_bag.py | DEAP_deap/doc/code/tutorials/part_2/2_3_1_bag.py | ## 2.3.1 Bag
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, fitness=creator.FitnessMin)
IND_SIZE = 20
toolbox = base.Toolbox()
toolbox.register("attr_int", random.randint, -20, 20)
too... | 535 | Python | .py | 14 | 35.642857 | 74 | 0.76938 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,863 | 2_2_3_arithmetic_expression.py | DEAP_deap/doc/code/tutorials/part_2/2_2_3_arithmetic_expression.py | ## 2.2.3 Arithmetic expression
import operator
from deap import base
from deap import creator
from deap import gp
from deap import tools
pset = gp.PrimitiveSet("MAIN", arity=1)
pset.addPrimitive(operator.add, 2)
pset.addPrimitive(operator.sub, 2)
pset.addPrimitive(operator.mul, 2)
creator.create("FitnessMin", base.F... | 644 | Python | .py | 17 | 34.764706 | 74 | 0.760835 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,864 | 2_2_4_evolution_strategy.py | DEAP_deap/doc/code/tutorials/part_2/2_2_4_evolution_strategy.py | ## 2.2.4 Evolution Strategy
import array
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", array.array, typecode="d",
fitness=creator.FitnessMin, strategy=None)
creator.create("Str... | 832 | Python | .py | 21 | 35.380952 | 78 | 0.700993 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,865 | 2_3_5_seeding_a_population.py | DEAP_deap/doc/code/tutorials/part_2/2_3_5_seeding_a_population.py | # 2.3.5 Seeding a population
import json
from deap import base
from deap import creator
creator.create("FitnessMax", base.Fitness, weights=(1.0, 1.0))
creator.create("Individual", list, fitness=creator.FitnessMax)
def initIndividual(icls, content):
return icls(content)
def initPopulation(pcls, ind_init, filenam... | 695 | Python | .py | 16 | 40.75 | 101 | 0.77381 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,866 | 2_2_1_list_of_floats.py | DEAP_deap/doc/code/tutorials/part_2/2_2_1_list_of_floats.py | ## 2.2.1 List of floats
import random
import array
import numpy
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
IND_SIZE=10
toolbox = base.Toolbox()
toolbox.register("attr_... | 617 | Python | .py | 16 | 36.25 | 83 | 0.78727 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,867 | 2_3_4_demes.py | DEAP_deap/doc/code/tutorials/part_2/2_3_4_demes.py | ## 2.3.4 Demes
import random
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, fitness=creator.FitnessMin)
IND_SIZE=10
toolbox = base.Toolbox()
toolbox.register("indices", random.sample, range(IND_SIZE... | 585 | Python | .py | 15 | 36.533333 | 69 | 0.766372 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,868 | 2_1_fitness.py | DEAP_deap/doc/code/tutorials/part_2/2_1_fitness.py | ## 2.1 Fitness
from deap import base
from deap import creator
## FitnessMin
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
## FitnessMulti
creator.create("FitnessMulti", base.Fitness, weights=(-1.0, 1.0))
| 220 | Python | .py | 7 | 30.142857 | 65 | 0.758294 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,869 | 1_where_to_start.py | DEAP_deap/doc/code/tutorials/part_1/1_where_to_start.py | ## 1.1 Types
from deap import base, creator
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", list, fitness=creator.FitnessMin)
## 1.2 Initialization
import random
from deap import tools
IND_SIZE = 10
toolbox = base.Toolbox()
toolbox.register("attribute", random.random)
toolbox... | 2,141 | Python | .py | 53 | 33.830189 | 74 | 0.677435 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,870 | sortingnetwork.py | DEAP_deap/doc/code/tutorials/part_4/sortingnetwork.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,640 | Python | .py | 110 | 33.2 | 83 | 0.588652 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,871 | installSN.py | DEAP_deap/doc/code/tutorials/part_4/installSN.py | from distutils.core import setup, Extension
module1 = Extension('SNC',
sources = ['SNC.cpp'])
setup (name = 'SNC',
version = '1.0',
description = 'Sorting network evaluator',
ext_modules = [module1])
| 244 | Python | .py | 7 | 27.571429 | 49 | 0.6 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,872 | 4_5_home_made_eval_func.py | DEAP_deap/doc/code/tutorials/part_4/4_5_home_made_eval_func.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 5,529 | Python | .py | 130 | 36.592308 | 86 | 0.660212 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,873 | 4_4_Using_Cpp_NSGA.py | DEAP_deap/doc/code/tutorials/part_4/4_4_Using_Cpp_NSGA.py | # This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | 4,932 | Python | .py | 112 | 38.125 | 86 | 0.688388 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,874 | 3_6_using_the_toolbox.py | DEAP_deap/doc/code/tutorials/part_3/3_6_using_the_toolbox.py | ## 3.6 Using the Toolbox
from deap import base
from deap import tools
toolbox = base.Toolbox()
def evaluateInd(individual):
# Do some computation
result = sum(individual)
return result,
toolbox.register("mate", tools.cxTwoPoint)
toolbox.register("mutate", tools.mutGaussian, mu=0, sigma=1, indpb=0.2)
tool... | 1,907 | Python | .py | 46 | 36.956522 | 92 | 0.730562 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,875 | 3_7_variations.py | DEAP_deap/doc/code/tutorials/part_3/3_7_variations.py | ## 3.7 Variations
import random
from deap import base
from deap import creator
from deap import tools
## Data structure and initializer creation
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
toolbox.register("attr_f... | 1,598 | Python | .py | 36 | 41.5 | 92 | 0.767742 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,876 | 3_8_algorithms.py | DEAP_deap/doc/code/tutorials/part_3/3_8_algorithms.py | ## 3.7 Variations
import random
from deap import base
from deap import creator
from deap import tools
## Data structure and initializer creation
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual", list, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
toolbox.register("attr_f... | 1,050 | Python | .py | 25 | 40.28 | 92 | 0.788177 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,877 | 3_next_step.py | DEAP_deap/doc/code/tutorials/part_3/3_next_step.py | ## 3.1 A First Individual
import random
from deap import base
from deap import creator
from deap import tools
IND_SIZE = 5
creator.create("FitnessMin", base.Fitness, weights=(-1.0, -1.0))
creator.create("Individual", list, fitness=creator.FitnessMin)
toolbox = base.Toolbox()
toolbox.register("attr_float", random.ra... | 1,523 | Python | .py | 44 | 32.568182 | 73 | 0.72101 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,878 | stats.py | DEAP_deap/doc/code/tutorials/part_3/stats.py | import random
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
random.seed(0)
stats = tools.Statistics(key=lambda ind: ind.fitness.values)
stats.register("avg", numpy.mean)
stats.register("std", numpy.std)
stats.register("min", numpy.min)
stats.register(... | 1,426 | Python | .py | 37 | 36 | 92 | 0.762355 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,879 | 3_6_2_tool_decoration.py | DEAP_deap/doc/code/tutorials/part_3/3_6_2_tool_decoration.py | from deap import base
from deap import creator
from deap import tools
toolbox = base.Toolbox()
MIN, MAX = -5, 5
def checkBounds(min, max):
def decorator(func):
def wrapper(*args, **kargs):
offspring = func(*args, **kargs)
for child in offspring:
for i in range(len(c... | 771 | Python | .py | 22 | 26.409091 | 60 | 0.593289 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,880 | multistats.py | DEAP_deap/doc/code/tutorials/part_3/multistats.py | import operator
import random
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import gp
from deap import tools
random.seed(0)
stats_fit = tools.Statistics(key=lambda ind: ind.fitness.values)
stats_size = tools.Statistics(key=len)
mstats = tools.MultiStatistics(fitne... | 1,792 | Python | .py | 43 | 39.744186 | 83 | 0.765688 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,881 | logbook.py | DEAP_deap/doc/code/tutorials/part_3/logbook.py | import pickle
from deap import tools
from stats import record
logbook = tools.Logbook()
logbook.record(gen=0, evals=30, **record)
print(logbook)
gen, avg = logbook.select("gen", "avg")
with open("logbook.pkl", "w") as lb_file:
pickle.dump(logbook, lb_file)
# Cleaning the pickle file ...
import os
os.remove("log... | 1,407 | Python | .py | 43 | 31.093023 | 62 | 0.718425 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,882 | numpy.rst | DEAP_deap/doc/tutorials/advanced/numpy.rst | =====================
Inheriting from Numpy
=====================
DEAP's :class:`~deap.creator` allows to inherit from :class:`numpy.ndarray`
so that individuals can have the properties of the powerful
`Numpy <http://http://docs.scipy.org/doc/numpy/>`_ library. As with any other
base class, inheriting from a :class:`n... | 4,153 | Python | .py | 103 | 38.631068 | 104 | 0.6916 | DEAP/deap | 5,751 | 1,120 | 279 | LGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,883 | conftest.py | coala_coala/conftest.py | import os
import webbrowser
def pytest_unconfigure(config):
htmlcov_path = os.path.join('htmlcov', 'index.html')
if (hasattr(config.option, 'cov_report') and
'html' in config.option.cov_report and
os.path.isfile(htmlcov_path)):
try:
webbrowser.open_new_tab(htmlcov_p... | 375 | Python | .py | 11 | 26.363636 | 56 | 0.640884 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,884 | setup.py | coala_coala/setup.py | #!/usr/bin/env python3
import datetime
import locale
import os
import platform
import sys
from os import getenv
from subprocess import call
import pip
import setuptools.command.build_py
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
from coalib import assert_suppo... | 14,190 | Python | .py | 360 | 30.95 | 80 | 0.611699 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,885 | conf.py | coala_coala/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# coala documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 6 21:18:18 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... | 9,771 | Python | .py | 235 | 39.617021 | 79 | 0.716128 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,886 | coala_format.py | coala_coala/coalib/coala_format.py | import logging
import sys
from coalib.coala import main as coala_main
def main(debug=False):
logging.warning('Use of `coala-format` executable is deprecated, use '
'`coala --format` instead.')
sys.argv.append('--format')
return coala_main(debug=debug)
if __name__ == '__main__':
... | 339 | Python | .py | 10 | 28.6 | 74 | 0.661491 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,887 | coala.py | coala_coala/coalib/coala.py | # This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be usefu... | 4,858 | Python | .py | 102 | 36.058824 | 79 | 0.621593 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,888 | coala_json.py | coala_coala/coalib/coala_json.py | import logging
import sys
from coalib.coala import main as coala_main
def main(debug=False):
logging.warning('Use of `coala-json` executable is deprecated, use '
'coala --json` instead.')
sys.argv.append('--json')
return coala_main(debug=debug)
if __name__ == '__main__':
sys.e... | 332 | Python | .py | 10 | 27.9 | 72 | 0.657143 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,889 | coala_delete_orig.py | coala_coala/coalib/coala_delete_orig.py | import logging
import os
from coalib.output.Logging import configure_logging
from coalib.parsing import Globbing
from coalib.settings.ConfigurationGathering import get_config_directory
from coalib.settings.Section import Section
from coalib.parsing.Globbing import glob_escape
def main(log_printer=None, section: Sect... | 1,479 | Python | .py | 34 | 31.764706 | 77 | 0.586063 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,890 | __init__.py | coala_coala/coalib/__init__.py | """
The coalib package is a collection of various subpackages regarding
writing, executing and editing bears. Various other packages such as
formatting and settings are also included in coalib.
"""
import sys
from os.path import join, dirname
VERSION_FILE = join(dirname(__file__), 'VERSION')
def get_version():
... | 590 | Python | .py | 17 | 31.235294 | 68 | 0.719361 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,891 | coala_ci.py | coala_coala/coalib/coala_ci.py | import logging
import sys
from coalib.coala import main as coala_main
def main(debug=False):
logging.warning('Use of `coala-ci` executable is deprecated, use '
'`coala --non-interactive` instead.')
sys.argv.append('--non-interactive')
return coala_main(debug=debug)
if __name__ == ... | 353 | Python | .py | 10 | 30 | 70 | 0.669643 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,892 | coala_main.py | coala_coala/coalib/coala_main.py | from collections import OrderedDict
import logging
import os
import platform
from coalib import VERSION
from coalib.misc.Exceptions import get_exitcode
from coalib.output.Interactions import fail_acquire_settings
from coalib.output.Logging import CounterHandler
from coalib.processes.Processing import execute_section, ... | 10,033 | Python | .py | 204 | 35.436275 | 80 | 0.576503 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,893 | coala_modes.py | coala_coala/coalib/coala_modes.py | def mode_normal(console_printer, log_printer, args, debug=False):
"""
This is the default coala mode. User interaction is allowed in this mode.
:param console_printer: Object to print messages on the console.
:param log_printer: Deprecated.
:param args: Alternative pre-parsed CLI arg... | 3,241 | Python | .py | 79 | 31.873418 | 77 | 0.642038 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,894 | InvalidFilterException.py | coala_coala/coalib/parsing/InvalidFilterException.py | from coalib.parsing.filters import available_filters
class InvalidFilterException(LookupError):
def __init__(self, filter_name):
joined_available_filters = ', '.join(sorted(available_filters))
super().__init__(
f'{filter_name!r} is an invalid filter. Available filters:'
f' ... | 349 | Python | .py | 7 | 42.285714 | 71 | 0.676471 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,895 | Globbing.py | coala_coala/coalib/parsing/Globbing.py | import os
import platform
import re
from functools import lru_cache
from coala_utils.decorators import yield_once
from coalib.misc.Constants import GLOBBING_SPECIAL_CHARS
def _end_of_set_index(string, start_index):
"""
Returns the position of the appropriate closing bracket for a glob set in
string.
... | 13,382 | Python | .py | 333 | 32.315315 | 80 | 0.622726 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,896 | ConfParser.py | coala_coala/coalib/parsing/ConfParser.py | import os
from collections import OrderedDict
from types import MappingProxyType
import logging
from coalib.misc import Constants
from coalib.parsing.LineParser import LineParser
from coalib.settings.Section import Section
from coalib.settings.Setting import Setting
from coalib.bearlib import deprecate_settings
from c... | 6,473 | Python | .py | 141 | 29.276596 | 80 | 0.507851 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,897 | __init__.py | coala_coala/coalib/parsing/__init__.py | """
The StringProcessing module contains various functions for extracting
information out of strings.
Most of them support regexes for advanced pattern matching.
"""
| 167 | Python | .py | 5 | 32.2 | 69 | 0.838509 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,898 | DefaultArgParser.py | coala_coala/coalib/parsing/DefaultArgParser.py | import argparse
import os
from coalib.misc import Constants
from coalib.parsing.filters import available_filters
# argcomplete is a delayed optional import
# This variable may be None, the module, or False
argcomplete = None
class CustomFormatter(argparse.RawDescriptionHelpFormatter):
"""
A Custom Formatter... | 11,863 | Python | .py | 243 | 39.934156 | 80 | 0.634191 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
36,899 | CliParsing.py | coala_coala/coalib/parsing/CliParsing.py | import os
from argparse import ArgumentParser
from collections import OrderedDict
from coalib.parsing.DefaultArgParser import default_arg_parser
from coalib.parsing.LineParser import LineParser
from coalib.settings.Section import Section, append_to_sections
from coalib.bearlib import deprecate_settings
@deprecate_se... | 5,756 | Python | .py | 117 | 33.273504 | 79 | 0.516009 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |