Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feed_for_resume does not always work as desired #240

Open
nikohansen opened this issue Oct 12, 2023 · 0 comments
Open

feed_for_resume does not always work as desired #240

nikohansen opened this issue Oct 12, 2023 · 0 comments

Comments

@nikohansen
Copy link
Contributor

nikohansen commented Oct 12, 2023

import cma

es = cma.CMA(3 * [1], 1)
es2 = cma.CMA(3 * [1], 1)

while es.countiter < 5:
    X = es.ask()
    F = [cma.ff.elli(x) for x in X]
    es2.feed_for_resume(X, F)
    es.tell(X, F)

es.mean - es2.mean, es.pc - es2.pc, es.sm.C - es2.sm.C

gives various outputs, for example (as desired)

(array([0., 0., 0.]),
 array([0., 0., 0.]),
 array([[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]]))

or

(array([0., 0., 0.]),
 array([-0.01003765, -0.00932539,  0.00022431]),
 array([[-3.00553023e-04,  1.62628230e-03, -3.18358657e-04],
        [ 1.62628230e-03,  2.95684916e-03, -5.22568484e-04],
        [-3.18358657e-04, -5.22568484e-04,  4.74778472e-05]]))

or

(array([0., 0., 0.]),
 array([0., 0., 0.]),
 array([[-4.00768307e-12, -2.87188329e-12,  8.28524749e-13],
        [-2.87186941e-12, -1.87161397e-12,  5.97299987e-13],
        [ 8.28545565e-13,  5.97286109e-13, -1.49491530e-13]]))

Sometimes also the mean is different.

Using a deep copy for feeding doesn't change the observation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant