Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
fbe0047
vbadsa
jacobdenobel May 23, 2025
e0c3b85
asa
jacobdenobel May 23, 2025
cf9a9aa
fix criteria
jacobdenobel May 29, 2025
6a8c70d
timing
jacobdenobel May 29, 2025
242285f
timing
jacobdenobel May 29, 2025
9809c40
cholesky decomp
jacobdenobel May 29, 2025
e4a7c45
update eigen add fcmaea
jacobdenobel May 30, 2025
579ea6d
extra tests
jacobdenobel May 30, 2025
f6261f0
Merge branch 'cholesky' of https://github.com/IOHprofiler/ModularCMAE…
jacobdenobel May 30, 2025
2c184e7
remove uneeded
jacobdenobel May 30, 2025
424d440
what
jacobdenobel May 30, 2025
60108af
working cholesky cma-es
jacobdenobel May 30, 2025
a41bc59
fixed seperable
jacobdenobel May 31, 2025
9dfe832
active for cholesky
jacobdenobel May 31, 2025
3f9f805
fixed other matrix adap, move all weights to weights
jacobdenobel Jun 1, 2025
ca78b70
faster rannk update for cholesky
jacobdenobel Jun 1, 2025
8d4df93
started on CSMA
jacobdenobel Jun 1, 2025
cc4efd1
added CSMA
jacobdenobel Jun 2, 2025
729dbb8
added eigen unsupported, added natural gradient
jacobdenobel Jun 2, 2025
7a37a30
made weights also work for mu > 0.5 lambda
jacobdenobel Jun 2, 2025
475d510
dont rely on weird back transformations
jacobdenobel Jun 2, 2025
fc7e7bb
fix inversion for natural grad
jacobdenobel Jun 2, 2025
f65e93a
update
jacobdenobel Jun 3, 2025
e52b788
change back to fast MA-ES
jacobdenobel Jun 3, 2025
75c6277
natural es inverse
jacobdenobel Jun 3, 2025
4a796bf
asda
jacobdenobel Jun 3, 2025
a27b929
cleanup
jacobdenobel Jun 3, 2025
1ac0467
working python binding
jacobdenobel Jun 3, 2025
35b876c
change default numeric type back to double
jacobdenobel Jun 4, 2025
6df659a
fix stagnation criteria
jacobdenobel Jun 4, 2025
2768c67
add reason
jacobdenobel Jun 4, 2025
4e3f008
remove debug
jacobdenobel Jun 4, 2025
402f6ad
add message if verbose
jacobdenobel Jun 4, 2025
499083b
fix SA with elitist ->use RCMSA adaptation
jacobdenobel Jun 4, 2025
aa14504
fix cotn
jacobdenobel Jun 5, 2025
cee523c
rename half_power_lambda
jacobdenobel Jun 5, 2025
8e55ef8
fix COTN, fix box muller, add active to xNES
jacobdenobel Jun 5, 2025
35d354e
fixed repelling
jacobdenobel Jun 5, 2025
35443e0
increase shrinkage add criteria too much repelling, fix interface
jacobdenobel Jun 5, 2025
788f7be
fix interface
jacobdenobel Jun 5, 2025
f110e81
remove one plus one, allow for all methods
jacobdenobel Jun 5, 2025
ba2d525
Merge branch 'cholesky' of https://github.com/IOHprofiler/ModularCMAE…
jacobdenobel Jun 5, 2025
19accba
update interface
jacobdenobel Jun 5, 2025
9a77053
fix 1+1 for matrix and natural ES
jacobdenobel Jun 5, 2025
72fe6ce
avoid back calculation when not needed
jacobdenobel Jun 5, 2025
4d619e8
make learning rates setup better
jacobdenobel Jun 5, 2025
b39f81d
init one plus
jacobdenobel Jun 6, 2025
e8e120f
update
jacobdenobel Jun 10, 2025
6d539b5
fix rsma
jacobdenobel Jun 11, 2025
69ea6fc
added scripts
jacobdenobel Jun 11, 2025
47f0da5
update script
jacobdenobel Jun 11, 2025
f6c3fe7
correct CMSA init
jacobdenobel Jun 11, 2025
f73cd95
weights
jacobdenobel Jun 12, 2025
0209a01
change cmu, fix negative weights, add parameter acov
jacobdenobel Jun 12, 2025
b2f0156
update criteria
jacobdenobel Jun 12, 2025
4bc1066
update weights calc
jacobdenobel Jun 12, 2025
ad153c9
update cs
jacobdenobel Jun 12, 2025
cc9d160
correct setting
jacobdenobel Jun 12, 2025
1e1b572
floor ratio
jacobdenobel Jun 12, 2025
139dfb8
get data scipt
jacobdenobel Jun 12, 2025
1ba43da
update __main__
jacobdenobel Jun 13, 2025
99806ae
add plot
jacobdenobel Jun 13, 2025
1ff8a28
fixed f13
jacobdenobel Jun 13, 2025
a898ecd
use all samples
jacobdenobel Jun 13, 2025
facca2a
fix unit test
jacobdenobel Jun 13, 2025
38806a1
rename seperable>separable
jacobdenobel Jun 13, 2025
ee75229
rename seperable>separable
jacobdenobel Jun 13, 2025
5965eeb
rename, move adapt_ps to base
jacobdenobel Jun 17, 2025
c5a817b
asdsa
jacobdenobel Jun 17, 2025
da09496
fix typo in interface
jacobdenobel Jun 17, 2025
92de7f3
set box muller false
jacobdenobel Jun 18, 2025
2cbbd2e
revert to old active
jacobdenobel Jun 22, 2025
2916592
merge
jacobdenobel Jun 22, 2025
ed09649
experimetns
jacobdenobel Jun 22, 2025
47d8a9c
fix merge
jacobdenobel Sep 2, 2025
7cb6a73
only print if verbose
jacobdenobel Sep 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ project(modcma)

# Set the version of C/C++ (here C++17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp)
list(FILTER SRC_FILES EXCLUDE REGEX ".*interface.cpp$")

add_executable(main ${SRC_FILES})

#add_subdirectory(${PROJECT_SOURCE_DIR}/../IOHexperimenter ${CMAKE_CURRENT_BINARY_DIR}/ioh)
add_executable(main ${SRC_FILES})

target_include_directories(main PUBLIC
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/external
# ${PROJECT_SOURCE_DIR}/../IOHexperimenter/include
)

#target_link_libraries(main PUBLIC ioh)

if (MSVC)
target_compile_options(main PRIVATE /bigobj)
endif()

else()
target_compile_options(main PRIVATE -march=native)
endif()

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ The CMA-ES Modular package provides various modules, grouped into 13 categories.
| -------- | ------ | ------ | ---- |
| [Matrix Adaptation](#matrix-adaptation) | Covariance | :green_circle: | :green_circle: |
| | Matrix | :red_circle: | :green_circle: |
| | Seperable | :red_circle: | :green_circle: |
| | Separable | :red_circle: | :green_circle: |
| | None | :red_circle: | :green_circle: |
| [Active Update](#active-update) | Off/On | :green_circle: | :green_circle: |
| [Elitism](#elitism) | Off/On | :green_circle: | :green_circle: |
Expand Down Expand Up @@ -256,7 +256,12 @@ modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.MATRIX
# We can also only perform step-size-adaptation
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.NONE
# Or use the seperable CMA-ES
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.SEPERABLE
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.SEPARABLE
# Other variants:
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.CHOLESKY
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.CMSA
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.COVARIANCE_NO_EIGV
modules.matrix_adaptation = c_maes.options.MatrixAdaptationType.NATURAL_GRADIENT
```

### Active Update <a name="active-update"></a>
Expand Down
1 change: 1 addition & 0 deletions external/Eigen/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.4.0
11 changes: 11 additions & 0 deletions external/unsupported/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
add_subdirectory(Eigen)
if(EIGEN_BUILD_DOC)
add_subdirectory(doc EXCLUDE_FROM_ALL)
endif()
if(BUILD_TESTING)
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
else()
add_subdirectory(test EXCLUDE_FROM_ALL)
endif()
endif()
159 changes: 159 additions & 0 deletions external/unsupported/Eigen/AdolcForward
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_ADLOC_FORWARD
#define EIGEN_ADLOC_FORWARD

//--------------------------------------------------------------------------------
//
// This file provides support for adolc's adouble type in forward mode.
// ADOL-C is a C++ automatic differentiation library,
// see https://projects.coin-or.org/ADOL-C for more information.
//
// Note that the maximal number of directions is controlled by
// the preprocessor token NUMBER_DIRECTIONS. The default is 2.
//
//--------------------------------------------------------------------------------

#define ADOLC_TAPELESS
#ifndef NUMBER_DIRECTIONS
# define NUMBER_DIRECTIONS 2
#endif
#include <adolc/adtl.h>

// adolc defines some very stupid macros:
#if defined(malloc)
# undef malloc
#endif

#if defined(calloc)
# undef calloc
#endif

#if defined(realloc)
# undef realloc
#endif

#include "../../Eigen/Core"

namespace Eigen {

/**
* \defgroup AdolcForward_Module Adolc forward module
* This module provides support for adolc's adouble type in forward mode.
* ADOL-C is a C++ automatic differentiation library,
* see https://projects.coin-or.org/ADOL-C for more information.
* It mainly consists in:
* - a struct Eigen::NumTraits<adtl::adouble> specialization
* - overloads of internal::* math function for adtl::adouble type.
*
* Note that the maximal number of directions is controlled by
* the preprocessor token NUMBER_DIRECTIONS. The default is 2.
*
* \code
* #include <unsupported/Eigen/AdolcSupport>
* \endcode
*/
//@{

} // namespace Eigen

// Eigen's require a few additional functions which must be defined in the same namespace
// than the custom scalar type own namespace
namespace adtl {

inline const adouble& conj(const adouble& x) { return x; }
inline const adouble& real(const adouble& x) { return x; }
inline adouble imag(const adouble&) { return 0.; }
inline adouble abs(const adouble& x) { return fabs(x); }
inline adouble abs2(const adouble& x) { return x*x; }

inline bool (isinf)(const adouble& x) { return (Eigen::numext::isinf)(x.getValue()); }
inline bool (isnan)(const adouble& x) { return (Eigen::numext::isnan)(x.getValue()); }

}

namespace Eigen {

template<> struct NumTraits<adtl::adouble>
: NumTraits<double>
{
typedef adtl::adouble Real;
typedef adtl::adouble NonInteger;
typedef adtl::adouble Nested;
enum {
IsComplex = 0,
IsInteger = 0,
IsSigned = 1,
RequireInitialization = 1,
ReadCost = 1,
AddCost = 1,
MulCost = 1
};
};

template<typename Functor> class AdolcForwardJacobian : public Functor
{
typedef adtl::adouble ActiveScalar;
public:

AdolcForwardJacobian() : Functor() {}
AdolcForwardJacobian(const Functor& f) : Functor(f) {}

// forward constructors
template<typename T0>
AdolcForwardJacobian(const T0& a0) : Functor(a0) {}
template<typename T0, typename T1>
AdolcForwardJacobian(const T0& a0, const T1& a1) : Functor(a0, a1) {}
template<typename T0, typename T1, typename T2>
AdolcForwardJacobian(const T0& a0, const T1& a1, const T1& a2) : Functor(a0, a1, a2) {}

typedef typename Functor::InputType InputType;
typedef typename Functor::ValueType ValueType;
typedef typename Functor::JacobianType JacobianType;

typedef Matrix<ActiveScalar, InputType::SizeAtCompileTime, 1> ActiveInput;
typedef Matrix<ActiveScalar, ValueType::SizeAtCompileTime, 1> ActiveValue;

void operator() (const InputType& x, ValueType* v, JacobianType* _jac) const
{
eigen_assert(v!=0);
if (!_jac)
{
Functor::operator()(x, v);
return;
}

JacobianType& jac = *_jac;

ActiveInput ax = x.template cast<ActiveScalar>();
ActiveValue av(jac.rows());

for (int j=0; j<jac.cols(); j++)
for (int i=0; i<jac.cols(); i++)
ax[i].setADValue(j, i==j ? 1 : 0);

Functor::operator()(ax, &av);

for (int i=0; i<jac.rows(); i++)
{
(*v)[i] = av[i].getValue();
for (int j=0; j<jac.cols(); j++)
jac.coeffRef(i,j) = av[i].getADValue(j);
}
}
protected:

};

//@}

}

#endif // EIGEN_ADLOC_FORWARD
Loading