I manage the digital DNA parameters of the evolving species.

I can pretty-print values with their parameter names, check if values pass constraints, limit values to their bounds, scale unity-range values to their appropriate ranges, and let you iterate over sorted parameter names.

ParametersconstraintsA single callable object (function, method, class instance with __call__ method), or a sequence of such objects, that enforce(s) any constraints on your parameter values. See passesConstraints. Instead of a sequence, you can use an instance of constraints.Constraints.
Instance Variable mins Lower bound of each parameter.
Instance Variable maxs Lower bound of each parameter.
Method __init__ Undocumented
Method setup Call to set (or reset) the bounds of my parameters.
Method __getstate__ For pickling.
Method __setstate__ For unpickling.
Method stringValue For the parameter with position k, returns the float value formatted as a string. Adds a '*' if value within 5% of the lower bound, or '**' if within 5% of the upper bound.
Method prettyValues Returns an easily readable string representation of the supplied values with their parameter names, sorted.
Method sortedNamerator Generates tuples of sorted names, or just the sorted names if namesOnly is set True.
Method fromUnity Translates normalized into actual values.
Method toUnity Translates actual into normalized values.
Method setConstraints Sets my constraints list to the callable function(s), method(s), or object(s) supplied as one or more arguments.
Method passesConstraints Checks if values pass all my constraints.
Method limit Limits the supplied values to my boundaries using the simple and well-accepted "reflection" method.
mins =
Lower bound of each parameter.
maxs =
Lower bound of each parameter.
def __init__(self, names, bounds, constraints=[]):
Undocumented
def setup(self, bounds):

Call to set (or reset) the bounds of my parameters.

def __getstate__(self):

For pickling.

def __setstate__(self, state):

For unpickling.

def stringValue(self, k, value, forColumn=False):

For the parameter with position k, returns the float value formatted as a string. Adds a '*' if value within 5% of the lower bound, or '**' if within 5% of the upper bound.

def prettyValues(self, values, *args):

Returns an easily readable string representation of the supplied values with their parameter names, sorted.

Adds a '*' if < 5% of the way from lower to upper bound, or '**' if > 95% of the way

You can provide as an additional argument a prelude string, or a string proto with additional args, and the string will precede the values.

def sortedNamerator(self, values=None, namesOnly=False):

Generates tuples of sorted names, or just the sorted names if namesOnly is set True.

Each tuple contains (1) the index in a values list of parameters where each named parameter appears, and (2) the name itself. If such a list of values is supplied, each tuple also includes (3) the value for that name.

def fromUnity(self, values):

Translates normalized into actual values.

Converts the supplied normalized values from the standardized range of 0-1 into my range of actual parameter values within the ranges specified in the bounds supplied to my constructor.

def toUnity(self, values):

Translates actual into normalized values.

Converts the supplied actual parameter values into the standardized range of 0-1 within the ranges specified in the bounds supplied to my constructor.

def setConstraints(self, *args):

Sets my constraints list to the callable function(s), method(s), or object(s) supplied as one or more arguments.

What you supply as arguments will any constraint checking already in place, so make sure you everything you want is included.

All constraints, and only those constraints, defined by this call will need to be be satisfied with each parameter combination. To clear any existing constraints, call with no args.

Called by Population.setConstraints.

def passesConstraints(self, values):

Checks if values pass all my constraints.

Call with a 1-D array of parameter values to check them against all of the constraints. Each callable in my constraints list must return True if it found the parameters (supplied to each callable as a dict) to be acceptable. The result will be True if and only if all constraints were satisfied. (Or if you constructed me with an empty list.)

def limit(self, values):

Limits the supplied values to my boundaries using the simple and well-accepted "reflection" method.

According to a study by Kreischer, Magalhaes, et al. ("Evaluation of Bound Constraints Handling Methods in Differential Evolution using the CEC2017 Benchmark"), this is second and performance only to resampling for a new DE mutant. (They also propose a "scaled mutant" method that is more complicated, but according to their Tables 1, 2, doesn't appear significantly better.)

API Documentation for ade, generated by pydoctor at 2022-11-17 13:13:22.