'Given all "previous" candidate solutions and their respective
function values, the state of a `CMAEvolutionStrategy` object
can be reconstructed from this history. This is the purpose of
function `feedForResume`.
Arguments
`X`
(all) solution points in chronological order, phenotypic
representation. The number of points must be a multiple
of popsize.
`function_values`
respective objective function values
Details
`feedForResume` can be called repeatedly with only parts of
the history. The part must have the length of a multiple
of the population size.
`feedForResume` feeds the history in popsize-chunks into `tell`.
The state of the random number generator might not be
reconstructed, but this would be only relevant for the future.
Example
import cma
# prepare
(x0, sigma0) = ... # initial values from previous trial
X = ... # list of generated solutions from a previous trial
f = ... # respective list of f-values
# resume
es = cma.CMAEvolutionStrategy(x0, sigma0)
es.feedForResume(X, f)
# continue with func as objective function
while not es.stop():
X = es.ask()
es.tell(X, [func(x) for x in X])
Credits to Dirk Bueche and Fabrice Marchal for the feeding idea.
:See: class `CMAEvolutionStrategy` for a simple dump/load to resume'

def feedForResume(self, X, function_values):

    if (self.countiter > 0):
        print('WARNING:    feed    should    generally    be    used    with    a    new    object    instance')
    if (len(X) != len(function_values)):
        raise _Error((((('number    of    solutions    ' + str(len(X))) + '    and    number    function    values    ') + str(len(function_values))) + '    must    not    differ'))
    popsize = self.sp.popsize
    if ((len(X) % popsize) != 0):
        raise _Error(((('number    of    solutions    ' + str(len(X))) + '    must    be    a    multiple    of    popsize    (lambda)    ') + str(popsize)))
    for i in xrange((len(X) / popsize)):
        self.ask()
        self.tell(X[(i * popsize):((i + 1) * popsize)], function_values[(i * popsize):((i + 1) * popsize)])
