Chaotic Optimization
Contents
Chaotic Optimization
Chaotic Optimization
- class Chaotic_optimization(search_space, f_calls, chaos_map=<class 'zellij.strategies.tools.chaos_map.Henon'>, exploration_ratio=0.3, levels=(32, 6, 2), polygon=4, red_rate=0.5, verbose=True)[source]
Bases:
zellij.core.metaheuristic.MetaheuristicChaotic optimization combines CGS, CLS and CFS.
- chaos_map
If a string is given, the algorithm will select the corresponding map. The chaotic map is used to sample points. If it is a map, it will directly use it. Be carefull, the map size must be sufficient according to the parametrization.
- Type
{‘henon’, ‘kent’, ‘tent’, ‘logistic’, ‘random’, Chaos_map}
- exploration_ratio
It will determine the number of calls to the loss function dedicated to exploration and exploitation, according to chaotic levels associated to CGS, CLS and CFS.
- Type
float
- polygon
Vertex number of the rotating polygon (has an influence on the number of evaluated points) for CLS and CFS
- Type
int
- red_rate
Reduction rate of the progressive zoom on the best solution found for CLS and CFS
- Type
float
- CGS_level
Number of chaotic level associated to CGS
- Type
int
- CLS_level
Number of chaotic level associated to CLS
- Type
int
- CFS_level
Number of chaotic level associated to CFS
- Type
int
- verbose
Algorithm verbosity
- Type
boolean, default=True
- run(self, n_process=1)[source]
Runs Chaotic_optimization
See also
- Metaheuristic
Parent class defining what a Metaheuristic is
CGSChaotic Global Search
CLSChaotic Local Search
CFSChaotic Fine Search
Examples
>>> from zellij.core import Loss >>> from zellij.core import ContinuousSearchspace >>> from zellij.core import FloatVar, ArrayVar >>> from zellij.strategies import Chaotic_optimization >>> from zellij.utils.benchmark import himmelblau ... >>> lf = Loss()(himmelblau) >>> sp = ContinuousSearchspace(ArrayVar(FloatVar("a",-5,5), FloatVar("b",-5,5)),lf) >>> co = Chaotic_optimization(sp, 1000) >>> co.run()
- run(H=None, n_process=1)[source]
Runs the Chaotic_optimization
- Parameters
H (Fractal, default=None) – When used by Decomposition Based Algorithm, a fractal corresponding to the current subspace is given
n_process (int, default=1) – Determine the number of best solution found to return.
- Returns
best_sol (list[float]) – Returns a list of the
n_processbest found points to the continuous formatbest_scores (list[float]) – Returns a list of the
n_processbest found scores associated to best_sol
Chaotic Global Search
- class CGS(search_space, f_calls, level, map, verbose=True)[source]
Bases:
zellij.core.metaheuristic.MetaheuristicChaotic Global search
CGS is an exploration Metaheuristic using chaos to violently move in the Search space. It is continuous optimization, so the Search space is converted to continuous. To do so, it uses a Chaos maps, such as Henon or Kent map.
- level
Chaotic level corresponds to the number of iteration of the chaotic map
- Type
int
- map
Chaotic map used to sample points. See Chaos_map object.
- Type
Chaos_map
- up_bounds
List of float containing the upper bounds of the search space converted to continuous
- Type
list
- lo_bounds
List of float containing the lower bounds of the search space converted to continuous
- Type
list
- center
List of floats containing the coordinates of the search space center converted to continuous
- Type
float
- radius
List of floats containing the radius for each dimensions of the search space converted to continuous
- Type
float
See also
- Metaheuristic
Parent class defining what a Metaheuristic is
Chaotic_optimizationCGS is used here to perform an exploration
CLSChaotic Local Search
CFSChaotic Fine Search
Examples
>>> from zellij.core import Loss >>> from zellij.core import ContinuousSearchspace >>> from zellij.core import FloatVar, ArrayVar >>> from zellij.strategies import CGS >>> from zellij.strategies.tools import Henon >>> from zellij.utils.benchmark import himmelblau ... >>> lf = Loss()(himmelblau) >>> sp = ContinuousSearchspace(ArrayVar(FloatVar("a",-5,5), FloatVar("b",-5,5)),lf) ... ... # Henon(map size, dimensions) >>> chaosmap = Henon(250,sp.size) ... # 4 points/iterations: 4x250=1000 >>> cgs = CGS(sp, 1000, 250, chaosmap) >>> cgs.run()
- run(shift=1, H=None, n_process=1)[source]
- Parameters
shift (int, default=1) – Determines the starting point of the chaotic map.
H (Fractal, default=None) – When used by Decomposition Based Algorithm, a fractal corresponding to the current subspace is given
n_process (int, default=1) – Determines the number of best solution found to return.
- Returns
best_sol (list[float]) – Returns a list of the
n_processbest found points to the continuous formatbest_scores (list[float]) – Returns a list of the
n_processbest found scores associated to best_sol
Chaotic Local Search
- class CLS(search_space, f_calls, level, polygon, map, verbose=True)[source]
Bases:
zellij.core.metaheuristic.MetaheuristicChaotic Local Search
CLS is an exploitation Metaheuristic using chaos to wiggle points arround an initial solution. It uses a rotating polygon to distribute those points, a progressive and mooving zoom on the best solution found, to refine it. It is continuous optimization, so the Search space is converted to continuous. To do so, it uses a Chaos maps, such as Henon or Kent map.
- level
Chaotic level: the number of iteration of the chaotic map
- Type
int
- map
Chaotic map used to sample points. See Chaos_map object.
- Type
Chaos_map
- polygon
Vertex number of the rotating polygon (has an influence on the number of evaluated points)
- Type
int
- red_rate
Reduction rate of the progressive zoom on the best solution found
- Type
float
- up_bounds
List of float containing the upper bounds of the search space converted to continuous
- Type
list
- lo_bounds
List of float containing the lower bounds of the search space converted to continuous
- Type
list
- center
List of floats containing the coordinates of the search space center converted to continuous
- Type
float
- radius
List of floats containing the radius for each dimensions of the search space converted to continuous
- Type
float
See also
- Metaheuristic
Parent class defining what a Metaheuristic is
Chaotic_optimizationCLS is used here to perform an exploitation
CGSChaotic Global Search
CFSChaotic Fine Search
Examples
>>> from zellij.core import Loss >>> from zellij.core import ContinuousSearchspace >>> from zellij.core import FloatVar, ArrayVar >>> from zellij.strategies import CLS >>> from zellij.strategies.tools import Henon >>> from zellij.utils.benchmark import himmelblau ... >>> lf = Loss()(himmelblau) >>> sp = ContinuousSearchspace(ArrayVar(FloatVar("a",-5,5), FloatVar("b",-5,5)),lf) ... ... # Henon(map size, dimensions) >>> chaosmap = Henon(50,sp.size) ... # 2xpolygon points/iterations: 2x10x50=1000 >>> cls = CLS(sp, 1000, 50, 10,chaosmap) >>> point = sp.random_point() >>> cls.run(point, lf([point])[0])
- run(X0=None, Y0=None, chaos_level=0, shift=1, H=None, n_process=1)[source]
- Parameters
X0 (list[float], optional) – Initial solution. If None, a Fractal must be given (H!=None)
Y0 ({int, float}, optional) – Score of the initial solution
chaos_level (int, default=0) – Determines at which level of the chaos map, the algorithm starts
shift (int, default=1) – Determines the starting point of the chaotic map.
H (Fractal, optional) – When used by Decomposition Based Algorithm, a fractal corresponding to the current subspace is given
n_process (int, default=1) – Determines the number of best solution found to return.
- Returns
best_sol (list[float]) – Returns a list of the
n_processbest found points to the continuous formatbest_scores (list[float]) – Returns a list of the
n_processbest found scores associated to best_sol
Chaotic Fine Search
- class CFS(search_space, f_calls, level, polygon, map, verbose=True)[source]
Bases:
zellij.core.metaheuristic.MetaheuristicChaotic Fine Search
CFS is an exploitation Metaheuristic using chaos to wiggle points arround an initial solution. Contrary to CLS, CFS uses an exponential zoom on the best solution found, it works at a much smaller scale than the CLS. It is continuous optimization, so the Search space is converted to continuous. To do so, it uses a Chaos maps, such as Henon or Kent map.
- level
Chaotic level corresponds to the number of iteration of the chaotic map
- Type
int
- map
Chaotic map used to sample points. See Chaos_map object.
- Type
Chaos_map
- polygon
Vertex number of the rotating polygon (has an influence on the number of evaluated points)
- Type
int
- red_rate
Reduction rate of the progressive zoom on the best solution found
- Type
float
- up_bounds
List of float containing the upper bounds of the search space converted to continuous
- Type
list
- lo_bounds
List of float containing the lower bounds of the search space converted to continuous
- Type
list
- center
List of floats containing the coordinates of the search space center converted to continuous
- Type
float
- radius
List of floats containing the radius for each dimensions of the search space converted to continuous
- Type
float
See also
- Metaheuristic
Parent class defining what a Metaheuristic is
Chaotic_optimizationCLS is used here to perform an exploitation
CGSChaotic Global Search
CLSChaotic Local Search
Examples
>>> from zellij.core import Loss >>> from zellij.core import ContinuousSearchspace >>> from zellij.core.variables import FloatVar, ArrayVar >>> from zellij.strategies import CFS >>> from zellij.strategies.tools import Henon >>> from zellij.utils.benchmark import himmelblau ... >>> lf = Loss()(himmelblau) >>> sp = ContinuousSearchspace(ArrayVar(FloatVar("a",-5,5), FloatVar("b",-5,5)),lf) ... ... # Henon(map size, dimensions) >>> chaosmap = Henon(50,sp.size) ... # 2xpolygon points/iterations: 2x10x50=1000 >>> cfs = CFS(sp, 1000, 50, 10, chaosmap) >>> point = sp.random_point() >>> cfs.run(point, lf([point])[0])
- stochastic_round(solution, k)[source]
- run(X0=None, Y0=None, chaos_level=0, shift=1, H=None, n_process=1)[source]
- Parameters
X0 (list[float], optional) – Initial solution. If None, a Fractal must be given (H!=None)
Y0 ({int, float}, optional) – Score of the initial solution
chaos_level (int, default=0) – Determines at which level of the chaos map, the algorithm starts
shift (int, default=1) – Determines the starting point of the chaotic map.
H (Fractal, optional) – When used by Decomposition Based Algorithm, a fractal corresponding to the current subspace is given
n_process (int, default=1) – Determines the number of best solution found to return.
- Returns
best_sol (list[float]) – Returns a list of the
n_processbest found points to the continuous formatbest_scores (list[float]) – Returns a list of the
n_processbest found scores associated to best_sol
Chaos maps
- class Chaos_map(vectors, params)[source]
Bases:
objectChaos_mapis in abstract class describing what a chaos map is.- vectors
Size of the map (rows).
- Type
int
- params
Number of parameters (columns).
- Type
int
- map
Chaos map of shape (vectors, params).
- Type
np.array
See also
Chaotic_optimizationChaos map is used here.
- class Henon(vectors, params, a=1.402056, b=0.305620406)[source]
Bases:
zellij.strategies.tools.chaos_map.Chaos_mapHenon chaotic map

- Parameters
vectors (int) – Map size
params (int) – Number of dimensions
a (float, default=1.4020560) – Henon map parameter. Has an influence on the chaotic, intermittent or periodicity behaviors.
b (float, default=0.305620406) – Henon map parameter. Has an influence on the chaotic, intermittent or periodicity behaviors.
- map
Chaos map of size (vectors,param)
- Type
numpy.ndarray
- class Kent(vectors, params, beta=0.8)[source]
Bases:
zellij.strategies.tools.chaos_map.Chaos_mapKent chaotic map

- Parameters
vectors (int) – Map size
params (int) – Number of dimensions
beta (float, default=0.8) – Kent map parameter. Has an influence on the chaotic, intermittent, convergence, or periodicity behaviors.
- map
Chaos map of size (vectors,param)
- Type
numpy.ndarray
- class Logistic(vectors, params, mu=3.57)[source]
Bases:
zellij.strategies.tools.chaos_map.Chaos_mapLogistic chaotic map

- Parameters
vectors (int) – Map size
params (int) – Number of dimensions
mu (float, default=3.57) – Logistic map parameter. Has an influence on the chaotic, intermittent, convergence, or periodicity behaviors.
- map
Chaos map of size (vectors,param)
- Type
numpy.ndarray
- class Tent(vectors, params, mu=1.9999999999)[source]
Bases:
zellij.strategies.tools.chaos_map.Chaos_mapTent chaotic map

- Parameters
vectors (int) – Map size
params (int) – Number of dimensions
Tent (float, default=1.9999999999) – Logistic map parameter. Has an influence on the chaotic, intermittent, convergence, or periodicity behaviors.
- map
Chaos map of size (vectors,param)
- Type
numpy.ndarray
- class Random(vectors, params)[source]
Bases:
zellij.strategies.tools.chaos_map.Chaos_map