diff --git a/README.md b/README.md index a94d7e2..f9e75d4 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,13 @@ from mpmath import power as pw from typing import List from pycellga.optimizer import cga -from pycellga.recombination import ByteOnePointCrossover -from pycellga.mutation import ByteMutationRandom -from pycellga.selection import TournamentSelection -from pycellga.problems import AbstractProblem +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover +from pycellga.mutation.byte_mutation_random import ByteMutationRandom +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType + class ExampleProblem(AbstractProblem): def __init__(self, n_var): diff --git a/docs/pycellga.problems.rst b/docs/pycellga.problems.rst index 3288387..957f17a 100644 --- a/docs/pycellga.problems.rst +++ b/docs/pycellga.problems.rst @@ -47,8 +47,9 @@ Below is an example of how to create a custom optimization problem by inheriting .. code-block:: python - from pycellga.problems import AbstractProblem + from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType + from typing import List import numpy as np diff --git a/docs/usage_examples.rst b/docs/usage_examples.rst index d3d08d7..87af42e 100644 --- a/docs/usage_examples.rst +++ b/docs/usage_examples.rst @@ -20,10 +20,10 @@ Here’s how we can define this problem in Python using the `ExampleProblem` cla from typing import List from pycellga.optimizer import cga - from pycellga.recombination import ByteOnePointCrossover - from pycellga.mutation import ByteMutationRandom - from pycellga.selection import TournamentSelection - from pycellga.problems import AbstractProblem + from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover + from pycellga.mutation.byte_mutation_random import ByteMutationRandom + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType class ExampleProblem(AbstractProblem): @@ -83,10 +83,10 @@ The Alpha Cellular Genetic Algorithm optimizes a real-valued problem using Blxal from typing import List from pycellga.optimizer import alpha_cga - from pycellga.recombination import BlxalphaCrossover - from pycellga.mutation import FloatUniformMutation - from pycellga.selection import TournamentSelection - from pycellga.problems import AbstractProblem + from pycellga.recombination.blxalpha_crossover import BlxalphaCrossover + from pycellga.mutation.float_uniform_mutation import FloatUniformMutation + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType @@ -130,11 +130,10 @@ The Alpha Cellular Genetic Algorithm optimizes a real-valued problem using Blxal The Compact Cellular Genetic Algorithm optimizes a binary problem where the goal is to maximize the number of `1`s. .. code-block:: python - from pycellga.optimizer import ccga - from pycellga.selection import TournamentSelection - from pycellga.problems import AbstractProblem + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType class ExampleProblem(AbstractProblem): @@ -174,8 +173,8 @@ The Machine-Coded Compact Cellular Genetic Algorithm solves real-valued optimiza import numpy as np from pycellga.optimizer import mcccga - from pycellga.selection import TournamentSelection - from pycellga.problems import AbstractProblem + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType class RealProblem(AbstractProblem): @@ -216,10 +215,10 @@ The Synchronous Cellular Genetic Algorithm optimizes a real-valued problem in a from typing import List from pycellga.optimizer import sync_cga - from pycellga.recombination import BlxalphaCrossover - from pycellga.mutation import FloatUniformMutation - from pycellga.selection import TournamentSelection - from pycellga.problems import AbstractProblem + from pycellga.recombination.blxalpha_crossover import BlxalphaCrossover + from pycellga.mutation.float_uniform_mutation import FloatUniformMutation + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType @@ -335,7 +334,7 @@ For permutation-based optimization problems, the following option is available: .. code-block:: python - from problems.single_objective.discrete.permutation.tsp import Tsp + from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp These built-in problems provide a diverse set of test cases, allowing users to explore `pycellga`'s capabilities across a wide range of optimization challenges. Users can also define custom problems to suit their specific needs. @@ -347,8 +346,8 @@ Choose from selection methods: .. code-block:: python - from selection.tournament_selection import TournamentSelection - from selection.roulette_wheel_selection import RouletteWheelSelection + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.selection.roulette_wheel_selection import RouletteWheelSelection **Recombination Operators** @@ -395,10 +394,11 @@ Optimize a binary problem using tournament selection, one-point crossover, and b .. code-block:: python from pycellga.optimizer import cga - from problems.single_objective.discrete.binary.one_max import OneMax - from pycellga.selection import TournamentSelection - from pycellga.recombination import OnePointCrossover - from pycellga.mutation import BitFlipMutation + from pycellga.problems.single_objective.discrete.binary.one_max import OneMax + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.recombination.one_point_crossover import OnePointCrossover + from pycellga.mutation.bit_flip_mutation import BitFlipMutation + result = cga( n_cols=5, @@ -424,10 +424,10 @@ Solve a real-valued optimization problem using Byte One Point Crossover and Byte .. code-block:: python from pycellga.optimizer import cga - from problems.single_objective.continuous.ackley import Ackley - from pycellga.selection import RouletteWheelSelection - from pycellga.recombination import ByteOnePointCrossover - from pycellga.mutation import ByteMutation + from pycellga.problems.single_objective.continuous.ackley import Ackley + from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover + from pycellga.selection.roulette_wheel_selection import RouletteWheelSelection + from pycellga.mutation.byte_mutation import ByteMutation result = cga( n_cols=5, @@ -452,10 +452,10 @@ Optimize a TSP using permutation encoding, PMX crossover, and swap mutation. .. code-block:: python from pycellga.optimizer import cga - from problems.single_objective.discrete.permutation.tsp import Tsp - from pycellga.selection import TournamentSelection - from pycellga.recombination import PMXCrossover - from pycellga.mutation import SwapMutation + from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp + from pycellga.selection.tournament_selection import TournamentSelection + from pycellga.recombination.pmx_crossover import PMXCrossover + from pycellga.mutation.swap_mutation import SwapMutation result = cga( n_cols=5, diff --git a/paper/paper.md b/paper/paper.md index e7a20d9..1c5bcf7 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -103,10 +103,10 @@ from mpmath import power as pw from typing import List from pycellga.optimizer import cga -from pycellga.recombination import ByteOnePointCrossover -from pycellga.mutation import ByteMutationRandom -from pycellga.selection import TournamentSelection -from pycellga.problems import AbstractProblem +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover +from pycellga.mutation.byte_mutation_random import ByteMutationRandom +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem from pycellga.common import GeneType class ExampleProblem(AbstractProblem): diff --git a/pycellga/__init__.py b/pycellga/__init__.py index 344d32e..e69de29 100644 --- a/pycellga/__init__.py +++ b/pycellga/__init__.py @@ -1,12 +0,0 @@ -from . import example -from . import mutation -from . import neighborhoods -from . import problems -from . import recombination -from . import selection -from . import optimizer -from . import population -from . import individual -from . import grid -from . import byte_operators - diff --git a/pycellga/example/__init__.py b/pycellga/example/__init__.py index 18ab0b2..e69de29 100644 --- a/pycellga/example/__init__.py +++ b/pycellga/example/__init__.py @@ -1,10 +0,0 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -import optimizer -from individual import GeneType -from . import example_alpha_cga -from . import example_ccga -from . import example_cga -from . import example_mcccga -from . import example_sync_cga \ No newline at end of file diff --git a/pycellga/example/example_alpha_cga.py b/pycellga/example/example_alpha_cga.py index b2b569c..1d82335 100644 --- a/pycellga/example/example_alpha_cga.py +++ b/pycellga/example/example_alpha_cga.py @@ -1,16 +1,12 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) - from numpy import power as pw from typing import List -from optimizer import alpha_cga -from recombination import BlxalphaCrossover -from mutation import FloatUniformMutation -from selection import TournamentSelection -from problems import AbstractProblem -from common import GeneType +from pycellga.optimizer import alpha_cga +from pycellga.recombination.blxalpha_crossover import BlxalphaCrossover +from pycellga.mutation.float_uniform_mutation import FloatUniformMutation +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class ExampleProblem(AbstractProblem): diff --git a/pycellga/example/example_ccga.py b/pycellga/example/example_ccga.py index 51d2076..3cba841 100644 --- a/pycellga/example/example_ccga.py +++ b/pycellga/example/example_ccga.py @@ -1,11 +1,8 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) - -from optimizer import ccga -from selection import TournamentSelection -from problems import AbstractProblem -from common import GeneType + +from pycellga.optimizer import ccga +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class ExampleProblem(AbstractProblem): diff --git a/pycellga/example/example_cga.py b/pycellga/example/example_cga.py index dc68947..4af13a5 100644 --- a/pycellga/example/example_cga.py +++ b/pycellga/example/example_cga.py @@ -1,16 +1,13 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from mpmath import power as pw from typing import List -from optimizer import cga -from recombination import ByteOnePointCrossover -from mutation import ByteMutationRandom -from selection import TournamentSelection -from problems import AbstractProblem -from common import GeneType +from pycellga.optimizer import cga +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover +from pycellga.mutation.byte_mutation_random import ByteMutationRandom +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class ExampleProblem(AbstractProblem): diff --git a/pycellga/example/example_mcccga.py b/pycellga/example/example_mcccga.py index 9e01eea..c59deff 100644 --- a/pycellga/example/example_mcccga.py +++ b/pycellga/example/example_mcccga.py @@ -1,13 +1,10 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import numpy as np -from optimizer import mcccga -from selection import TournamentSelection -from problems import AbstractProblem -from common import GeneType +from pycellga.optimizer import mcccga +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class RealProblem(AbstractProblem): diff --git a/pycellga/example/example_sync_cga.py b/pycellga/example/example_sync_cga.py index 08fb284..e1ab06a 100644 --- a/pycellga/example/example_sync_cga.py +++ b/pycellga/example/example_sync_cga.py @@ -1,16 +1,13 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from numpy import power as pw from typing import List -from optimizer import sync_cga -from recombination import BlxalphaCrossover -from mutation import FloatUniformMutation -from selection import TournamentSelection -from problems import AbstractProblem -from common import GeneType +from pycellga.optimizer import sync_cga +from pycellga.recombination.blxalpha_crossover import BlxalphaCrossover +from pycellga.mutation.float_uniform_mutation import FloatUniformMutation +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class ExampleProblem(AbstractProblem): diff --git a/pycellga/individual.py b/pycellga/individual.py index 77e1f09..a1b3d41 100644 --- a/pycellga/individual.py +++ b/pycellga/individual.py @@ -1,13 +1,10 @@ -import sys -import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) - from numpy import random import numpy as np import random as rd -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Individual: diff --git a/pycellga/mutation/__init__.py b/pycellga/mutation/__init__.py index 9ba7b97..e69de29 100644 --- a/pycellga/mutation/__init__.py +++ b/pycellga/mutation/__init__.py @@ -1,21 +0,0 @@ -from . import bit_flip_mutation -from . import byte_mutation -from . import byte_mutation_random -from . import float_uniform_mutation -from . import insertion_mutation -from . import mutation_operator -from . import shuffle_mutation -from . import swap_mutation -from . import two_opt_mutation - -# -------------------------------- mutation -------------------------------- # -from mutation.bit_flip_mutation import BitFlipMutation -from mutation.byte_mutation import ByteMutation -from mutation.byte_mutation_random import ByteMutationRandom -from mutation.insertion_mutation import InsertionMutation -from mutation.shuffle_mutation import ShuffleMutation -from mutation.swap_mutation import SwapMutation -from mutation.two_opt_mutation import TwoOptMutation -from mutation.float_uniform_mutation import FloatUniformMutation -from mutation.mutation_operator import MutationOperator -# -------------------------------------------------------------------------- # \ No newline at end of file diff --git a/pycellga/mutation/bit_flip_mutation.py b/pycellga/mutation/bit_flip_mutation.py index 5e67003..6da215f 100644 --- a/pycellga/mutation/bit_flip_mutation.py +++ b/pycellga/mutation/bit_flip_mutation.py @@ -1,7 +1,7 @@ import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem -from mutation.mutation_operator import MutationOperator +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class BitFlipMutation(MutationOperator): """ diff --git a/pycellga/mutation/byte_mutation.py b/pycellga/mutation/byte_mutation.py index 2cd81e9..0b90bf5 100644 --- a/pycellga/mutation/byte_mutation.py +++ b/pycellga/mutation/byte_mutation.py @@ -1,8 +1,9 @@ -import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem import struct -from mutation.mutation_operator import MutationOperator +import numpy as np + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class ByteMutation(MutationOperator): """ diff --git a/pycellga/mutation/byte_mutation_random.py b/pycellga/mutation/byte_mutation_random.py index 45f6b2b..0185553 100644 --- a/pycellga/mutation/byte_mutation_random.py +++ b/pycellga/mutation/byte_mutation_random.py @@ -1,8 +1,9 @@ -import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem import struct -from mutation.mutation_operator import MutationOperator +import numpy as np + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class ByteMutationRandom(MutationOperator): """ diff --git a/pycellga/mutation/float_uniform_mutation.py b/pycellga/mutation/float_uniform_mutation.py index 3f7b990..da17c0b 100644 --- a/pycellga/mutation/float_uniform_mutation.py +++ b/pycellga/mutation/float_uniform_mutation.py @@ -1,7 +1,8 @@ import random -from individual import * -from problems.abstract_problem import AbstractProblem -from mutation.mutation_operator import MutationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class FloatUniformMutation(MutationOperator): """ diff --git a/pycellga/mutation/insertion_mutation.py b/pycellga/mutation/insertion_mutation.py index aeab5bf..715b0bc 100644 --- a/pycellga/mutation/insertion_mutation.py +++ b/pycellga/mutation/insertion_mutation.py @@ -1,7 +1,8 @@ import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem -from mutation.mutation_operator import MutationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class InsertionMutation(MutationOperator): """ diff --git a/pycellga/mutation/shuffle_mutation.py b/pycellga/mutation/shuffle_mutation.py index 9a4aa05..500ad68 100644 --- a/pycellga/mutation/shuffle_mutation.py +++ b/pycellga/mutation/shuffle_mutation.py @@ -1,8 +1,9 @@ import numpy as np import random as rd -from individual import * -from problems.abstract_problem import AbstractProblem -from mutation.mutation_operator import MutationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class ShuffleMutation(MutationOperator): """ diff --git a/pycellga/mutation/swap_mutation.py b/pycellga/mutation/swap_mutation.py index e99bfea..19cd3f4 100644 --- a/pycellga/mutation/swap_mutation.py +++ b/pycellga/mutation/swap_mutation.py @@ -1,7 +1,8 @@ import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem -from mutation.mutation_operator import MutationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class SwapMutation(MutationOperator): """ diff --git a/pycellga/mutation/two_opt_mutation.py b/pycellga/mutation/two_opt_mutation.py index e8cc3b5..6839ae0 100644 --- a/pycellga/mutation/two_opt_mutation.py +++ b/pycellga/mutation/two_opt_mutation.py @@ -1,7 +1,8 @@ import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem -from mutation.mutation_operator import MutationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.mutation_operator import MutationOperator class TwoOptMutation(MutationOperator): """ diff --git a/pycellga/neighborhoods/__init__.py b/pycellga/neighborhoods/__init__.py index 119cab3..e69de29 100644 --- a/pycellga/neighborhoods/__init__.py +++ b/pycellga/neighborhoods/__init__.py @@ -1,6 +0,0 @@ -from . import compact_9 -from . import compact_13 -from . import compact_21 -from . import compact_25 -from . import linear_5 -from . import linear_9 diff --git a/pycellga/optimizer.py b/pycellga/optimizer.py index 72a0b6a..14d4747 100644 --- a/pycellga/optimizer.py +++ b/pycellga/optimizer.py @@ -1,13 +1,14 @@ import random import numpy as np -import byte_operators -from population import * -from individual import * -from mutation.bit_flip_mutation import * -from selection.tournament_selection import * -from recombination.one_point_crossover import * -from problems.single_objective.discrete.binary.one_max import * + +from pycellga.byte_operators import * +from pycellga.population import * +from pycellga.individual import * +from pycellga.mutation.bit_flip_mutation import * +from pycellga.selection.tournament_selection import * +from pycellga.recombination.one_point_crossover import * +from pycellga.problems.single_objective.discrete.binary.one_max import * from typing import Callable, List, Tuple from collections.abc import Callable @@ -641,7 +642,7 @@ def mcccga( # Track the best solution in the initial population best_objectives.append(pop_list_ordered[0].fitness_value) - best_byte_ch = byte_operators.bits_to_floats(pop_list_ordered[0].chromosome) + best_byte_ch = bits_to_floats(pop_list_ordered[0].chromosome) best_ever_solution = Result( chromosome=best_byte_ch, fitness_value=pop_list_ordered[0].fitness_value, @@ -682,7 +683,7 @@ def mcccga( # Track the best fitness value and update the best solution if necessary best_objectives.append(best.fitness_value) - best_byte_ch = byte_operators.bits_to_floats(pop_list_ordered[0].chromosome) + best_byte_ch = bits_to_floats(pop_list_ordered[0].chromosome) if best.fitness_value < best_ever_solution.fitness_value: best_ever_solution = Result( @@ -694,12 +695,12 @@ def mcccga( # Calculate the mean fitness for the current generation mean = sum(map(lambda x: x.fitness_value, pop_list)) / len(pop_list) avg_objectives.append(mean) - best_byte_ch = byte_operators.bits_to_floats(best.chromosome) + best_byte_ch = bits_to_floats(best.chromosome) generation += 1 # Evaluate the final solution sampled from the probability vector - best_byte_ch = byte_operators.bits_to_floats(sample(vector)) + best_byte_ch = bits_to_floats(sample(vector)) best_byte_result = problem.f(best_byte_ch) # Update the best-ever solution if the sampled solution is better @@ -806,7 +807,7 @@ def generate_probability_vector(mins: List[float], maxs: List[float], ntries: in for _ in range(ntries): floats = random_vector_between(mins, maxs) - floatbits = byte_operators.floats_to_bits(floats) + floatbits = floats_to_bits(floats) for k in range(nbits): if floatbits[k] == 1: probvector[k] = probvector[k] + mutrate diff --git a/pycellga/population.py b/pycellga/population.py index 2b1c11d..ad8bc08 100644 --- a/pycellga/population.py +++ b/pycellga/population.py @@ -1,11 +1,13 @@ from typing import List -from individual import * -from grid import * -from neighborhoods.linear_9 import Linear9 -from byte_operators import * -from problems.abstract_problem import AbstractProblem from enum import Enum +from pycellga.grid import * +from pycellga.individual import * +from pycellga.byte_operators import * +from pycellga.neighborhoods.linear_9 import Linear9 +from pycellga.problems.abstract_problem import AbstractProblem + + class OptimizationMethod(Enum): """ diff --git a/pycellga/problems/__init__.py b/pycellga/problems/__init__.py index 59995d8..e69de29 100644 --- a/pycellga/problems/__init__.py +++ b/pycellga/problems/__init__.py @@ -1,43 +0,0 @@ -# ------------------- problems.single_objective.continuous -------------------------------- # -from problems.single_objective.continuous.ackley import * -from problems.single_objective.continuous.bentcigar import Bentcigar -from problems.single_objective.continuous.bohachevsky import Bohachevsky -from problems.single_objective.continuous.chichinadze import Chichinadze -from problems.single_objective.continuous.dropwave import Dropwave -from problems.single_objective.continuous.fms import Fms -from problems.single_objective.continuous.griewank import Griewank -from problems.single_objective.continuous.holzman import Holzman -from problems.single_objective.continuous.levy import Levy -from problems.single_objective.continuous.matyas import Matyas -from problems.single_objective.continuous.pow import Pow -from problems.single_objective.continuous.powell import Powell -from problems.single_objective.continuous.rastrigin import Rastrigin -from problems.single_objective.continuous.rosenbrock import Rosenbrock -from problems.single_objective.continuous.rothellipsoid import Rothellipsoid -from problems.single_objective.continuous.schaffer import Schaffer -from problems.single_objective.continuous.schaffer2 import Schaffer2 -from problems.single_objective.continuous.schwefel import Schwefel -from problems.single_objective.continuous.sphere import Sphere -from problems.single_objective.continuous.styblinskitang import StyblinskiTang -from problems.single_objective.continuous.sumofdifferentpowers import Sumofdifferentpowers -from problems.single_objective.continuous.threehumps import Threehumps -from problems.single_objective.continuous.zakharov import Zakharov -from problems.single_objective.continuous.zettle import Zettle -# ----------------------------------------------------------------------------------------------- # - - -# ------------------- problems.single_objective.discrete.binary -------------------------------- # -from problems.single_objective.discrete.binary.count_sat import CountSat -from problems.single_objective.discrete.binary.ecc import Ecc -from problems.single_objective.discrete.binary.maxcut20_01 import Maxcut20_01 -from problems.single_objective.discrete.binary.maxcut20_09 import Maxcut20_09 -from problems.single_objective.discrete.binary.maxcut100 import Maxcut100 -from problems.single_objective.discrete.binary.mmdp import Mmdp -from problems.single_objective.discrete.binary.one_max import OneMax -from problems.single_objective.discrete.binary.peak import Peak -# ----------------------------------------------------------------------------------------------- # - - -# ------------------- problems.single_objective.discrete.permutation.tsp ------------------------ # -from problems.single_objective.discrete.permutation.tsp import Tsp -# ----------------------------------------------------------------------------------------------- # diff --git a/pycellga/problems/abstract_problem.py b/pycellga/problems/abstract_problem.py index d6db1c7..27d5f44 100644 --- a/pycellga/problems/abstract_problem.py +++ b/pycellga/problems/abstract_problem.py @@ -1,7 +1,8 @@ -from abc import ABC, abstractmethod from typing import List, Any +from abc import ABC, abstractmethod from pymoo.core.problem import Problem -from common import GeneType + +from pycellga.common import GeneType class AbstractProblem(Problem, ABC): """ diff --git a/pycellga/problems/single_objective/continuous/__init__.py b/pycellga/problems/single_objective/continuous/__init__.py index d4ba13a..e69de29 100644 --- a/pycellga/problems/single_objective/continuous/__init__.py +++ b/pycellga/problems/single_objective/continuous/__init__.py @@ -1,24 +0,0 @@ -from . import ackley -from . import bentcigar -from . import bohachevsky -from . import chichinadze -from . import dropwave -from . import fms -from . import griewank -from . import holzman -from . import levy -from . import matyas -from . import pow -from . import powell -from . import rastrigin -from . import rosenbrock -from . import rothellipsoid -from . import schaffer -from . import schaffer2 -from . import schwefel -from . import sphere -from . import styblinskitang -from . import sumofdifferentpowers -from . import threehumps -from . import zakharov -from . import zettle diff --git a/pycellga/problems/single_objective/continuous/ackley.py b/pycellga/problems/single_objective/continuous/ackley.py index 5230e39..7e618a3 100644 --- a/pycellga/problems/single_objective/continuous/ackley.py +++ b/pycellga/problems/single_objective/continuous/ackley.py @@ -1,7 +1,8 @@ -from numpy import pi, e, cos, sqrt, exp, power -from problems.abstract_problem import AbstractProblem from typing import List -from common import GeneType +from numpy import pi, e, cos, sqrt, exp, power + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Ackley(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/bentcigar.py b/pycellga/problems/single_objective/continuous/bentcigar.py index 7e2d9f5..a612462 100644 --- a/pycellga/problems/single_objective/continuous/bentcigar.py +++ b/pycellga/problems/single_objective/continuous/bentcigar.py @@ -1,7 +1,9 @@ -from problems.abstract_problem import AbstractProblem + from mpmath import power as pw from typing import List -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Bentcigar(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/bohachevsky.py b/pycellga/problems/single_objective/continuous/bohachevsky.py index 70e07f7..48c78e8 100644 --- a/pycellga/problems/single_objective/continuous/bohachevsky.py +++ b/pycellga/problems/single_objective/continuous/bohachevsky.py @@ -1,8 +1,9 @@ from numpy import cos, pi from mpmath import power as pw from typing import List -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Bohachevsky(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/chichinadze.py b/pycellga/problems/single_objective/continuous/chichinadze.py index 02b6ed2..cdc939c 100644 --- a/pycellga/problems/single_objective/continuous/chichinadze.py +++ b/pycellga/problems/single_objective/continuous/chichinadze.py @@ -1,7 +1,8 @@ import numpy as np from typing import List -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Chichinadze(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/dropwave.py b/pycellga/problems/single_objective/continuous/dropwave.py index 0251025..184b215 100644 --- a/pycellga/problems/single_objective/continuous/dropwave.py +++ b/pycellga/problems/single_objective/continuous/dropwave.py @@ -1,7 +1,8 @@ -from problems.abstract_problem import AbstractProblem + from numpy import power, cos, sqrt from typing import List -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Dropwave(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/fms.py b/pycellga/problems/single_objective/continuous/fms.py index 3d8d502..4ef791e 100644 --- a/pycellga/problems/single_objective/continuous/fms.py +++ b/pycellga/problems/single_objective/continuous/fms.py @@ -1,7 +1,9 @@ -from problems.abstract_problem import AbstractProblem + from numpy import pi, sin from typing import List -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Fms(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/griewank.py b/pycellga/problems/single_objective/continuous/griewank.py index f9d07bd..1f93d59 100644 --- a/pycellga/problems/single_objective/continuous/griewank.py +++ b/pycellga/problems/single_objective/continuous/griewank.py @@ -1,7 +1,9 @@ -from problems.abstract_problem import AbstractProblem + import math from typing import List -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Griewank(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/holzman.py b/pycellga/problems/single_objective/continuous/holzman.py index 1fb944d..06c6d7f 100644 --- a/pycellga/problems/single_objective/continuous/holzman.py +++ b/pycellga/problems/single_objective/continuous/holzman.py @@ -1,7 +1,9 @@ -from problems.abstract_problem import AbstractProblem + from mpmath import power as pw from typing import List -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Holzman(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/levy.py b/pycellga/problems/single_objective/continuous/levy.py index ee89f08..67cf4f7 100644 --- a/pycellga/problems/single_objective/continuous/levy.py +++ b/pycellga/problems/single_objective/continuous/levy.py @@ -1,8 +1,10 @@ -from problems.abstract_problem import AbstractProblem + import math from mpmath import power as pw from typing import List -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Levy(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/matyas.py b/pycellga/problems/single_objective/continuous/matyas.py index 27a7619..5982bf6 100644 --- a/pycellga/problems/single_objective/continuous/matyas.py +++ b/pycellga/problems/single_objective/continuous/matyas.py @@ -1,6 +1,8 @@ -from problems.abstract_problem import AbstractProblem + from mpmath import power as pw -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Matyas(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/pow.py b/pycellga/problems/single_objective/continuous/pow.py index 4b75b71..16ec17b 100644 --- a/pycellga/problems/single_objective/continuous/pow.py +++ b/pycellga/problems/single_objective/continuous/pow.py @@ -1,7 +1,9 @@ -from problems.abstract_problem import AbstractProblem + from mpmath import power as pw from typing import List -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Pow(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/powell.py b/pycellga/problems/single_objective/continuous/powell.py index 79b3934..c5778d0 100644 --- a/pycellga/problems/single_objective/continuous/powell.py +++ b/pycellga/problems/single_objective/continuous/powell.py @@ -1,8 +1,9 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType from mpmath import power as pw from typing import List +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + class Powell(AbstractProblem): """ Powell function implementation for optimization problems. diff --git a/pycellga/problems/single_objective/continuous/rastrigin.py b/pycellga/problems/single_objective/continuous/rastrigin.py index fab067e..fa47b68 100644 --- a/pycellga/problems/single_objective/continuous/rastrigin.py +++ b/pycellga/problems/single_objective/continuous/rastrigin.py @@ -1,7 +1,8 @@ from numpy import cos, pi from typing import List -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Rastrigin(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/rosenbrock.py b/pycellga/problems/single_objective/continuous/rosenbrock.py index 294126a..70fcad4 100644 --- a/pycellga/problems/single_objective/continuous/rosenbrock.py +++ b/pycellga/problems/single_objective/continuous/rosenbrock.py @@ -1,7 +1,8 @@ -from problems.abstract_problem import AbstractProblem -from mpmath import power as pw -from common import GeneType from typing import List +from mpmath import power as pw + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Rosenbrock(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/rothellipsoid.py b/pycellga/problems/single_objective/continuous/rothellipsoid.py index 7bd4549..ca1d164 100644 --- a/pycellga/problems/single_objective/continuous/rothellipsoid.py +++ b/pycellga/problems/single_objective/continuous/rothellipsoid.py @@ -1,6 +1,7 @@ -from problems.abstract_problem import AbstractProblem from mpmath import power as pw -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Rothellipsoid(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/schaffer.py b/pycellga/problems/single_objective/continuous/schaffer.py index 9485c17..ecb6ba4 100644 --- a/pycellga/problems/single_objective/continuous/schaffer.py +++ b/pycellga/problems/single_objective/continuous/schaffer.py @@ -1,6 +1,7 @@ import numpy as np -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Schaffer(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/schaffer2.py b/pycellga/problems/single_objective/continuous/schaffer2.py index 9d4772f..281e15e 100644 --- a/pycellga/problems/single_objective/continuous/schaffer2.py +++ b/pycellga/problems/single_objective/continuous/schaffer2.py @@ -1,7 +1,8 @@ import numpy as np from numpy import power as pw -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Schaffer2(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/schwefel.py b/pycellga/problems/single_objective/continuous/schwefel.py index 7eaa5c0..32f9b6a 100644 --- a/pycellga/problems/single_objective/continuous/schwefel.py +++ b/pycellga/problems/single_objective/continuous/schwefel.py @@ -1,6 +1,7 @@ from numpy import sin, sqrt, abs -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Schwefel(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/sphere.py b/pycellga/problems/single_objective/continuous/sphere.py index 6866d4a..f75f481 100644 --- a/pycellga/problems/single_objective/continuous/sphere.py +++ b/pycellga/problems/single_objective/continuous/sphere.py @@ -1,5 +1,5 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Sphere(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/styblinskitang.py b/pycellga/problems/single_objective/continuous/styblinskitang.py index 8a8a015..a99678b 100644 --- a/pycellga/problems/single_objective/continuous/styblinskitang.py +++ b/pycellga/problems/single_objective/continuous/styblinskitang.py @@ -1,5 +1,5 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class StyblinskiTang(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/continuous/sumofdifferentpowers.py b/pycellga/problems/single_objective/continuous/sumofdifferentpowers.py index 90c7a4f..5a20d3d 100644 --- a/pycellga/problems/single_objective/continuous/sumofdifferentpowers.py +++ b/pycellga/problems/single_objective/continuous/sumofdifferentpowers.py @@ -1,5 +1,6 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + import numpy as np from mpmath import power as pw class Sumofdifferentpowers(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/threehumps.py b/pycellga/problems/single_objective/continuous/threehumps.py index 164826c..e29db0d 100644 --- a/pycellga/problems/single_objective/continuous/threehumps.py +++ b/pycellga/problems/single_objective/continuous/threehumps.py @@ -1,6 +1,7 @@ from mpmath import power as pw -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Threehumps(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/zakharov.py b/pycellga/problems/single_objective/continuous/zakharov.py index f24d34f..1ff9627 100644 --- a/pycellga/problems/single_objective/continuous/zakharov.py +++ b/pycellga/problems/single_objective/continuous/zakharov.py @@ -1,7 +1,8 @@ from mpmath import power as pw from typing import List -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Zakharov(AbstractProblem): diff --git a/pycellga/problems/single_objective/continuous/zettle.py b/pycellga/problems/single_objective/continuous/zettle.py index 450bb65..8d7f5c6 100644 --- a/pycellga/problems/single_objective/continuous/zettle.py +++ b/pycellga/problems/single_objective/continuous/zettle.py @@ -1,7 +1,8 @@ from mpmath import power as pw from typing import List -from problems.abstract_problem import AbstractProblem -from common import GeneType + +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Zettle(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/binary/__init__.py b/pycellga/problems/single_objective/discrete/binary/__init__.py index de66151..e69de29 100644 --- a/pycellga/problems/single_objective/discrete/binary/__init__.py +++ b/pycellga/problems/single_objective/discrete/binary/__init__.py @@ -1,9 +0,0 @@ -from . import count_sat -from . import ecc -from . import fms -from . import maxcut20_01 -from . import maxcut20_09 -from . import maxcut100 -from . import mmdp -from . import one_max -from . import peak \ No newline at end of file diff --git a/pycellga/problems/single_objective/discrete/binary/count_sat.py b/pycellga/problems/single_objective/discrete/binary/count_sat.py index c498e17..585ba99 100644 --- a/pycellga/problems/single_objective/discrete/binary/count_sat.py +++ b/pycellga/problems/single_objective/discrete/binary/count_sat.py @@ -1,5 +1,6 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + from typing import List class CountSat(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/binary/ecc.py b/pycellga/problems/single_objective/discrete/binary/ecc.py index 3d90cda..92e9f53 100644 --- a/pycellga/problems/single_objective/discrete/binary/ecc.py +++ b/pycellga/problems/single_objective/discrete/binary/ecc.py @@ -1,5 +1,6 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + from typing import List class Ecc(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/binary/fms.py b/pycellga/problems/single_objective/discrete/binary/fms.py index a34b222..1ec4847 100644 --- a/pycellga/problems/single_objective/discrete/binary/fms.py +++ b/pycellga/problems/single_objective/discrete/binary/fms.py @@ -1,6 +1,7 @@ -from problems.abstract_problem import AbstractProblem +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + from numpy import pi, sin, random -from common import GeneType from typing import List class Fms(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/binary/maxcut100.py b/pycellga/problems/single_objective/discrete/binary/maxcut100.py index 9946fea..2a6b490 100644 --- a/pycellga/problems/single_objective/discrete/binary/maxcut100.py +++ b/pycellga/problems/single_objective/discrete/binary/maxcut100.py @@ -1,5 +1,5 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType class Maxcut100(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/binary/maxcut20_01.py b/pycellga/problems/single_objective/discrete/binary/maxcut20_01.py index b7ac31d..afb26a6 100644 --- a/pycellga/problems/single_objective/discrete/binary/maxcut20_01.py +++ b/pycellga/problems/single_objective/discrete/binary/maxcut20_01.py @@ -1,5 +1,6 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + from typing import List class Maxcut20_01(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/binary/maxcut20_09.py b/pycellga/problems/single_objective/discrete/binary/maxcut20_09.py index 1d7b775..7b94454 100644 --- a/pycellga/problems/single_objective/discrete/binary/maxcut20_09.py +++ b/pycellga/problems/single_objective/discrete/binary/maxcut20_09.py @@ -1,5 +1,6 @@ -from problems.abstract_problem import AbstractProblem -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + from typing import List diff --git a/pycellga/problems/single_objective/discrete/binary/mmdp.py b/pycellga/problems/single_objective/discrete/binary/mmdp.py index 414f947..c184269 100644 --- a/pycellga/problems/single_objective/discrete/binary/mmdp.py +++ b/pycellga/problems/single_objective/discrete/binary/mmdp.py @@ -1,7 +1,7 @@ -from problems.abstract_problem import AbstractProblem -from typing import List -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType +from typing import List class Mmdp(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/discrete/binary/one_max.py b/pycellga/problems/single_objective/discrete/binary/one_max.py index 961ae88..e407e66 100644 --- a/pycellga/problems/single_objective/discrete/binary/one_max.py +++ b/pycellga/problems/single_objective/discrete/binary/one_max.py @@ -1,7 +1,7 @@ -from problems.abstract_problem import AbstractProblem -from typing import List -from common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType +from typing import List class OneMax(AbstractProblem): """ diff --git a/pycellga/problems/single_objective/discrete/binary/peak.py b/pycellga/problems/single_objective/discrete/binary/peak.py index b6347db..da2f481 100644 --- a/pycellga/problems/single_objective/discrete/binary/peak.py +++ b/pycellga/problems/single_objective/discrete/binary/peak.py @@ -1,7 +1,8 @@ -from problems.abstract_problem import AbstractProblem +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + from numpy import random from typing import List -from common import GeneType class Peak(AbstractProblem): diff --git a/pycellga/problems/single_objective/discrete/permutation/__init__.py b/pycellga/problems/single_objective/discrete/permutation/__init__.py index 62bcba8..e69de29 100644 --- a/pycellga/problems/single_objective/discrete/permutation/__init__.py +++ b/pycellga/problems/single_objective/discrete/permutation/__init__.py @@ -1 +0,0 @@ -from . import tsp \ No newline at end of file diff --git a/pycellga/problems/single_objective/discrete/permutation/tsp.py b/pycellga/problems/single_objective/discrete/permutation/tsp.py index 0f1884d..1690a3d 100644 --- a/pycellga/problems/single_objective/discrete/permutation/tsp.py +++ b/pycellga/problems/single_objective/discrete/permutation/tsp.py @@ -1,10 +1,11 @@ -from problems.abstract_problem import AbstractProblem +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.common import GeneType + +import os import tsplib95 from math import sqrt -from geopy.distance import geodesic -import os from typing import List -from common import GeneType +from geopy.distance import geodesic class Tsp(AbstractProblem): diff --git a/pycellga/recombination/__init__.py b/pycellga/recombination/__init__.py index b24fbc4..e69de29 100644 --- a/pycellga/recombination/__init__.py +++ b/pycellga/recombination/__init__.py @@ -1,27 +0,0 @@ -from . import arithmetic_crossover -from . import blxalpha_crossover -from . import byte_one_point_crossover -from . import byte_uniform_crossover -from . import flat_crossover -from . import linear_crossover -from . import one_point_crossover -from . import pmx_crossover -from . import recombination_operator -from . import two_point_crossover -from . import unfair_avarage_crossover -from . import uniform_crossover - -# ------------------------------ recombination ----------------------------- # -from recombination.one_point_crossover import OnePointCrossover -from recombination.pmx_crossover import PMXCrossover -from recombination.two_point_crossover import TwoPointCrossover -from recombination.uniform_crossover import UniformCrossover -from recombination.byte_uniform_crossover import ByteUniformCrossover -from recombination.byte_one_point_crossover import ByteOnePointCrossover -from recombination.flat_crossover import FlatCrossover -from recombination.arithmetic_crossover import ArithmeticCrossover -from recombination.blxalpha_crossover import BlxalphaCrossover -from recombination.linear_crossover import LinearCrossover -from recombination.unfair_avarage_crossover import UnfairAvarageCrossover -from recombination.recombination_operator import RecombinationOperator -# -------------------------------------------------------------------------- # \ No newline at end of file diff --git a/pycellga/recombination/arithmetic_crossover.py b/pycellga/recombination/arithmetic_crossover.py index 0792c5b..6f8169c 100644 --- a/pycellga/recombination/arithmetic_crossover.py +++ b/pycellga/recombination/arithmetic_crossover.py @@ -1,8 +1,9 @@ import random -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class ArithmeticCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/blxalpha_crossover.py b/pycellga/recombination/blxalpha_crossover.py index 4fae74d..a08ee7d 100644 --- a/pycellga/recombination/blxalpha_crossover.py +++ b/pycellga/recombination/blxalpha_crossover.py @@ -1,8 +1,9 @@ import random -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class BlxalphaCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/byte_one_point_crossover.py b/pycellga/recombination/byte_one_point_crossover.py index 06ffcf8..7f0be8f 100644 --- a/pycellga/recombination/byte_one_point_crossover.py +++ b/pycellga/recombination/byte_one_point_crossover.py @@ -1,9 +1,10 @@ +import struct import numpy as np -from individual import Individual -from problems.abstract_problem import AbstractProblem from typing import List -import struct -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import Individual +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class ByteOnePointCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/byte_uniform_crossover.py b/pycellga/recombination/byte_uniform_crossover.py index ba81ead..f458315 100644 --- a/pycellga/recombination/byte_uniform_crossover.py +++ b/pycellga/recombination/byte_uniform_crossover.py @@ -1,9 +1,10 @@ -import numpy.random as randomgenerator -from individual import * -from problems.abstract_problem import AbstractProblem -from typing import List import struct -from recombination.recombination_operator import RecombinationOperator +from typing import List +import numpy.random as randomgenerator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class ByteUniformCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/flat_crossover.py b/pycellga/recombination/flat_crossover.py index 295d0f3..6353937 100644 --- a/pycellga/recombination/flat_crossover.py +++ b/pycellga/recombination/flat_crossover.py @@ -1,8 +1,9 @@ import random -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class FlatCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/linear_crossover.py b/pycellga/recombination/linear_crossover.py index 27d1c0c..d589643 100644 --- a/pycellga/recombination/linear_crossover.py +++ b/pycellga/recombination/linear_crossover.py @@ -1,8 +1,9 @@ import random -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class LinearCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/one_point_crossover.py b/pycellga/recombination/one_point_crossover.py index d85825b..95fcc34 100644 --- a/pycellga/recombination/one_point_crossover.py +++ b/pycellga/recombination/one_point_crossover.py @@ -1,8 +1,9 @@ import numpy as np -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class OnePointCrossover(RecombinationOperator): diff --git a/pycellga/recombination/pmx_crossover.py b/pycellga/recombination/pmx_crossover.py index 90848a0..99bbcd2 100644 --- a/pycellga/recombination/pmx_crossover.py +++ b/pycellga/recombination/pmx_crossover.py @@ -1,7 +1,8 @@ -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class PMXCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/two_point_crossover.py b/pycellga/recombination/two_point_crossover.py index 1ee064e..e65da47 100644 --- a/pycellga/recombination/two_point_crossover.py +++ b/pycellga/recombination/two_point_crossover.py @@ -1,8 +1,9 @@ import numpy as np -from individual import Individual -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import Individual +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class TwoPointCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/unfair_avarage_crossover.py b/pycellga/recombination/unfair_avarage_crossover.py index dee8b62..c8a8790 100644 --- a/pycellga/recombination/unfair_avarage_crossover.py +++ b/pycellga/recombination/unfair_avarage_crossover.py @@ -1,8 +1,9 @@ import random -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class UnfairAvarageCrossover(RecombinationOperator): """ diff --git a/pycellga/recombination/uniform_crossover.py b/pycellga/recombination/uniform_crossover.py index 2ed30e2..3fac85d 100644 --- a/pycellga/recombination/uniform_crossover.py +++ b/pycellga/recombination/uniform_crossover.py @@ -1,8 +1,9 @@ -import numpy.random as randomgenerator -from individual import * -from problems.abstract_problem import AbstractProblem from typing import List -from recombination.recombination_operator import RecombinationOperator +import numpy.random as randomgenerator + +from pycellga.individual import * +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.recombination_operator import RecombinationOperator class UniformCrossover(RecombinationOperator): """ diff --git a/pycellga/selection/__init__.py b/pycellga/selection/__init__.py index befb0f9..e69de29 100644 --- a/pycellga/selection/__init__.py +++ b/pycellga/selection/__init__.py @@ -1,9 +0,0 @@ -from . import roulette_wheel_selection -from . import selection_operator -from . import tournament_selection - -# ------------------------------ selection --------------------------------- # -from selection.roulette_wheel_selection import RouletteWheelSelection -from selection.tournament_selection import TournamentSelection -from selection.selection_operator import SelectionOperator -# -------------------------------------------------------------------------- # \ No newline at end of file diff --git a/pycellga/selection/roulette_wheel_selection.py b/pycellga/selection/roulette_wheel_selection.py index 9bfcd45..0825c70 100644 --- a/pycellga/selection/roulette_wheel_selection.py +++ b/pycellga/selection/roulette_wheel_selection.py @@ -1,7 +1,8 @@ -from typing import List -from individual import Individual -from selection.selection_operator import SelectionOperator import random +from typing import List + +from pycellga.individual import Individual +from pycellga.selection.selection_operator import SelectionOperator class RouletteWheelSelection(SelectionOperator): """ diff --git a/pycellga/selection/tournament_selection.py b/pycellga/selection/tournament_selection.py index 81cfe2d..f982055 100644 --- a/pycellga/selection/tournament_selection.py +++ b/pycellga/selection/tournament_selection.py @@ -1,7 +1,8 @@ -from typing import List -from individual import Individual -from selection.selection_operator import SelectionOperator import numpy as np +from typing import List + +from pycellga.individual import Individual +from pycellga.selection.selection_operator import SelectionOperator class TournamentSelection(SelectionOperator): diff --git a/pycellga/tests/test_ackley.py b/pycellga/tests/test_ackley.py index 8f1f937..b76deaf 100644 --- a/pycellga/tests/test_ackley.py +++ b/pycellga/tests/test_ackley.py @@ -1,4 +1,4 @@ -from problems.single_objective.continuous.ackley import Ackley +from pycellga.problems.single_objective.continuous.ackley import Ackley import numpy as np def test_ackley(): diff --git a/pycellga/tests/test_arithmetic_crossover.py b/pycellga/tests/test_arithmetic_crossover.py index e40e712..fe8134a 100644 --- a/pycellga/tests/test_arithmetic_crossover.py +++ b/pycellga/tests/test_arithmetic_crossover.py @@ -1,10 +1,10 @@ import pytest import random -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.arithmetic_crossover import ArithmeticCrossover +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.arithmetic_crossover import ArithmeticCrossover class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_bentcigar_function.py b/pycellga/tests/test_bentcigar_function.py index 2c60274..d85c4c6 100644 --- a/pycellga/tests/test_bentcigar_function.py +++ b/pycellga/tests/test_bentcigar_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.bentcigar import Bentcigar +from pycellga.problems.single_objective.continuous.bentcigar import Bentcigar @pytest.fixture def setup_bentcigar(): diff --git a/pycellga/tests/test_bit_flip_mutation.py b/pycellga/tests/test_bit_flip_mutation.py index 154bf63..10c17fc 100644 --- a/pycellga/tests/test_bit_flip_mutation.py +++ b/pycellga/tests/test_bit_flip_mutation.py @@ -1,9 +1,10 @@ import numpy as np import pytest -from mutation.bit_flip_mutation import BitFlipMutation -from problems.single_objective.discrete.binary.one_max import OneMax -from individual import Individual -from common import GeneType + +from pycellga.mutation.bit_flip_mutation import BitFlipMutation +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.individual import Individual +from pycellga.common import GeneType def test_bit_flip_mutation(): diff --git a/pycellga/tests/test_blxalpha_crossover.py b/pycellga/tests/test_blxalpha_crossover.py index 3738f1d..ed17e1e 100644 --- a/pycellga/tests/test_blxalpha_crossover.py +++ b/pycellga/tests/test_blxalpha_crossover.py @@ -1,9 +1,10 @@ import pytest import random -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.blxalpha_crossover import BlxalphaCrossover + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.blxalpha_crossover import BlxalphaCrossover class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_bohachevsky.py b/pycellga/tests/test_bohachevsky.py index a28df83..b4d67dc 100644 --- a/pycellga/tests/test_bohachevsky.py +++ b/pycellga/tests/test_bohachevsky.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.bohachevsky import Bohachevsky +from pycellga.problems.single_objective.continuous.bohachevsky import Bohachevsky @pytest.fixture def setup_bohachevsky(): diff --git a/pycellga/tests/test_byte_mutation.py b/pycellga/tests/test_byte_mutation.py index ac44e02..f919ba4 100644 --- a/pycellga/tests/test_byte_mutation.py +++ b/pycellga/tests/test_byte_mutation.py @@ -1,9 +1,10 @@ import pytest import numpy as np -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from mutation.byte_mutation import ByteMutation + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.byte_mutation import ByteMutation class MockProblem(AbstractProblem): diff --git a/pycellga/tests/test_byte_mutation_random.py b/pycellga/tests/test_byte_mutation_random.py index ddf3af9..a017060 100644 --- a/pycellga/tests/test_byte_mutation_random.py +++ b/pycellga/tests/test_byte_mutation_random.py @@ -1,9 +1,10 @@ import pytest import numpy as np -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from mutation.byte_mutation_random import ByteMutationRandom + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.byte_mutation_random import ByteMutationRandom class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_byte_one_point_crossover.py b/pycellga/tests/test_byte_one_point_crossover.py index b73fc81..87aeb10 100644 --- a/pycellga/tests/test_byte_one_point_crossover.py +++ b/pycellga/tests/test_byte_one_point_crossover.py @@ -1,9 +1,10 @@ import pytest import numpy as np -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.byte_one_point_crossover import ByteOnePointCrossover + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover class MockProblem(AbstractProblem): diff --git a/pycellga/tests/test_byte_operators.py b/pycellga/tests/test_byte_operators.py index 8c15d80..afa62f4 100644 --- a/pycellga/tests/test_byte_operators.py +++ b/pycellga/tests/test_byte_operators.py @@ -1,5 +1,5 @@ import pytest -from byte_operators import float_to_bits, bits_to_float, floats_to_bits, bits_to_floats +from pycellga.byte_operators import float_to_bits, bits_to_float, floats_to_bits, bits_to_floats def test_float_to_bits(): """ diff --git a/pycellga/tests/test_byte_uniform_crossover.py b/pycellga/tests/test_byte_uniform_crossover.py index 64bfff7..b01e254 100644 --- a/pycellga/tests/test_byte_uniform_crossover.py +++ b/pycellga/tests/test_byte_uniform_crossover.py @@ -1,9 +1,10 @@ import pytest import numpy.random as randomgenerator -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.byte_uniform_crossover import ByteUniformCrossover + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.byte_uniform_crossover import ByteUniformCrossover class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_chichinadze_function.py b/pycellga/tests/test_chichinadze_function.py index 6c88143..3443324 100644 --- a/pycellga/tests/test_chichinadze_function.py +++ b/pycellga/tests/test_chichinadze_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.chichinadze import Chichinadze +from pycellga.problems.single_objective.continuous.chichinadze import Chichinadze @pytest.fixture def setup_chichinadze(): diff --git a/pycellga/tests/test_compact_13.py b/pycellga/tests/test_compact_13.py index 901f403..01cc76c 100644 --- a/pycellga/tests/test_compact_13.py +++ b/pycellga/tests/test_compact_13.py @@ -1,4 +1,4 @@ -from neighborhoods.compact_13 import Compact13 +from pycellga.neighborhoods.compact_13 import Compact13 def test_compact_13(): """ diff --git a/pycellga/tests/test_compact_21.py b/pycellga/tests/test_compact_21.py index fcc1bb8..98ba0b5 100644 --- a/pycellga/tests/test_compact_21.py +++ b/pycellga/tests/test_compact_21.py @@ -1,4 +1,4 @@ -from neighborhoods.compact_21 import Compact21 +from pycellga.neighborhoods.compact_21 import Compact21 def test_compact_21(): """ diff --git a/pycellga/tests/test_compact_25.py b/pycellga/tests/test_compact_25.py index 49d4e83..4f26906 100644 --- a/pycellga/tests/test_compact_25.py +++ b/pycellga/tests/test_compact_25.py @@ -1,4 +1,4 @@ -from neighborhoods.compact_25 import Compact25 +from pycellga.neighborhoods.compact_25 import Compact25 def test_compact_25(): """ diff --git a/pycellga/tests/test_compact_9.py b/pycellga/tests/test_compact_9.py index c5d0002..09664d4 100644 --- a/pycellga/tests/test_compact_9.py +++ b/pycellga/tests/test_compact_9.py @@ -1,4 +1,4 @@ -from neighborhoods.compact_9 import Compact9 +from pycellga.neighborhoods.compact_9 import Compact9 def test_compact_9(): """ diff --git a/pycellga/tests/test_count_sat.py b/pycellga/tests/test_count_sat.py index 41998c8..11e8905 100644 --- a/pycellga/tests/test_count_sat.py +++ b/pycellga/tests/test_count_sat.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.discrete.binary.count_sat import CountSat +from pycellga.problems.single_objective.discrete.binary.count_sat import CountSat @pytest.fixture def setup_count_sat(): diff --git a/pycellga/tests/test_dropwave_function.py b/pycellga/tests/test_dropwave_function.py index 1326198..b279999 100644 --- a/pycellga/tests/test_dropwave_function.py +++ b/pycellga/tests/test_dropwave_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.dropwave import Dropwave +from pycellga.problems.single_objective.continuous.dropwave import Dropwave @pytest.fixture def setup_dropwave(): diff --git a/pycellga/tests/test_ecc.py b/pycellga/tests/test_ecc.py index 79bff80..ca17c62 100644 --- a/pycellga/tests/test_ecc.py +++ b/pycellga/tests/test_ecc.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.discrete.binary.ecc import Ecc +from pycellga.problems.single_objective.discrete.binary.ecc import Ecc @pytest.fixture def ecc_instance(): diff --git a/pycellga/tests/test_flat_crossover.py b/pycellga/tests/test_flat_crossover.py index 292a2ba..2e656b2 100644 --- a/pycellga/tests/test_flat_crossover.py +++ b/pycellga/tests/test_flat_crossover.py @@ -1,9 +1,10 @@ import pytest import random -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.flat_crossover import FlatCrossover + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.flat_crossover import FlatCrossover class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_float_uniform_mutation.py b/pycellga/tests/test_float_uniform_mutation.py index b496f1b..b227468 100644 --- a/pycellga/tests/test_float_uniform_mutation.py +++ b/pycellga/tests/test_float_uniform_mutation.py @@ -1,9 +1,10 @@ import pytest import random -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from mutation.float_uniform_mutation import FloatUniformMutation + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.mutation.float_uniform_mutation import FloatUniformMutation class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_fms.py b/pycellga/tests/test_fms.py index 06d5093..1569f8a 100644 --- a/pycellga/tests/test_fms.py +++ b/pycellga/tests/test_fms.py @@ -1,6 +1,8 @@ -import pytest -from problems.single_objective.continuous.fms import Fms import numpy as np +import pytest + +from pycellga.problems.single_objective.continuous.fms import Fms + @pytest.fixture def fms_instance(): diff --git a/pycellga/tests/test_grid.py b/pycellga/tests/test_grid.py index a751bb8..55ea270 100644 --- a/pycellga/tests/test_grid.py +++ b/pycellga/tests/test_grid.py @@ -1,4 +1,4 @@ -from grid import Grid +from pycellga.grid import Grid def test_grid(): """ diff --git a/pycellga/tests/test_griewank_function.py b/pycellga/tests/test_griewank_function.py index 1684bfe..46a37c7 100644 --- a/pycellga/tests/test_griewank_function.py +++ b/pycellga/tests/test_griewank_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.griewank import Griewank +from pycellga.problems.single_objective.continuous.griewank import Griewank @pytest.fixture def setup_griewank(): diff --git a/pycellga/tests/test_holzman_function.py b/pycellga/tests/test_holzman_function.py index 6c698ee..ef348f9 100644 --- a/pycellga/tests/test_holzman_function.py +++ b/pycellga/tests/test_holzman_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.holzman import Holzman +from pycellga.problems.single_objective.continuous.holzman import Holzman @pytest.fixture def setup_holzman(): diff --git a/pycellga/tests/test_individual.py b/pycellga/tests/test_individual.py index 58142ae..4f2e995 100644 --- a/pycellga/tests/test_individual.py +++ b/pycellga/tests/test_individual.py @@ -1,8 +1,9 @@ import pytest from numpy import random import random as rd -from individual import Individual -from common import GeneType + +from pycellga.individual import Individual +from pycellga.common import GeneType @pytest.fixture diff --git a/pycellga/tests/test_insertion_mutation.py b/pycellga/tests/test_insertion_mutation.py index 8e8c194..77a0ce5 100644 --- a/pycellga/tests/test_insertion_mutation.py +++ b/pycellga/tests/test_insertion_mutation.py @@ -1,9 +1,10 @@ -from mutation.insertion_mutation import InsertionMutation -from problems.single_objective.discrete.permutation.tsp import Tsp -from individual import Individual -from common import GeneType import random +from pycellga.mutation.insertion_mutation import InsertionMutation +from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp +from pycellga.individual import Individual +from pycellga.common import GeneType + def test_insertion_mutation(): """ Test the InsertionMutation class for the Individual class on the TSP problem. diff --git a/pycellga/tests/test_levy_function.py b/pycellga/tests/test_levy_function.py index 34740a7..733cde4 100644 --- a/pycellga/tests/test_levy_function.py +++ b/pycellga/tests/test_levy_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.levy import Levy +from pycellga.problems.single_objective.continuous.levy import Levy @pytest.fixture def setup_levy(): diff --git a/pycellga/tests/test_linear_5.py b/pycellga/tests/test_linear_5.py index 8dfea57..0079f1a 100644 --- a/pycellga/tests/test_linear_5.py +++ b/pycellga/tests/test_linear_5.py @@ -1,4 +1,4 @@ -from neighborhoods.linear_5 import Linear5 +from pycellga.neighborhoods.linear_5 import Linear5 def test_linear_5(): """ diff --git a/pycellga/tests/test_linear_9.py b/pycellga/tests/test_linear_9.py index 8b6c7a0..4372931 100644 --- a/pycellga/tests/test_linear_9.py +++ b/pycellga/tests/test_linear_9.py @@ -1,4 +1,4 @@ -from neighborhoods.linear_9 import Linear9 +from pycellga.neighborhoods.linear_9 import Linear9 def test_linear_9(): """ diff --git a/pycellga/tests/test_linear_crossover.py b/pycellga/tests/test_linear_crossover.py index 904fea1..71134b3 100644 --- a/pycellga/tests/test_linear_crossover.py +++ b/pycellga/tests/test_linear_crossover.py @@ -1,9 +1,10 @@ import pytest import random -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.linear_crossover import LinearCrossover + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.linear_crossover import LinearCrossover class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_matyas_function.py b/pycellga/tests/test_matyas_function.py index fe15fad..250136d 100644 --- a/pycellga/tests/test_matyas_function.py +++ b/pycellga/tests/test_matyas_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.matyas import Matyas +from pycellga.problems.single_objective.continuous.matyas import Matyas @pytest.fixture def setup_matyas(): diff --git a/pycellga/tests/test_maxcut100.py b/pycellga/tests/test_maxcut100.py index 810d7c1..f4cd9e0 100644 --- a/pycellga/tests/test_maxcut100.py +++ b/pycellga/tests/test_maxcut100.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.discrete.binary.maxcut100 import Maxcut100 +from pycellga.problems.single_objective.discrete.binary.maxcut100 import Maxcut100 @pytest.fixture def maxcut_instance(): diff --git a/pycellga/tests/test_maxcut20_01.py b/pycellga/tests/test_maxcut20_01.py index 44ca0e5..e3e7768 100644 --- a/pycellga/tests/test_maxcut20_01.py +++ b/pycellga/tests/test_maxcut20_01.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.discrete.binary.maxcut20_01 import Maxcut20_01 +from pycellga.problems.single_objective.discrete.binary.maxcut20_01 import Maxcut20_01 @pytest.fixture def maxcut_instance(): diff --git a/pycellga/tests/test_maxcut20_09.py b/pycellga/tests/test_maxcut20_09.py index 194e53e..418da26 100644 --- a/pycellga/tests/test_maxcut20_09.py +++ b/pycellga/tests/test_maxcut20_09.py @@ -1,7 +1,8 @@ import pytest -from problems.single_objective.discrete.binary.maxcut20_09 import Maxcut20_09 import numpy as np +from pycellga.problems.single_objective.discrete.binary.maxcut20_09 import Maxcut20_09 + @pytest.fixture def maxcut_instance(): """Fixture for creating an instance of the Maxcut20_09 class.""" diff --git a/pycellga/tests/test_mmdp.py b/pycellga/tests/test_mmdp.py index 0371c0e..358eef2 100644 --- a/pycellga/tests/test_mmdp.py +++ b/pycellga/tests/test_mmdp.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.discrete.binary.mmdp import Mmdp +from pycellga.problems.single_objective.discrete.binary.mmdp import Mmdp @pytest.fixture def mmdp_instance(): diff --git a/pycellga/tests/test_one_max.py b/pycellga/tests/test_one_max.py index 4df19d9..703bd43 100644 --- a/pycellga/tests/test_one_max.py +++ b/pycellga/tests/test_one_max.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax @pytest.fixture def one_max_instance(): diff --git a/pycellga/tests/test_one_point_crossover.py b/pycellga/tests/test_one_point_crossover.py index 69c2320..a29ff7a 100644 --- a/pycellga/tests/test_one_point_crossover.py +++ b/pycellga/tests/test_one_point_crossover.py @@ -1,7 +1,7 @@ -from recombination.one_point_crossover import OnePointCrossover -from individual import Individual -from common import GeneType -from problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.recombination.one_point_crossover import OnePointCrossover +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax def test_one_point_crossover(): """ diff --git a/pycellga/tests/test_optimizer_alpha_cga.py b/pycellga/tests/test_optimizer_alpha_cga.py index b0ea0ec..b2f12f2 100644 --- a/pycellga/tests/test_optimizer_alpha_cga.py +++ b/pycellga/tests/test_optimizer_alpha_cga.py @@ -2,12 +2,16 @@ import mpmath as mp from typing import List -from optimizer import alpha_cga -from common import GeneType -from recombination import ByteOnePointCrossover, OnePointCrossover, PMXCrossover -from mutation import ByteMutationRandom, BitFlipMutation, SwapMutation -from selection import TournamentSelection -from problems import AbstractProblem +from pycellga.optimizer import alpha_cga +from pycellga.common import GeneType +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover +from pycellga.recombination.one_point_crossover import OnePointCrossover +from pycellga.recombination.pmx_crossover import PMXCrossover +from pycellga.mutation.byte_mutation_random import ByteMutationRandom +from pycellga.mutation.bit_flip_mutation import BitFlipMutation +from pycellga.mutation.swap_mutation import SwapMutation +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem class RealProblem(AbstractProblem): diff --git a/pycellga/tests/test_optimizer_ccga.py b/pycellga/tests/test_optimizer_ccga.py index e1cf342..930d965 100644 --- a/pycellga/tests/test_optimizer_ccga.py +++ b/pycellga/tests/test_optimizer_ccga.py @@ -1,9 +1,9 @@ import pytest -from optimizer import ccga -from selection import TournamentSelection -from common import GeneType -from problems import AbstractProblem +from pycellga.optimizer import ccga +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem class BinaryProblem(AbstractProblem): diff --git a/pycellga/tests/test_optimizer_cga.py b/pycellga/tests/test_optimizer_cga.py index 8b1090b..d0467d9 100644 --- a/pycellga/tests/test_optimizer_cga.py +++ b/pycellga/tests/test_optimizer_cga.py @@ -2,12 +2,18 @@ import mpmath as mp from typing import List -from optimizer import cga -from common import GeneType -from recombination import OnePointCrossover, ByteOnePointCrossover, PMXCrossover -from mutation import BitFlipMutation, ByteMutationRandom, SwapMutation -from selection import TournamentSelection -from problems import AbstractProblem +from pycellga.optimizer import cga +from pycellga.common import GeneType +from pycellga.recombination.one_point_crossover import OnePointCrossover +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover +from pycellga.recombination.pmx_crossover import PMXCrossover + +from pycellga.mutation.bit_flip_mutation import BitFlipMutation +from pycellga.mutation.byte_mutation_random import ByteMutationRandom +from pycellga.mutation.swap_mutation import SwapMutation + +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem class RealProblem(AbstractProblem): diff --git a/pycellga/tests/test_optimizer_mccga.py b/pycellga/tests/test_optimizer_mccga.py index ef6cb19..44b3fcf 100644 --- a/pycellga/tests/test_optimizer_mccga.py +++ b/pycellga/tests/test_optimizer_mccga.py @@ -1,10 +1,10 @@ import pytest import mpmath as mp -from optimizer import mcccga -from common import GeneType -from selection import TournamentSelection -from problems import AbstractProblem +from pycellga.optimizer import mcccga +from pycellga.common import GeneType +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem class RealProblem(AbstractProblem): diff --git a/pycellga/tests/test_optimizer_sync_cga.py b/pycellga/tests/test_optimizer_sync_cga.py index 83f19c1..f56f171 100644 --- a/pycellga/tests/test_optimizer_sync_cga.py +++ b/pycellga/tests/test_optimizer_sync_cga.py @@ -1,10 +1,16 @@ import pytest -from optimizer import sync_cga -from common import GeneType -from recombination import ByteOnePointCrossover, OnePointCrossover, PMXCrossover -from mutation import ByteMutationRandom, BitFlipMutation, SwapMutation -from selection import TournamentSelection -from problems import AbstractProblem +from pycellga.optimizer import sync_cga +from pycellga.common import GeneType +from pycellga.recombination.byte_one_point_crossover import ByteOnePointCrossover +from pycellga.recombination.one_point_crossover import OnePointCrossover +from pycellga.recombination.pmx_crossover import PMXCrossover + +from pycellga.mutation.byte_mutation_random import ByteMutationRandom +from pycellga.mutation.bit_flip_mutation import BitFlipMutation +from pycellga.mutation.swap_mutation import SwapMutation + +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.problems.abstract_problem import AbstractProblem import mpmath as mp diff --git a/pycellga/tests/test_peak.py b/pycellga/tests/test_peak.py index 127b98a..4f57161 100644 --- a/pycellga/tests/test_peak.py +++ b/pycellga/tests/test_peak.py @@ -1,6 +1,7 @@ import pytest from numpy import random -from problems.single_objective.discrete.binary.peak import Peak + +from pycellga.problems.single_objective.discrete.binary.peak import Peak @pytest.fixture def peak_instance(): diff --git a/pycellga/tests/test_pmx_crossover.py b/pycellga/tests/test_pmx_crossover.py index 570be68..f072f03 100644 --- a/pycellga/tests/test_pmx_crossover.py +++ b/pycellga/tests/test_pmx_crossover.py @@ -1,7 +1,8 @@ -from problems.single_objective.discrete.permutation.tsp import Tsp -from recombination.pmx_crossover import PMXCrossover -from individual import Individual -from common import GeneType +from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp +from pycellga.recombination.pmx_crossover import PMXCrossover +from pycellga.individual import Individual +from pycellga.common import GeneType + import random def test_pmx_crossover(): diff --git a/pycellga/tests/test_population.py b/pycellga/tests/test_population.py index 8cdbca5..09827c5 100644 --- a/pycellga/tests/test_population.py +++ b/pycellga/tests/test_population.py @@ -1,11 +1,12 @@ import pytest -from common import GeneType -from grid import Grid -from neighborhoods.linear_9 import Linear9 -from byte_operators import bits_to_floats -from problems.abstract_problem import AbstractProblem from typing import List -from population import Population, OptimizationMethod + +from pycellga.common import GeneType +from pycellga.grid import Grid +from pycellga.neighborhoods.linear_9 import Linear9 +from pycellga.byte_operators import bits_to_floats +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.population import Population, OptimizationMethod class MockProblem(AbstractProblem): diff --git a/pycellga/tests/test_pow_function.py b/pycellga/tests/test_pow_function.py index b833882..e75cf79 100644 --- a/pycellga/tests/test_pow_function.py +++ b/pycellga/tests/test_pow_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.pow import Pow +from pycellga.problems.single_objective.continuous.pow import Pow @pytest.fixture def setup_pow(): diff --git a/pycellga/tests/test_powell_function.py b/pycellga/tests/test_powell_function.py index b40c3f7..e37d3eb 100644 --- a/pycellga/tests/test_powell_function.py +++ b/pycellga/tests/test_powell_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.powell import Powell +from pycellga.problems.single_objective.continuous.powell import Powell @pytest.fixture def setup_powell(): diff --git a/pycellga/tests/test_rastrigin.py b/pycellga/tests/test_rastrigin.py index 94ca744..f56126c 100644 --- a/pycellga/tests/test_rastrigin.py +++ b/pycellga/tests/test_rastrigin.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.rastrigin import Rastrigin +from pycellga.problems.single_objective.continuous.rastrigin import Rastrigin @pytest.fixture def setup_rastrigin(): diff --git a/pycellga/tests/test_rosenbrock.py b/pycellga/tests/test_rosenbrock.py index 7644c7e..d33b75a 100644 --- a/pycellga/tests/test_rosenbrock.py +++ b/pycellga/tests/test_rosenbrock.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.rosenbrock import Rosenbrock +from pycellga.problems.single_objective.continuous.rosenbrock import Rosenbrock @pytest.fixture def setup_rosenbrock(): diff --git a/pycellga/tests/test_rothellipsoid_function.py b/pycellga/tests/test_rothellipsoid_function.py index 8992609..5c847f9 100644 --- a/pycellga/tests/test_rothellipsoid_function.py +++ b/pycellga/tests/test_rothellipsoid_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.rothellipsoid import Rothellipsoid +from pycellga.problems.single_objective.continuous.rothellipsoid import Rothellipsoid @pytest.fixture def setup_rothellipsoid(): diff --git a/pycellga/tests/test_roulette_wheel_selection.py b/pycellga/tests/test_roulette_wheel_selection.py index db82740..8664dc4 100644 --- a/pycellga/tests/test_roulette_wheel_selection.py +++ b/pycellga/tests/test_roulette_wheel_selection.py @@ -1,7 +1,7 @@ -from problems.single_objective.discrete.binary.one_max import OneMax -from selection.roulette_wheel_selection import RouletteWheelSelection -from population import Population, OptimizationMethod -from common import GeneType +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.selection.roulette_wheel_selection import RouletteWheelSelection +from pycellga.population import Population, OptimizationMethod +from pycellga.common import GeneType def test_roulette_wheel_selection(): """ diff --git a/pycellga/tests/test_schaffer2_function.py b/pycellga/tests/test_schaffer2_function.py index baf9901..e4b80f9 100644 --- a/pycellga/tests/test_schaffer2_function.py +++ b/pycellga/tests/test_schaffer2_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.schaffer2 import Schaffer2 +from pycellga.problems.single_objective.continuous.schaffer2 import Schaffer2 @pytest.fixture def setup_schaffer2(): diff --git a/pycellga/tests/test_schaffer_function.py b/pycellga/tests/test_schaffer_function.py index f70f001..6f73a5e 100644 --- a/pycellga/tests/test_schaffer_function.py +++ b/pycellga/tests/test_schaffer_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.schaffer import Schaffer +from pycellga.problems.single_objective.continuous.schaffer import Schaffer @pytest.fixture def setup_schaffer(): diff --git a/pycellga/tests/test_schwefel.py b/pycellga/tests/test_schwefel.py index 7c210fa..558c623 100644 --- a/pycellga/tests/test_schwefel.py +++ b/pycellga/tests/test_schwefel.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.schwefel import Schwefel +from pycellga.problems.single_objective.continuous.schwefel import Schwefel @pytest.fixture def setup_schwefel(): diff --git a/pycellga/tests/test_shuffle_mutation.py b/pycellga/tests/test_shuffle_mutation.py index 9244530..184f11d 100644 --- a/pycellga/tests/test_shuffle_mutation.py +++ b/pycellga/tests/test_shuffle_mutation.py @@ -1,7 +1,8 @@ -from mutation.shuffle_mutation import ShuffleMutation -from problems.single_objective.discrete.permutation.tsp import Tsp -from individual import Individual -from common import GeneType +from pycellga.mutation.shuffle_mutation import ShuffleMutation +from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp +from pycellga.individual import Individual +from pycellga.common import GeneType + import random def test_shuffle_mutation(): diff --git a/pycellga/tests/test_sphere.py b/pycellga/tests/test_sphere.py index 7fd8365..76a0105 100644 --- a/pycellga/tests/test_sphere.py +++ b/pycellga/tests/test_sphere.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.sphere import Sphere +from pycellga.problems.single_objective.continuous.sphere import Sphere @pytest.fixture def setup_sphere(): diff --git a/pycellga/tests/test_styblinskitang_function.py b/pycellga/tests/test_styblinskitang_function.py index 4700921..ef0bc7c 100644 --- a/pycellga/tests/test_styblinskitang_function.py +++ b/pycellga/tests/test_styblinskitang_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.styblinskitang import StyblinskiTang +from pycellga.problems.single_objective.continuous.styblinskitang import StyblinskiTang @pytest.fixture def setup_styblinski_tang(): diff --git a/pycellga/tests/test_sumofdifferentpowers_function.py b/pycellga/tests/test_sumofdifferentpowers_function.py index d7a35cc..9029e9c 100644 --- a/pycellga/tests/test_sumofdifferentpowers_function.py +++ b/pycellga/tests/test_sumofdifferentpowers_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.sumofdifferentpowers import Sumofdifferentpowers +from pycellga.problems.single_objective.continuous.sumofdifferentpowers import Sumofdifferentpowers @pytest.fixture def setup_sumofdifferentpowers(): diff --git a/pycellga/tests/test_swap_mutation.py b/pycellga/tests/test_swap_mutation.py index f1a9fae..251d917 100644 --- a/pycellga/tests/test_swap_mutation.py +++ b/pycellga/tests/test_swap_mutation.py @@ -1,7 +1,8 @@ -from mutation.swap_mutation import SwapMutation -from problems.single_objective.discrete.permutation.tsp import Tsp -from individual import Individual -from common import GeneType +from pycellga.mutation.swap_mutation import SwapMutation +from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp +from pycellga.individual import Individual +from pycellga.common import GeneType + import random def test_swap_mutation(): diff --git a/pycellga/tests/test_threehumps_function.py b/pycellga/tests/test_threehumps_function.py index 727f73b..7911f4a 100644 --- a/pycellga/tests/test_threehumps_function.py +++ b/pycellga/tests/test_threehumps_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.threehumps import Threehumps +from pycellga.problems.single_objective.continuous.threehumps import Threehumps @pytest.fixture def setup_threehumps(): diff --git a/pycellga/tests/test_tournament_selection.py b/pycellga/tests/test_tournament_selection.py index 889867c..d906635 100644 --- a/pycellga/tests/test_tournament_selection.py +++ b/pycellga/tests/test_tournament_selection.py @@ -1,7 +1,7 @@ -from problems.single_objective.discrete.binary.one_max import OneMax -from selection.tournament_selection import TournamentSelection -from population import Population, OptimizationMethod -from common import GeneType +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.selection.tournament_selection import TournamentSelection +from pycellga.population import Population, OptimizationMethod +from pycellga.common import GeneType def test_tournament_selection(): """ diff --git a/pycellga/tests/test_tsp.py b/pycellga/tests/test_tsp.py index ea5c407..64f611b 100644 --- a/pycellga/tests/test_tsp.py +++ b/pycellga/tests/test_tsp.py @@ -1,4 +1,4 @@ -from problems.single_objective.discrete.permutation.tsp import Tsp +from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp import random import pytest diff --git a/pycellga/tests/test_two_opt_mutation.py b/pycellga/tests/test_two_opt_mutation.py index e89ed75..6a9561b 100644 --- a/pycellga/tests/test_two_opt_mutation.py +++ b/pycellga/tests/test_two_opt_mutation.py @@ -1,7 +1,8 @@ -from mutation.two_opt_mutation import TwoOptMutation -from problems.single_objective.discrete.permutation.tsp import Tsp -from individual import Individual -from common import GeneType +from pycellga.mutation.two_opt_mutation import TwoOptMutation +from pycellga.problems.single_objective.discrete.permutation.tsp import Tsp +from pycellga.individual import Individual +from pycellga.common import GeneType + import random def test_two_opt_mutation(): diff --git a/pycellga/tests/test_two_point_crossover.py b/pycellga/tests/test_two_point_crossover.py index 5b1d88d..8353cc1 100644 --- a/pycellga/tests/test_two_point_crossover.py +++ b/pycellga/tests/test_two_point_crossover.py @@ -1,8 +1,9 @@ import numpy as np -from problems.single_objective.discrete.binary.one_max import OneMax -from recombination.two_point_crossover import TwoPointCrossover -from individual import Individual -from common import GeneType + +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.recombination.two_point_crossover import TwoPointCrossover +from pycellga.individual import Individual +from pycellga.common import GeneType def test_two_point_crossover(): """ diff --git a/pycellga/tests/test_unfair_average_crossover.py b/pycellga/tests/test_unfair_average_crossover.py index 9e65500..e5d944f 100644 --- a/pycellga/tests/test_unfair_average_crossover.py +++ b/pycellga/tests/test_unfair_average_crossover.py @@ -1,9 +1,10 @@ import pytest import random -from individual import Individual -from common import GeneType -from problems.abstract_problem import AbstractProblem -from recombination.unfair_avarage_crossover import UnfairAvarageCrossover + +from pycellga.individual import Individual +from pycellga.common import GeneType +from pycellga.problems.abstract_problem import AbstractProblem +from pycellga.recombination.unfair_avarage_crossover import UnfairAvarageCrossover class MockProblem(AbstractProblem): """ diff --git a/pycellga/tests/test_uniform_crossover.py b/pycellga/tests/test_uniform_crossover.py index a331a86..dae8cae 100644 --- a/pycellga/tests/test_uniform_crossover.py +++ b/pycellga/tests/test_uniform_crossover.py @@ -1,7 +1,7 @@ -from problems.single_objective.discrete.binary.one_max import OneMax -from recombination.uniform_crossover import UniformCrossover -from individual import Individual -from common import GeneType +from pycellga.problems.single_objective.discrete.binary.one_max import OneMax +from pycellga.recombination.uniform_crossover import UniformCrossover +from pycellga.individual import Individual +from pycellga.common import GeneType def test_uniform_crossover(): """ diff --git a/pycellga/tests/test_zakharov_function.py b/pycellga/tests/test_zakharov_function.py index c3594ff..de44e46 100644 --- a/pycellga/tests/test_zakharov_function.py +++ b/pycellga/tests/test_zakharov_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.zakharov import Zakharov +from pycellga.problems.single_objective.continuous.zakharov import Zakharov @pytest.fixture def setup_zakharov(): diff --git a/pycellga/tests/test_zettle_function.py b/pycellga/tests/test_zettle_function.py index fa65cc5..59cacc4 100644 --- a/pycellga/tests/test_zettle_function.py +++ b/pycellga/tests/test_zettle_function.py @@ -1,5 +1,5 @@ import pytest -from problems.single_objective.continuous.zettle import Zettle +from pycellga.problems.single_objective.continuous.zettle import Zettle @pytest.fixture def setup_zettle():