コード例 #1
0
	def type_parameters():
		r"""Get dictionary with functions for checking values of parameters.

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

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
		d = Algorithm.type_parameters()
		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
コード例 #2
0
ファイル: abc.py プロジェクト: kb2623/WeOptPy
    def type_parameters():
        r"""Return functions for checking values of parameters.

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

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.type_parameters()
        d.update({'Limit': lambda x: isinstance(x, int) and x > 0})
        return d
コード例 #3
0
ファイル: de.py プロジェクト: kb2623/WeOptPy
    def type_parameters():
        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:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.type_parameters()
        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
コード例 #4
0
ファイル: fpa.py プロジェクト: kb2623/WeOptPy
    def type_parameters():
        r"""TODO.

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

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.type_parameters()
        d.update({
            'p': lambda x: isinstance(x, float) and 0 <= x <= 1,
            'beta': lambda x: isinstance(x, (float, int)) and x > 0,
        })
        return d
コード例 #5
0
    def type_parameters():
        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.type_parameters()
        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
コード例 #6
0
ファイル: fa.py プロジェクト: kb2623/WeOptPy
	def type_parameters():
		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:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
		d = Algorithm.type_parameters()
		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
コード例 #7
0
    def type_parameters():
        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.type_parameters()
        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
コード例 #8
0
    def type_parameters():
        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:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
        d = Algorithm.type_parameters()
        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
コード例 #9
0
 def test_type_parameters_fine(self):
     d = Algorithm.type_parameters()
     self.assertIsNotNone(d)