You are looking at historical revision 27647 of this page. It may differ significantly from its current revision.
CMA-ES (Evolution Strategy with Covariance Matrix Adaptation) optimization library.
The CMA-ES CMA-ES (Covariance Matrix Adaptation Evolution Strategy) is an evolutionary algorithm for difficult non-linear non-convex optimization problems in a continuous domain.
The Chicken cmaes library provides a Scheme interface to the core procedures of CMA-ES.
Initialization procedures[procedure] init:: [PARAMETER1 ...] -> [H FUNVALS]
[procedure] init-from-file:: FILEPATH -> [H FUNVALS]
[procedure] read-signals:: H * [PARAMETER1 ...] -> VOID
[procedure] read-signals-from-file:: H * FILEPATH -> VOID
Core procedures[procedure] sample-population:: H -> VECTOR
Computes a population of lambda N-dimensional multivariate normally distributed samples.[procedure] update-distribution:: H -> F64VECTOR
Sets a new mean value and estimates the new covariance matrix and a new step size for the normal search distribution. Returns the new mean value.
(use srfi-4 cmaes) ;; the objective (fitness) function to be minimized (define (fitfun x N) (let recur ((i 2) (sum (+ (* 1e4 (f64vector-ref x 0) (f64vector-ref x 0)) (* 1e4 (f64vector-ref x 1) (f64vector-ref x 1)) ))) (if (< i N) (recur (+ 1 i) (+ sum (* (f64vector-ref x i) (f64vector-ref x i)))) sum)) ) (let-values (((h funvals) (init-from-file "initials.par"))) (read-signals-from-file h "signals.par") (let recur ((h h)) (let ((stop (terminated? h))) (if (not stop) (let ((pop (sample-population h)) (lam (get-parameter h 'lambda)) (n (get-parameter h 'dim))) (let inner-recur ((i 0)) (if (< i lam) (begin (f64vector-set! funvals i (fitfun (vector-ref pop i) n)) (inner-recur (+ 1 i))))) (update-distribution h funvals) (read-signals-from-file h "signals.par") (recur h) ) (print stop) ))) (write-to-file h 'all "allcmaes.dat") (let ((xfinal (get-new h "xmean"))) (printf "xmean = ~A~%" xfinal) (terminate h) (free h) ))
About this egg
The CMA-ES C library was written by Nikolaus Hansen. The Chicken Scheme cmaes library was written by Ivan Raikov.
- Initial release
CMA-ES C library is copyright 1996, 2003, 2007 Nikolaus Hansen. Chicken Scheme bindings for CMA-ES are copyright 2012 Ivan Raikov. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.