metaheuristic_designer.constraint_handlers.cycle_bound_constraint module#
- class CycleBoundConstraint(dimension, lower_bound=-100, upper_bound=100, **kwargs)[source]#
Bases:
RepairConstraintEncodes a bound constraint by wrapping through the bounds, performing a modulo operation componentwise.
- Parameters:
- dimension: int
size of the input vector (decoded).
- lower_bound: float | ndarray, optional
lower limit of the bounds.
- upper_bound: float | ndarray, optional
upper limit of the bounds.
- Attributes:
paramsAccess parameter values by attribute-style lookup.
- Parameters:
lower_bound (ScalarLike | VectorLike)
upper_bound (ScalarLike | VectorLike)
Methods
get_params()Return a copy of the current parameter dictionary.
penalty(solutions)Offset to the objective value for the solution corresponding to violations of the problem's constraints.
repair_solutions(population_matrix)Modifies the incoming solution so that it follows the problem's constraints.
store_kwargs([progress])Store keyword arguments and evaluate them at the given progress.
update(progress)Re-evaluate all stored parameters at the current progress.
update_kwargs([progress])Add or replace parameters and immediately evaluate them.
get_state
repair_population
- repair_solutions(population_matrix)[source]#
Modifies the incoming solution so that it follows the problem’s constraints.
- Return type:
ndarray[tuple[int,int],floating] |ndarray[tuple[int,int],integer] |ndarray[tuple[int,int],uint8|bool]- Parameters:
- solution: Any
The input solution.
- Returns:
- fixed_solution: Any
Modified version of the input solution that fits the problem’s constraints
- Parameters:
population_matrix (ndarray[tuple[int, int], floating] | ndarray[tuple[int, int], integer] | ndarray[tuple[int, int], uint8 | bool])