Пример #1
0
    def set_parameters(self,
                       n=25,
                       SI_init=3,
                       SI_final=10,
                       SV_init=3,
                       SV_final=13,
                       min_w=0.3,
                       w_scale=0.7,
                       **ukwargs):
        r"""Set core arguments of FishSchoolSearch algorithm.

		Arguments:
			n (Optional[int]): Number of fishes in school.
			SI_init (Optional[int]): Length of initial individual step.
			SI_final (Optional[int]): Length of final individual step.
			SV_init (Optional[int]): Length of initial volatile step.
			SV_final (Optional[int]): Length of final volatile step.
			min_w (Optional[float]): Minimum weight of a fish.
			w_scale (Optional[float]): Maximum weight of a fish.

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.setParameters`
		"""
        Algorithm.set_parameters(self, n=n, **ukwargs)
        self.step_individual_init = SI_init
        self.step_individual_final = SI_final
        self.step_volitive_init = SV_init
        self.step_volitive_final = SV_final
        self.min_w = min_w
        self.w_scale = w_scale
Пример #2
0
    def set_parameters(self,
                       n=50,
                       N_max=0.01,
                       V_f=0.02,
                       D_max=0.002,
                       C_t=0.93,
                       W_n=0.42,
                       W_f=0.38,
                       d_s=2.63,
                       nn=5,
                       Cr=0.2,
                       Mu=0.05,
                       epsilon=1e-31,
                       **ukwargs):
        r"""Set the arguments of an algorithm.

		Arguments:
			n (Optional[int]): Number of krill herds in population.
			N_max (Optional[float]): Maximum induced speed.
			V_f (Optional[float]): Foraging speed.
			D_max (Optional[float]): Maximum diffusion speed.
			C_t (Optional[float]): Constant $\in [0, 2]$.
			W_n (Optional[Union[int, float, numpy.ndarray]]): Intera weights of the motion induced from neighbors :math:`\in [0, 1]`.
			W_f (Optional[Union[int, float, numpy.ndarray]]): Intera weights of the motion induced from foraging :math:`\in [0, 1]`.
			d_s (Optional[float]): Maximum euclidean distance for neighbors.
			nn (Optional[int]): Maximum neighbors for neighbors effect.
			Cr (Optional[float]): Crossover probability.
			Mu (Optional[float]): Mutation probability.
			epsilon (Optional[float]): Small numbers for division.

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.setParameters`
		"""
        Algorithm.set_parameters(self, n=n, **ukwargs)
        self.N_max, self.V_f, self.D_max, self.C_t, self.W_n, self.W_f, self.d_s, self.nn, self._Cr, self._Mu, self.epsilon = N_max, V_f, D_max, C_t, W_n, W_f, d_s, nn, Cr, Mu, epsilon
Пример #3
0
    def set_parameters(self,
                       n=25,
                       c1=2.0,
                       c2=2.0,
                       w=0.7,
                       min_velocity=-1.5,
                       max_velocity=1.5,
                       repair=reflect_repair,
                       **ukwargs):
        r"""Set Particle Swarm Algorithm main parameters.

		Args:
			n (int): Population size
			c1 (float): Cognitive component.
			c2 (float): Social component.
			w (Union[float, numpy.ndarray]): Inertial weight.
			min_velocity (Union[float, numpy.ndarray]): Minimal velocity.
			max_velocity (Union[float, numpy.ndarray]): Maximal velocity.
			repair (Callable[[np.ndarray, np.ndarray, np.ndarray, dict], np.ndarray]): Repair method for velocity.
			**ukwargs: Additional arguments

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.setParameters`
		"""
        Algorithm.set_parameters(self, n=n, **ukwargs)
        self.C1, self.C2, self.w, self.vMin, self.vMax, self.Repair = c1, c2, w, min_velocity, max_velocity, repair
Пример #4
0
    def set_parameters(self,
                       n=30,
                       MR=0.1,
                       C1=2.05,
                       SMP=3,
                       SPC=True,
                       CDC=0.85,
                       SRD=0.2,
                       vMax=1.9,
                       **ukwargs):
        r"""Set the algorithm parameters.

		Arguments:
			n (int): Number of individuals in population
			MR (float): Mixture ratio
			C1 (float): Constant in tracing mode
			SMP (int): Seeking memory pool
			SPC (bool): Self-position considering
			CDC (float): Decides how many dimensions will be varied
			SRD (float): Seeking range of the selected dimension
			vMax (float): Maximal velocity

			See Also:
				* :func:`WeOptPy.algorithms.Algorithm.setParameters`
		"""
        Algorithm.set_parameters(self, n=n, **ukwargs)
        self.MR, self.C1, self.SMP, self.SPC, self.CDC, self.SRD, self.vMax = MR, C1, SMP, SPC, CDC, SRD, vMax
Пример #5
0
    def set_parameters(self, n=25, **ukwargs):
        r"""Set the algorithm parameters.

		Arguments:
			n (int): Number of individuals in population

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.setParameters`
		"""
        Algorithm.set_parameters(self, n=n, **ukwargs)
Пример #6
0
    def set_parameters(self, n=10, C_a=1.5, C_r=0.5, **ukwargs):
        r"""Set the arguments of an algorithm.

		Arguments:
			n (int): Number of sparks :math:`\in [1, \infty)`.
			C_a (float): Amplification coefficient :math:`\in [1, \infty)`.
			C_r (float): Reduction coefficient :math:`\in (0, 1)`.
		"""
        ukwargs.pop('n', None)
        Algorithm.set_parameters(self, n=1, **ukwargs)
        self.n, self.C_a, self.C_r = n, C_a, C_r
Пример #7
0
    def set_parameters(self, n=40, G_0=2.467, epsilon=1e-17, **ukwargs):
        r"""Set the algorithm parameters.

        Arguments:
            G_0 (float): Starting gravitational constant.
            epsilon (float): TODO.

        See Also:
            * :func:`NiaPy.algorithms.algorithm.Algorithm.setParameters`
        """
        Algorithm.set_parameters(self, n=n, **ukwargs)
        self.G_0, self.epsilon = G_0, epsilon
Пример #8
0
	def set_parameters(self, n=20, PAR=5.0 / 12.0, PER=1.2, **ukwargs):
		r"""Set the parameters of the algorithm.

		Args:
			n (Optional[int]): Population size.
			PAR (Optional[int]): Partition.
			PER (Optional[int]): Period.
			ukwargs (Dict[str, Any]): Additional arguments.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.setParameters`
		"""
		Algorithm.set_parameters(self, n=n, **ukwargs)
		self.NP, self.PAR, self.PER, self.keep, self.BAR, self.NP1 = n, PAR, PER, 2, PAR, int(np.ceil(PAR * n))
		self.NP2 = int(n - self.NP1)
Пример #9
0
    def init_population(self, task):
        r"""Initialize starting population.

		Args:
			task (Task): Optimization task

		Returns:
			Tuple[numpy.ndarray, numpy.ndarray, list, dict]:
				1. Initialized population
				2. Initialized population function/fitness values
				3. Additional arguments:
				4. Additional keyword arguments:
					* best_flames (numpy.ndarray): Best individuals
					* best_flame_fitness (numpy.ndarray): Best individuals fitness/function values
					* previous_population (numpy.ndarray): Previous population
					* previous_fitness (numpy.ndarray[float]): Previous population fitness/function values

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.initPopulation`
		"""
        moth_pos, moth_fitness, args, d = Algorithm.init_population(self, task)
        # Create best population
        indexes = np.argsort(moth_fitness)
        best_flames, best_flame_fitness = moth_pos[indexes], moth_fitness[
            indexes]
        # Init previous population
        previous_population, previous_fitness = np.zeros(
            (self.NP, task.D)), np.zeros(self.NP)
        d.update({
            'best_flames': best_flames,
            'best_flame_fitness': best_flame_fitness,
            'previous_population': previous_population,
            'previous_fitness': previous_fitness
        })
        return moth_pos, moth_fitness, args, d
Пример #10
0
    def init_population(self, task):
        r"""Initialize population and dynamic arguments of the Particle Swarm Optimization algorithm.

		Args:
			task: Optimization task.

		Returns:
			Tuple[numpy.ndarray, numpy.ndarray, list, dict]:
				1. Initial population.
				2. Initial population fitness/function values.
				3. Additional arguments.
				4. Additional keyword arguments:
					* popb (numpy.ndarray): particles best population.
					* fpopb (numpy.ndarray[float]): particles best positions function/fitness value.
					* w (numpy.ndarray): Inertial weight.
					* min_velocity (numpy.ndarray): Minimal velocity.
					* max_velocity (numpy.ndarray): Maximal velocity.
					* V (numpy.ndarray): Initial velocity of particle.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.initPopulation`
		"""
        pop, fpop, args, d = Algorithm.init_population(self, task)
        d.update(self.init(task))
        d.update({'popb': pop.copy(), 'fpopb': fpop.copy()})
        return pop, fpop, args, d
Пример #11
0
    def init_population(self, task):
        r"""Initialize the first herd/population.

		Args:
			task (Task): Optimization task.

		Returns:
			Tuple[numpy.ndarray, numpy.ndarray, list, dict]:
				1. Initialized herd/population.
				2. Initialized herd/populations function/fitness values.
				3. Additional arguments.
				4. Additional keyword arguments:
					* KHo (numpy.ndarray): TODO
					* KHo_f (float): TODO
					* N (numpy.ndarray): TODO
					* F (numpy.ndarray): TODO
					* Dt (numpy.ndarray): TODO

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.initPopulation`
		"""
        KH, KH_f, args, kwargs = Algorithm.init_population(self, task)
        KHo, KHo_f = np.full([self.NP, task.D],
                             task.optType.value * np.inf), np.full(
                                 self.NP, task.optType.value * np.inf)
        N, F, Dt = np.full(self.NP, .0), np.full(self.NP,
                                                 .0), np.mean(task.range()) / 2
        kwargs.update({'KHo': KHo, 'KHo_f': KHo_f, 'N': N, 'F': F, 'Dt': Dt})
        return KH, KH_f, args, kwargs
Пример #12
0
    def init_population(self, task):
        r"""Initialize stating population.

		Args:
			task (Task): Optimization task.

		Returns:
			Tuple[numpy.ndarray, numpy.ndarray, list, dict]:
				1. Initialized population.
				2. Initialized populations function/fitness values.
				3. Additional arguments.
				4. Additional keyword arguments:
					* W_n (numpy.ndarray): Weights neighborhood.
					* W_f (numpy.ndarray): Weights foraging.
					* N (numpy.ndarray): TODO
					* F (numpy.ndarray): TODO

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.initPopulation`
		"""
        KH, KH_f, args, kwargs = Algorithm.init_population(self, task)
        W_n, W_f = self.init_weights(task)
        N, F = np.full(self.NP, .0), np.full(self.NP, .0)
        kwargs.update({'W_n': W_n, 'W_f': W_f, 'N': N, 'F': F})
        return KH, KH_f, args, kwargs
Пример #13
0
	def type_parameters():
		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:`WeOptPy.algorithms.Algorithm.typeParameters`
		"""
		d = Algorithm.type_parameters()
		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
Пример #14
0
    def type_parameters():
        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.type_parameters()
        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
Пример #15
0
	def set_parameters(self, n=25, l0=5, nt=5, rho=0.4, gamma=0.6, beta=0.08, s=0.03, Distance=euclidean, **ukwargs):
		r"""Set the arguments of an algorithm.

		Arguments:
			n (Optional[int]): Number of glowworms in population.
			l0 (Optional[float]): Initial luciferin quantity for each glowworm.
			nt (Optional[float]): --
			rs (Optional]float]): Maximum sensing range.
			rho (Optional[float]): Luciferin decay constant.
			gamma (Optional[float]): Luciferin enhancement constant.
			beta (Optional[float]): --
			s (Optional[float]): --
			Distance (Optional[Callable[[numpy.ndarray, numpy.ndarray], float]]]): Measure distance between two individuals.
		"""
		ukwargs.pop('n', None)
		Algorithm.set_parameters(self, n=n, **ukwargs)
		self.l0, self.nt, self.rho, self.gamma, self.beta, self.s, self.Distance = l0, nt, rho, gamma, beta, s, Distance
Пример #16
0
	def set_parameters(self, n=50, omega=0.25, mu=0.5, alpha=0.5, S_init=10, E_init=10, T_min=-10, T_max=10, **ukwargs):
		r"""Set the arguments of an algorithm.

		Arguments:
			n (Optional[int]): Population size :math:`\in [1, \infty)`.
			T_min (Optional[float]): Minimum temperature, must be true :math:`$T_{min} < T_{max}`.
			T_max (Optional[float]): Maximum temperature, must be true :math:`T_{min} < T_{max}`.
			omega (Optional[float]): Burden factor :math:`\in [0, 1]`.
			mu (Optional[float]): Dying rate :math:`\in [0, 1]`.
			S_init (Optional[float]): Initial supply :math:`\in (0, \infty)`.
			E_init (Optional[float]): Initial endurance :math:`\in (0, \infty)`.

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.setParameters`
		"""
		Algorithm.set_parameters(self, n=n, itype=Camel, init_pop_func=ukwargs.pop('init_pop_func', self.init_pop), **ukwargs)
		self.omega, self.mu, self.alpha, self.S_init, self.E_init, self.T_min, self.T_max = omega, mu, alpha, S_init, E_init, T_min, T_max
Пример #17
0
	def set_parameters(self, n=10, lt=3, al=10, lsc=1, gsc=1, tr=0.3, **ukwargs):
		r"""Set the parameters of the algorithm.

		Args:
			n (Optional[int]): Population size.
			lt (Optional[int]): Life time parameter.
			al (Optional[int]): Area limit parameter.
			lsc (Optional[int]): Local seeding changes parameter.
			gsc (Optional[int]): Global seeding changes parameter.
			tr (Optional[float]): Transfer rate parameter.
			ukwargs (Dict[str, Any]): Additional arguments.

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.setParameters`
		"""
		Algorithm.set_parameters(self, n=n, **ukwargs)
		self.lt, self.al, self.lsc, self.gsc, self.tr = lt, al, lsc, gsc, tr
Пример #18
0
    def type_parameters():
        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.type_parameters()
Пример #19
0
    def set_parameters(self,
                       n=25,
                       ts=5,
                       mr=0.25,
                       cr=0.25,
                       selection=tournament_selection,
                       crossover=uniform_crossover,
                       mutation=uniform_mutation,
                       **ukwargs):
        r"""Set the parameters of the algorithm.

		Arguments:
			n (Optional[int]): Population size.
			ts (Optional[int]): Tournament selection.
			mr (Optional[int]): Mutation rate.
			cr (Optional[float]): Crossover rate.
			selection (Optional[Callable[[numpy.ndarray[Individual], int, int, Individual, mtrand.RandomState], Individual]]): Selection operator.
			crossover (Optional[Callable[[numpy.ndarray[Individual], int, float, mtrand.RandomState], Individual]]): Crossover operator.
			mutation (Optional[Callable[[numpy.ndarray[Individual], int, float, Task, mtrand.RandomState], Individual]]): Mutation operator.

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.setParameters`
			* Selection:
				* :func:`WeOptPy.algorithms.TournamentSelection`
				* :func:`WeOptPy.algorithms.RouletteSelection`
			* Crossover:
				* :func:`WeOptPy.algorithms.UniformCrossover`
				* :func:`WeOptPy.algorithms.TwoPointCrossover`
				* :func:`WeOptPy.algorithms.MultiPointCrossover`
				* :func:`WeOptPy.algorithms.CrossoverUros`
			* Mutations:
				* :func:`WeOptPy.algorithms.UniformMutation`
				* :func:`WeOptPy.algorithms.CreepMutation`
				* :func:`WeOptPy.algorithms.MutationUros`
		"""
        Algorithm.set_parameters(self,
                                 n=n,
                                 itype=ukwargs.pop('itype', Individual),
                                 init_pop_func=ukwargs.pop(
                                     'init_pop_func', default_individual_init),
                                 **ukwargs)
        self.Ts, self.Mr, self.Cr = ts, mr, cr
        self.Selection, self.Crossover, self.Mutation = selection, crossover, mutation
Пример #20
0
    def set_parameters(self,
                       HMS=30,
                       r_accept=0.7,
                       r_pa=0.35,
                       b_range=1.42,
                       **ukwargs):
        r"""Set the arguments of the algorithm.

		Arguments:
			HMS (Optional[int]): Number of harmony in the memory
			r_accept (Optional[float]): Probability of accepting new bandwidth to harmony.
			r_pa (Optional[float]): Probability of accepting random bandwidth into harmony.
			b_range (Optional[float]): Bandwidth range.

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.setParameters`
		"""
        ukwargs.pop('n', None)
        Algorithm.set_parameters(self, n=HMS, **ukwargs)
        self.r_accept, self.r_pa, self.b_range = r_accept, r_pa, b_range
Пример #21
0
    def set_parameters(self, n=40, f=0.7, r=0.3, c=3, fc=0.5, **ukwargs):
        r"""Set Monkey King Evolution v1 algorithms static parameters.

		Args:
			n (int): Population size.
			f (float): Scale factor for normal particle.
			r (float): Percentage value of now many new particle Monkey King particle creates. Value in rage [0, 1].
			c (int): Number of new particles generated by Monkey King particle.
			fc (float): Scale factor for Monkey King particles.
			ukwargs (Dict[str, Any]): Additional arguments.

		See Also:
			* :func:`NiaPy.algorithms.algorithm.Algorithm.setParameters`
		"""
        Algorithm.set_parameters(self,
                                 n=n,
                                 itype=ukwargs.pop('itype', MkeSolution),
                                 init_pop_func=ukwargs.pop(
                                     'init_pop_func', default_individual_init),
                                 **ukwargs)
        self.F, self.R, self.C, self.FC = f, r, c, fc
Пример #22
0
    def set_parameters(self,
                       N=40,
                       m=40,
                       a=1,
                       b=2,
                       A=40,
                       epsilon=1e-31,
                       **ukwargs):
        r"""Set the arguments of an algorithm.

		Arguments:
			N (int): Number of Fireworks
			m (int): Number of sparks
			a (int): Limitation of sparks
			b (int): Limitation of sparks
			A (float): TODO.
			epsilon (float): Small number for non 0 devision
		"""
        ukwargs.pop('n', None)
        Algorithm.set_parameters(self, n=N, **ukwargs)
        self.m, self.a, self.b, self.A, self.epsilon = m, a, b, A, epsilon
Пример #23
0
    def get_parameters(self):
        r"""Get algorithms parameters values.

		Returns:
			Dict[str, Any]: Dictionary of parameters name and value.

		See Also:
			* :func:`NiaPy.algorithms.Algorithm.getParameters`
		"""
        d = Algorithm.get_parameters(self)
        d.update({'F': self.F, 'R': self.R, 'C': self.C, 'FC': self.FC})
        return d
Пример #24
0
    def set_parameters(self,
                       N=25,
                       phi=0.4,
                       Fa=0.5,
                       Fb=0.5,
                       Fd=0.3,
                       k=25,
                       P_Cr=0.5,
                       P_F=0.36,
                       SexualCrossover=sexual_crossover_simple,
                       Brooding=brooding_simple,
                       Distance=euclidean,
                       **ukwargs):
        r"""Set the parameters of the algorithm.

		Arguments:
			N (int): population size for population initialization.
			phi (int): TODO.
			Fa (float): Value $\in [0, 1]$ for Asexual reproduction size.
			Fb (float): Value $\in [0, 1]$ for Brooding size.
			Fd (float): Value $\in [0, 1]$ for Depredation size.
			k (int): Trys for larvae setting.
			SexualCrossover (Callable[[numpy.ndarray, float, Task, mtrand.RandomState, Dict[str, Any]], Tuple[numpy.ndarray, numpy.ndarray]]): Crossover function.
			P_Cr (float): Crossover rate $\in [0, 1]$.
			Brooding (Callable[[numpy.ndarray, float, Task, mtrand.RandomState, dict], Tuple[numpy.ndarray, numpy.ndarray]]): Brooding function.
			P_F (float): Crossover rate $\in [0, 1]$.
			Distance (Callable[[numpy.ndarray, numpy.ndarray], float]): Funciton for calculating distance between corals.

		See Also:
			* :func:`WeOptPy.algorithms.Algorithm.setParameters`
		"""
        ukwargs.pop('n', None)
        Algorithm.set_parameters(self, n=N, **ukwargs)
        self.phi, self.k, self.P_Cr, self.P_F = phi, k, P_Cr, P_F
        self.Fa, self.Fb, self.Fd = int(self.NP * Fa), int(self.NP * Fb), int(
            self.NP * Fd)
        self.SexualCrossover, self.Brooding, self.Distance = SexualCrossover, Brooding, Distance
Пример #25
0
	def get_parameters(self):
		r"""Get parameters values of the algorithm.

		Returns:
			Dict[str, Any]: TODO.
		"""
		d = Algorithm.get_parameters(self)
		d.update({
			'lt': self.lt,
			'al': self.al,
			'lsc': self.lsc,
			'gsc': self.gsc,
			'tr': self.tr
		})
		return d
Пример #26
0
    def get_parameters(self):
        r"""Get algorithm parameters values.

        Returns:
            Dict[str, Any]: TODO.

        See Also:
            * :func:`NiaPy.algorithms.algorithm.Algorithm.getParameters`
        """
        d = Algorithm.get_parameters(self)
        d.update({
            'G_0': self.G_0,
            'epsilon': self.epsilon
        })
        return d
Пример #27
0
	def type_parameters():
		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.type_parameters()
		d.update({
			'PAR': lambda x: isinstance(x, float) and x > 0,
			'PER': lambda x: isinstance(x, float) and x > 0
		})
		return d
Пример #28
0
	def get_parameters(self):
		r"""Get parameters values for the algorithm.

		Returns:
			Dict[str, Any]: TODO.
		"""
		d = Algorithm.get_parameters(self)
		d.update({
			'PAR': self.PAR,
			'PER': self.PER,
			'keep': self.keep,
			'BAR': self.BAR,
			'NP1': self.NP1,
			'NP2': self.NP2
		})
		return d
Пример #29
0
	def get_parameters(self):
		r"""Get parameters of the algorithm.

		Returns:
			Dict[str, Any]:
		"""
		d = Algorithm.get_parameters(self)
		d.update({
			'omega': self.omega,
			'mu': self.mu,
			'alpha': self.alpha,
			'S_init': self.S_init,
			'E_init': self.E_init,
			'T_min': self.T_min,
			'T_max': self.T_max
		})
		return d
Пример #30
0
    def type_parameters():
        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.type_parameters()
        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