modea.Parameters module¶
This Parameters module is a container for all possible parameters and all ways in which they are adapted by various optimization methods.
-
class
modea.Parameters.
BaseParameters
¶ Bases:
object
Data holder class for all hardcoded values that are independent of problem dimensionality
-
alpha_mu
= 2¶
-
c
= 0.817¶
-
c_p
= 0.08333333333333333¶
-
conditioncov
= 100000000000000.0¶
-
p_target
= 0.18181818181818182¶
-
p_thresh
= 0.44¶
-
tolfun
= 1e-12¶
-
tolupsigma
= 1e+20¶
-
-
class
modea.Parameters.
Parameters
(n, budget, sigma=None, mu=None, lambda_=None, weights_option=None, l_bound=None, u_bound=None, seq_cutoff=1, wcm=None, active=False, elitist=False, local_restart=None, sequential=False, tpa=False, values=None)¶ Bases:
modea.Parameters.BaseParameters
Data holder class that initializes all possible parameters, regardless of what functions/algorithm are used If multiple functions/algorithms use the same parameter name, but differently, these will be split into separate parameters.
Parameters: - n – Dimensionality of the problem to be solved
- budget – Number of fitness evaluations the algorithm may perform
- mu – Number of individuals that form the parents of each generation
- lambda – Number of individuals in the offspring of each generation
- weights_option – String to determine which weignts to use.
Choose between
default
(CMA-ES) and1/n
- l_bound – Lower bound of the search space
- u_bound – Upper bound of the search space
- seq_cutoff – Minimal cut-off allowed in sequential selection
- wcm – Initial weighted center of mass
- active – Boolean switch on using an active update. Default: False
- elitist – Boolean switch on using a (mu, l) strategy rather than (mu + l). Default: False
- sequential – Boolean switch on using sequential evaluation. Default: False
- tpa – Boolean switch on using two-point step-size adaptation. Default: False
- values – Dictionary in the form of
{'name': value}
of initial values for allowed parameters. Any values for names not inmodea.Utils.initializable_parameters
are ignored.
-
adaptCovarianceMatrix
(evalcount)¶ Adapt the covariance matrix according to the (Active-)CMA-ES.
Parameters: evalcount – Number of evaluations used by the algorithm so far
-
addToFitnessHistory
(fitness)¶ Record the latest
fitness
value (with a history of 5 generations)Parameters: fitness – Fitness value to be recorded
-
addToSuccessHistory
(t, success)¶ Record the (boolean)
success
value at timet
Parameters: - t – Number of evaluations used by the algorithm so far
- success – Boolean that records whether the last update was a success
-
checkDegenerated
()¶ Check if the parameters (C, s_mean, etc) have degenerated and need to be reset. Designed for use by a CMA ES
-
checkLocalRestartConditions
(evalcount)¶ Check for local restart conditions according to (B)IPOP
Parameters: evalcount – Counter for the current generation Returns: Boolean value restart_required
, True if a restart should be performed
-
getParameterOpts
()¶
-
getWeights
(weights_option=None)¶ - Defines a list of weights to be used in weighted recombination. Available options are:
1/n
: Each weight is set to 1/n1/2^n
: Each weight is set to 1/2^i + (1/2^n)/mudefault
: Each weight is set to log((lambda-1)/2) - log(i)param weights_option: String to indicate which weights should be used. returns: Returns a np.array of weights, adding to 1
-
mu_int
¶ Integer value of mu
-
oneFifthRule
(t)¶ Adapts sigma based on the 1/5-th success rule
Parameters: t – Number of evaluations used by the algorithm so far
-
recordRecentFitnessValues
(evalcount, fitnesses)¶ Record recent fitness values at current budget
-
restart
()¶ Very basic restart, done by resetting some of the variables for CMA-ES
-
updateThreshold
(t)¶ Update the threshold that is used to maintain a minimum stepsize. Taken from: Evolution Strategies with Thresheld Convergence (CEC 2015)
Parameters: t – Ammount of the evaluation budget spent