{"id":19872445,"url":"https://github.com/davidace/emc-lib","last_synced_at":"2026-06-06T13:31:51.927Z","repository":{"id":97018960,"uuid":"67242463","full_name":"DavidAce/EMC-Lib","owner":"DavidAce","description":"Library for minimization using Evolutionary Monte Carlo (EMC)","archived":false,"fork":false,"pushed_at":"2017-10-29T21:04:34.000Z","size":1478,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"OpenMP","last_synced_at":"2025-01-11T16:39:36.799Z","etag":null,"topics":["evolutionary-algorithms","genetic-algorithm","minimization","monte-carlo","mpi"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidAce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-02T17:35:59.000Z","updated_at":"2018-10-23T11:31:59.000Z","dependencies_parsed_at":"2023-03-22T03:18:32.119Z","dependency_job_id":null,"html_url":"https://github.com/DavidAce/EMC-Lib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2FEMC-Lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2FEMC-Lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2FEMC-Lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidAce%2FEMC-Lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidAce","download_url":"https://codeload.github.com/DavidAce/EMC-Lib/tar.gz/refs/heads/OpenMP","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241298649,"owners_count":19940471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["evolutionary-algorithms","genetic-algorithm","minimization","monte-carlo","mpi"],"created_at":"2024-11-12T16:15:38.793Z","updated_at":"2026-06-06T13:31:51.922Z","avatar_url":"https://github.com/DavidAce.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Evolutionary Monte Carlo  (beta)\nThis program finds the global minimum in a general parameter\nspace by combining Genetic algorithms and Monte Carlo \nalgorithms. \n\nReferences:\n\n[On learning strategies for evolutionary Monte Carlo](http://www.people.fas.harvard.edu/~junliu/TechRept/07folder/Goswami%26Liu07.pdf)\n\n[Evolutionary Monte Carlo for protein folding simulations](http://users.phhp.ufl.edu/faliang/papers/2001/JCP2D.pdf)\n\n[Real-parameter evolutionary Monte Carlo with applications to Bayesian mixture models](http://users.phhp.ufl.edu/faliang/papers/2001/RealEMC.pdf)\n\n\nThe program minimizes problems of any dimension and in general performs well despite rough energy landscapes. Problems 1-3 dimensions usually\ntake under 1 second while 3-6 dimensions may take tens of seconds. Around 10 dimensions takes roughly a minute.\n\n---\n## Quick Start\n\n#### From command line\nTo build project run `build.sh`.\n\nTo launch program run `run.sh`.\n\n#### From IDE\nSome IDE's with CMake support can self-configure from the file CMakeLists.txt found in the project root folder. This\nis by far the easiest approach. Recommended: [CLion](https://www.jetbrains.com/clion/download) or [Visual Studio Code](https://code.visualstudio.com/) with C++ and CMake Tools extensions.\n\n\n#### Requirements\n Please install the following software before building the project.\n * C++ compiler with support for c++14 standard and OpenMP (tested with GNU GCC version \u003e= 5.2).\n * CMake (tested with version \u003e= 3.7).\n\n \n The package manager [Hunter](https://github.com/ruslo/hunter) is included to ease the building process.\n During the first build, the dependencies listed in CMakeLists.txt will be downloaded and installed by\n [Hunter](https://github.com/ruslo/hunter) automatically on any platform (Linux/OSX/Win).\n \n The following software is installed by [Hunter](https://github.com/ruslo/hunter):   \n * [Eigen](http://eigen.tuxfamily.org) for linear algebra calculations. \n\n The default installation folder in Linux is `~/.hunter`.\n\n---\n\n      \n## Usage\nSee the example_main.cpp file for syntax details. In principle it is enough to include \nthe header `source/EMC.h` from your own project to gain access to the class object `objective_function`\nwhich has to be initialized and then passed to the function `minimize()`. The constructor of class object `objective_function`\ntakes arguments:\n\n        objective_function obj_fun(my_function, lower_bound, upper_bound, tolerance, aux_data1, aux_data2   ... aux_dataN);\n \nwhere `lower_bound` and `upper_bound` are Eigen arrays of type `Eigen::ArrayXd(n)`, where n is the number of parameters you wish to minimize, i.e.,\none lower and upper boundary per parameter. The argument `tolerance` has type `double` and tells the program when\nto finish: a small value (say 1e-16) takes longer than a large value (`say 1e-8`) but gives better accuracy. You can\nprovide as many `aux_data` objects as you wish as long as they are of type `Eigen::ArrayXd` or `Eigen::ArrayXXd`. These\ncan be used to actually compute your minimizing function and are available as members of the `objective_function` class, like `obj_fun.aux[0]`, `obj_fun.aux[1]`... `obj_fun.aux[N]`.\n\nLastly, `my_function` is a pointer to a function of return type `long double`, declared as:\n\n        long double my_function(objective_function \u0026obj_fun, Eigen::Array\u003clong double, Dynamic, 1\u003e \u0026inputParameters);\n\nIn its definition, you will have to write a function body that maps `inputParameters` (and optionally `obj_fun.aux[]`) into\na real scalar value like an \"Fitness\" (or \"Energy\") that you wish to minimize.\n        \n\n### The Example program\nIf you compile and run the program *as is*, it will try to find\nthe minimum of the paraboloid `f(x,y) = sqrt(x^2 + y^2)` with solution `(0,0)`. \n\n\n## Constants\nSee the file `constants.hpp`. In particular, set the following\nvariables to your liking: \n\n`int M` sets the number of parallel subpopulations. Preferrably this\nnumber should be the same as the number cpu-threads available for OpenMP.\n(Usually 4 to 8, depending on your cpu).\n\n\n`int max_generations` controls the maximum duration\nof the simulation (default `50000`). \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidace%2Femc-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidace%2Femc-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidace%2Femc-lib/lists"}