opytimizer.optimizers.swarm.sca¶
Sine Cosine Algorithm.
-
class
opytimizer.optimizers.swarm.sca.
SCA
(params: Optional[Dict[str, Any]] = None)¶ A SCA class, inherited from Optimizer.
This is the designed class to define SCA-related variables and methods.
References
S. Mirjalili. SCA: A Sine Cosine Algorithm for solving optimization problems. Knowledge-Based Systems (2016).
-
__init__
(params: Optional[Dict[str, Any]] = None) → None¶ Initialization method.
Parameters: params – Contains key-value parameters to the meta-heuristics.
-
r_min
¶ Minimum function range.
-
r_max
¶ Maximum function range.
-
a
¶ Loudness parameter.
-
_update_position
(agent_position: numpy.ndarray, best_position: numpy.ndarray, r1: float, r2: float, r3: float, r4: float) → numpy.ndarray¶ Updates a single particle position over a single variable (eq. 3.3).
Parameters: - agent_position – Agent’s current position.
- best_position – Global best position.
- r1 – Controls the next position’s region.
- r2 – Defines how far the movement should be.
- r3 – Random weight for emphasizing or deemphasizing the movement.
- r4 – Random number to decide whether sine or cosine should be used.
Returns: A new position.
Return type: (np.ndarray)
-
update
(space: opytimizer.core.space.Space, iteration: int, n_iterations: int) → None¶ Wraps Sine Cosine Algorithm over all agents and variables.
Parameters: - space – Space containing agents and update-related information.
- iteration – Current iteration.
- n_iterations – Maximum number of iterations.
-