a.p.Population(object) : class documentation
Construct me with a callable evaluation func that accepts a 1-D Numpy array of parameter values, a sequence of names for the parameters, and a sequence of bounds containing 2-tuples that each define the lower and upper limits of the values.
The evaluation function must return the sum of squared errors (SSE) as a single float value. In addition to the array of parameter values, it must also accept a keyword or optional second argument xSSE, which (if provided) is the SSE of the target individual being challenged. The evaluation function need not continue its computations if it accumulates an SSE greater than xSSE; it can just return that greater SSE and conclude operations. That's because DE uses a greedy evaluation function, where the challenger will always be accepted if it is *any* better than the target.
If just one argument (the paremeter value 1-D array) is provided, your evaluation function must return the fully computed SSE.
|Method||__setitem__||Use only this method (item setting) and
|Method||limit||Limits the individual's parameter values to the bounds in the way that
|Method||push||Pushes the supplied individual into my population and kicks out the worst individual there to make room.|
|Method||sample||Returns a sample of N indices from my population that are unique from each other and from any excluded indices supplied as additional arguments.|
|Method||individuals||Immediately returns a list of the individuals at the specified indices.|
|Method||lock||Obtains the locks for individuals at the specified indices, submits a
request to acquire them, and returns a
Use only this method (item setting) and
push to replace
Limits the individual's parameter values to the bounds in the way that
is configured to do, modifying the individual in place.
def setup(self, uniform=False, blank=False):
Sets up my initial population using a Latin hypercube to initialize pseudorandom parameters with minimal clustering. With parameter constraints, this doesn't work as well, because the initial values matrix must be refreshed, perhaps many times. But it may still be better than uniform initial population sampling.
Deferred fires when the population has been set
Call with an integer improvementRatio to record a replacement occurring in this generation or iteration, or with the keyword sqs set to a float statusQuoScore other than my default. Otherwise, call with nothing to determine if the replacement that occurred in the previous generation/iteration were enough to warrant maintaining the status quo, and to reset the record.
The status quo will be maintained if several small improvements are made, or fewer larger ones, with the required number and/or size increasing for a larger population. For small populations where even a single improvement would be significant, the probability of status quo maintenance increases with smaller population and will sometimes happen even with no improvements for a given generation or iteration.
True if the status quo should be maintained.
Provides a message via the log messenger about the supplied Individual, optionally with a comparison to another Individual. If no second individual is supplied, the comparison will be with the best individual thus far reported on.
Does a call to
if the new individual is better.
Pushes the supplied individual into my population and kicks out the worst individual there to make room.
Returns a sample of N indices from my population that are unique from each other and from any excluded indices supplied as additional arguments.
Immediately returns a list of the individuals at the specified indices.
Obtains the locks for individuals at the specified indices, submits a
request to acquire them, and returns a
Deferred that fires
when all of them have been acquired.
Release the locks (as soon as possible) by calling
the indices that are locked.