예제 #1
0
파일: ca.py 프로젝트: FlorianShepherd/NiaPy
    def typeParameters():
        r"""TODO.

		Returns:
			Dict[str, Callable]:
				* omega (Callable[[Union[int, float]], bool]): TODO
				* mu (Callable[[float], bool]): TODO
				* alpha (Callable[[float], bool]): TODO
				* S_init (Callable[[Union[float, int]], bool]): TODO
				* E_init (Callable[[Union[float, int]], bool]): TODO
				* T_min (Callable[[Union[float, int], bool]): TODO
				* T_max (Callable[[Union[float, int], bool]): TODO

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'omega': lambda x: isinstance(x, (float, int)),
            'mu': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'alpha': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'S_init': lambda x: isinstance(x, (float, int)) and x > 0,
            'E_init': lambda x: isinstance(x, (float, int)) and x > 0,
            'T_min': lambda x: isinstance(x, (float, int)) and x > 0,
            'T_max': lambda x: isinstance(x, (float, int)) and x > 0
        })
        return d
예제 #2
0
파일: ca.py 프로젝트: sisco0/NiaPy
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* omega (Callable[[Union[int, float]], bool])
				* mu (Callable[[float], bool])
				* alpha (Callable[[float], bool])
				* S_init (Callable[[Union[float, int]], bool])
				* E_init (Callable[[Union[float, int]], bool])
				* T_min (Callable[[Union[float, int], bool])
				* T_max (Callable[[Union[float, int], bool])

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'omega': lambda x: isinstance(x, (float, int)),
            'mu': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'alpha': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'S_init': lambda x: isinstance(x, (float, int)) and x > 0,
            'E_init': lambda x: isinstance(x, (float, int)) and x > 0,
            'T_min': lambda x: isinstance(x, (float, int)) and x > 0,
            'T_max': lambda x: isinstance(x, (float, int)) and x > 0
        })
        return d
예제 #3
0
	def typeParameters():
		r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* N_max (Callable[[Union[int, float]], bool])
				* V_f (Callable[[Union[int, float]], bool])
				* D_max (Callable[[Union[int, float]], bool])
				* C_t (Callable[[Union[int, float]], bool])
				* W_n (Callable[[Union[int, float]], bool])
				* W_f (Callable[[Union[int, float]], bool])
				* d_s (Callable[[Union[int, float]], boool])
				* nn (Callable[[int], bool])
				* Cr (Callable[[float], bool])
				* Mu (Callable[[float], bool])
				* epsilon (Callable[[float], bool])

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm`
		"""
		d = Algorithm.typeParameters()
		d.update({
			'N_max': lambda x: isinstance(x, (int, float)) and x > 0,
			'V_f': lambda x: isinstance(x, (int, float)) and x > 0,
			'D_max': lambda x: isinstance(x, (int, float)) and x > 0,
			'C_t': lambda x: isinstance(x, (int, float)) and x > 0,
			'W_n': lambda x: isinstance(x, (int, float)) and x > 0,
			'W_f': lambda x: isinstance(x, (int, float)) and x > 0,
			'd_s': lambda x: isinstance(x, (int, float)) and x > 0,
			'nn': lambda x: isinstance(x, int) and x > 0,
			'Cr': lambda x: isinstance(x, float) and 0 <= x <= 1,
			'Mu': lambda x: isinstance(x, float) and 0 <= x <= 1,
			'epsilon': lambda x: isinstance(x, float) and 0 < x < 1
		})
		return d
예제 #4
0
    def typeParameters():
        r"""Return functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""

        d = Algorithm.typeParameters()
        d.update({
            'n_chemotactic':
            lambda x: isinstance(x, int) and x > 0,
            'n_swim':
            lambda x: isinstance(x, int) and x > 0,
            'n_reproduction':
            lambda x: isinstance(x, int) and x > 0,
            'n_elimination':
            lambda x: isinstance(x, int) and x > 0,
            'prob_elimination':
            lambda x: isinstance(x, float) and 0 <= x <= 1,
            'step_size':
            lambda x: isinstance(x, float) and x > 0,
            'd_attract':
            lambda x: isinstance(x, float) and x > 0,
            'w_attract':
            lambda x: isinstance(x, float) and x > 0,
            'h_repel':
            lambda x: isinstance(x, float) and x > 0,
            'w_repel':
            lambda x: isinstance(x, float) and x > 0
        })

        return d
예제 #5
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* NP (Callable[[int], bool]): Checks if number of bees parameter has a proper value.
				* m (Callable[[int], bool]): Checks if number of selected sites parameter has a proper value.
				* e (Callable[[int], bool]): Checks if number of elite selected sites parameter has a proper value.
				* nep (Callable[[int], bool]): Checks if number of elite bees parameter has a proper value.
				* nsp (Callable[[int], bool]): Checks if number of other bees parameter has a proper value.
				* ngh (Callable[[float], bool]): Checks if size of patches parameter has a proper value.

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'NP': lambda x: isinstance(x, int) and x > 0,
            'm': lambda x: isinstance(x, int) and x > 0,
            'e': lambda x: isinstance(x, int) and x > 0,
            'nep': lambda x: isinstance(x, int) and x > 0,
            'nsp': lambda x: isinstance(x, int) and x > 0,
            'ngh': lambda x: isinstance(x, float) and x > 0
        })
        return d
예제 #6
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* alpha (Callable): TODO
				* gamma (Callable): TODO
				* theta (Callable): TODO
				* nl (Callable): TODO
				* F (Callable[[Union[float, int]], bool]): TODO
				* CR (Callable[[Union[float, int]], bool]): TODO

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'alpha': lambda x: True,
            'gamma': lambda x: True,
            'theta': lambda x: True,
            'nl': lambda x: True,
            'F': lambda x: isinstance(x, (int, float)) and x > 0,
            'CR': lambda x: isinstance(x, float) and 0 <= x <= 1
        })
        return d
예제 #7
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]: TODO

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
		"""
        return Algorithm.typeParameters()
예제 #8
0
파일: abc.py 프로젝트: sisco0/NiaPy
    def typeParameters():
        r"""Return functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* Limit (Callable[Union[float, numpy.ndarray[float]]]): TODO

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({'Limit': lambda x: isinstance(x, int) and x > 0})
        return d
예제 #9
0
파일: hho.py 프로젝트: sisco0/NiaPy
    def typeParameters():
        r"""Return dict with where key of dict represents parameter name and values represent checking functions for selected parameter.

		Returns:
			Dict[str, Callable]:
				* levy (Callable[[Union[float, int]], bool]): Levy factor.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'levy': lambda x: isinstance(x, (float, int)) and x > 0,
        })
        return d
예제 #10
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			 Dict[str, Callable]:
				  * PAR (Callable[[float], bool]): Checks if partition parameter has a proper value.
				  * PER (Callable[[float], bool]): Checks if period parameter has a proper value.
		See Also:
			 * :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'PAR': lambda x: isinstance(x, float) and x > 0,
            'PER': lambda x: isinstance(x, float) and x > 0
        })
        return d
예제 #11
0
    def typeParameters():
        r"""TODO.

		Returns:
			Dict[str, Callable]:
				* p (function): TODO
				* beta (function): TODO

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'p': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'beta': lambda x: isinstance(x, (float, int)) and x > 0,
        })
        return d
예제 #12
0
파일: gsa.py 프로젝트: zyumons/NiaPy
    def typeParameters():
        r"""TODO.

		Returns:
			Dict[str, Callable]:
				* G_0 (Callable[[Union[int, float]], bool]): TODO
				* epsilon (Callable[[float], bool]): TODO

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'G_0': lambda x: isinstance(x, (int, float)) and x >= 0,
            'epsilon': lambda x: isinstance(x, float) and 0 < x < 1
        })
        return d
예제 #13
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* F (Callable[[Union[float, int]], bool]): Check for correct value of parameter.
				* CR (Callable[[float], bool]): Check for correct value of parameter.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'F': lambda x: isinstance(x, (float, int)) and 0 < x <= 2,
            'CR': lambda x: isinstance(x, float) and 0 <= x <= 1
        })
        return d
예제 #14
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* Ts (Callable[[int], bool]): Tournament size.
				* Mr (Callable[[float], bool]): Probability of mutation.
				* Cr (Callable[[float], bool]): Probability of crossover.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'Ts': lambda x: isinstance(x, int) and x > 1,
            'Mr': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'Cr': lambda x: isinstance(x, float) and 0 <= x <= 1
        })
        return d
예제 #15
0
파일: sca.py 프로젝트: sisco0/NiaPy
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* a (Callable[[Union[float, int]], bool]): TODO
				* Rmin (Callable[[Union[float, int]], bool]): TODO
				* Rmax (Callable[[Union[float, int]], bool]): TODO

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'a': lambda x: isinstance(x, (float, int)) and x > 0,
            'Rmin': lambda x: isinstance(x, (float, int)),
            'Rmax': lambda x: isinstance(x, (float, int))
        })
        return d
예제 #16
0
파일: fa.py 프로젝트: sisco0/NiaPy
    def typeParameters():
        r"""TODO.

		Returns:
			Dict[str, Callable]:
				* alpha (Callable[[Union[float, int]], bool]): TODO.
				* betamin (Callable[[Union[float, int]], bool]): TODO.
				* gamma (Callable[[Union[float, int]], bool]): TODO.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'alpha': lambda x: isinstance(x, (float, int)) and x > 0,
            'betamin': lambda x: isinstance(x, (float, int)) and x > 0,
            'gamma': lambda x: isinstance(x, (float, int)) and x > 0,
        })
        return d
예제 #17
0
	def typeParameters():
		r"""TODO.

		Returns:
			Dict[str, Callable]:
				* F (func): TODO
				* R (func): TODO
				* C (func): TODO
				* FC (func): TODO
		"""
		d = Algorithm.typeParameters()
		d.update({
			'NP': lambda x: isinstance(x, int) and x > 0,
			'F': lambda x: isinstance(x, (float, int)) and x > 0,
			'R': lambda x: isinstance(x, (float, int)) and x > 0,
			'C': lambda x: isinstance(x, int) and x > 0,
			'FC': lambda x: isinstance(x, (float, int)) and x > 0
		})
		return d
예제 #18
0
파일: ga.py 프로젝트: FlorianShepherd/NiaPy
    def typeParameters():
        r"""TODO.

		Returns:
			Dict[str, Callable]:
				* Ts (Callable[[int], bool]): TODO
				* Mr (Callable[[float], bool]): Probability of mutation.
				* Cr (Callable[[float], bool]): Probability of crossover.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'Ts': lambda x: isinstance(x, int) and x > 1,
            'Mr': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'Cr': lambda x: isinstance(x, float) and 0 <= x <= 1
        })
        return d
예제 #19
0
파일: mke.py 프로젝트: zyumons/NiaPy
	def typeParameters():
		r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable]:
				* F (Callable[[int], bool])
				* R (Callable[[Union[int, float]], bool])
				* C (Callable[[Union[int, float]], bool])
				* FC (Callable[[Union[int, float]], bool])
		"""
		d = Algorithm.typeParameters()
		d.update({
			'NP': lambda x: isinstance(x, int) and x > 0,
			'F': lambda x: isinstance(x, (float, int)) and x > 0,
			'R': lambda x: isinstance(x, (float, int)) and x > 0,
			'C': lambda x: isinstance(x, int) and x > 0,
			'FC': lambda x: isinstance(x, (float, int)) and x > 0
		})
		return d
예제 #20
0
    def typeParameters():
        r"""Return dict with where key of dict represents parameter name and values represent checking functions for selected parameter.

		Returns:
			Dict[str, Callable]:
				* A (Callable[[Union[float, int]], bool]): Loudness.
				* r (Callable[[Union[float, int]], bool]): Pulse rate.
				* Qmin (Callable[[Union[float, int]], bool]): Minimum frequency.
				* Qmax (Callable[[Union[float, int]], bool]): Maximum frequency.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'A': lambda x: isinstance(x, (float, int)) and x > 0,
            'r': lambda x: isinstance(x, (float, int)) and x > 0,
            'Qmin': lambda x: isinstance(x, (float, int)),
            'Qmax': lambda x: isinstance(x, (float, int))
        })
        return d
예제 #21
0
    def typeParameters():
        r"""Get dictionary with function for testing correctness of parameters.

		Returns:
			Dict[str, Callable]:
				* alpha (Callable[[Union[int, float]], bool])
				* gamma (Callable[[Union[int, float]], bool])
				* rho (Callable[[Union[int, float]], bool])
				* sigma (Callable[[Union[int, float]], bool])

		See Also
			* :func:`NiaPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.typeParameters()
        d.update({
            'alpha': lambda x: isinstance(x, (int, float)) and x >= 0,
            'gamma': lambda x: isinstance(x, (int, float)) and x >= 0,
            'rho': lambda x: isinstance(x, (int, float)),
            'sigma': lambda x: isinstance(x, (int, float))
        })
        return d
예제 #22
0
파일: pso.py 프로젝트: sisco0/NiaPy
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

		Returns:
			Dict[str, Callable[[Union[int, float]], bool]]:
			* NP (Callable[[int], bool])
			* C1 (Callable[[Union[int, float]], bool])
			* C2 (Callable[[Union[int, float]], bool])
			* w (Callable[[float], bool])
			* vMin (Callable[[Union[int, float]], bool])
			* vMax (Callable[[Union[int, float], bool])
		"""
        d = Algorithm.typeParameters()
        d.update({
            'C1': lambda x: isinstance(x, (int, float)) and x >= 0,
            'C2': lambda x: isinstance(x, (int, float)) and x >= 0,
            'w': lambda x: isinstance(x, float) and x >= 0,
            'vMin': lambda x: isinstance(x, (int, float)),
            'vMax': lambda x: isinstance(x, (int, float))
        })
        return d
예제 #23
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

        Returns:
            Dict[str, Callable]:
                * jumpLength (Callable[[float], bool]): Checks if jump length parameter has a proper value.
                * pheromone (Callable[[Union[int, float]], bool]): Checks if pheromone parameter has a proper value.
                * evaporation (Callable[[Union[int, float]], bool]): Checks if evaporation parameter has a proper value.

        See Also:
            * :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
        """
        d = Algorithm.typeParameters()
        d.update({
            'jumpLength':
            lambda x: isinstance(x, float) and 0 < x < 1,
            'pheromone':
            lambda x: isinstance(x, (float, int)) and x >= 0,
            'evaporation':
            lambda x: isinstance(x, (float, int)) and 0 <= x < 1,
        })
        return d
예제 #24
0
    def typeParameters():
        r"""Get dictionary with functions for checking values of parameters.

        Returns:
            Dict[str, Callable]:
                * lt (Callable[[int], bool]): Checks if life time parameter has a proper value.
                * al (Callable[[int], bool]): Checks if area limit parameter has a proper value.
                * lsc (Callable[[int], bool]): Checks if local seeding changes parameter has a proper value.
                * gsc (Callable[[int], bool]): Checks if global seeding changes parameter has a proper value.
                * tr (Callable[[float], bool]): Checks if transfer rate parameter has a proper value.

        See Also:
            * :func:`NiaPy.algorithms.algorithm.Algorithm.typeParameters`
        """
        d = Algorithm.typeParameters()
        d.update({
            'lt': lambda x: isinstance(x, int) and x > 0,
            'al': lambda x: isinstance(x, int) and x > 0,
            'lsc': lambda x: isinstance(x, int) and x > 0,
            'gsc': lambda x: isinstance(x, int) and x > 0,
            'tr': lambda x: isinstance(x, float) and 0 <= x <= 1,
        })
        return d
예제 #25
0
 def test_type_parameters_fine(self):
     d = Algorithm.typeParameters()
     self.assertIsNotNone(d)