1 Star 0 Fork 0

繁依Fanyi / c-cmaes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

c-cmaes

CMA-ES written in ANSI C in a fairly object-oriented style.

For the general purpose of this software see doc.txt or here, for more documentation on this library see docfunctions.txt, for how to start see below.


Files in this Repository

  • README.md : this file
  • LICENSE : users agreement (no worries)
  • doc.txt : describes general purpose and an application issue
  • docfunctions.txt : Documentation of the library functions.
  • cmaes_interface.h : User interface header.
  • example_short.c : Very short example source code. The purpose of the example codes is to be edited/extended.
  • example_restarts.c : implements additional restarts with increasing population size (Auger & Hansen 2005).
  • example_boundary.c : combination with boundary handling (box constraints)
  • example_noise.c : (future versions) implements an additional uncertainty handling (Hansen et al 2009).
  • cmaes.h : Header, e.g. declaration of struct cmaes_t.
  • cmaes.c : Source code.
  • cmaes_initials.par : Parameters to be read by the cmaes, e.g. problem dimension, initial search point and initial standard deviation. This file should be edited.
  • cmaes_signals.par : File for controlling the running program. Printing or writing to a file/console can be set on/off while the program is running. Regular termination can be forced. On delivery the writing is in accordance with the plotting using:
  • plotcmaesdat.m : Plots default output files in Matlab or Octave.
  • plotcmaesdat.sci : Plots default output files in Scilab.
  • boundary_transformation.c : implements a boundary transformation
  • boundary_transformation.h : header file.

Files You May Need to Edit

  • example_*.c: Plug in the objective function (pointer) that should be minimized.
  • cmaes_initials.par: Parameter file for changing e.g. initial values and stopping criteria without recompiling.
  • cmaes_signals.par: File to control termination and output during runtime.

Output files written by cmaes_t

  • actparcmaes.par : Parameters as actually used by the program. The actual parameter setting is appended to the file after each start of the cmaes.
  • errcmaes.err : Error messages.

HOW TO START

  1. get code via git ... or download button

A1) Take five minutes to look at file example_short.c.

A2) You might have a glance at the documentation provided in file docfunctions.txt.

A3) You might have a glance at cmaes_initials.par, where input parameters are defined.

B1) Compile and run the example program. Compilation e.g. with the GNU c-compiler in the src folder:

gcc -Wall -o evo cmaes.c example_short.c -lm

and run with evo or ./evo. Take a look at the output.

B2a) (optional but highly recommended: plotting) Invoke Scilab (freely available for Linux/Windows/Mac) or Matlab/Octave, change to the working directory and type (Scilab) getf('plotcmaesdat.sci'); plotcmaesdat; or (Matlab/Octave) plotcmaesdat; You need to have the file plotcmaesdat.sci or .m and the output data files in the working directory. You get a nice plot of the executed run. The same works with cma.py via python cma.py plot

B2b) (optional) Change (increase) problem dimension and/or problem number in file initials.par and re-run.

B2c) (optional) Change problem dimension in initials.par to 300 and change output verbosity via file signals.par while the program is running: change e.g. "print fewinfo 200" into "print fewinfo -200" and back. Read comments.

B2d) Change back problem dimension.

  1. Now you are ready to inspect and edit example_restarts.c or example_boundary.c to plug in the function you want to optimize. Refer to doc.txt and see here for a practical issue on objective function design. Refer to docfunctions.txt to find more documentation about the functions in this package.

  2. Check "obligatory settings" part in initials.par regarding your function. Make sure that the scale of all objective parameter components of the function is somewhat similar and sigma corresponds to about 1/4 of the respective search intervals.

  3. output files are overwritten with each program call.

Questions? go here or send an email to hansen at lri dot fr.

See also:

Author and copyright: Nikolaus Hansen, 2014 This library is free/open software and may be used under any of the following licenses: Apache License 2.0: Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License GNU Lesser General Public License 2.1 or later: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version (see http://www.gnu.org/copyleft/lesser.html). This library 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 Lesser General Public License for details.

简介

CMA-ES written in ANSI C (yet fairly object-oriented) 展开 收起
C 等 4 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Twilight-Fanyi/c-cmaes.git
git@gitee.com:Twilight-Fanyi/c-cmaes.git
Twilight-Fanyi
c-cmaes
c-cmaes
master

搜索帮助