C++ library

The C++ library contains C++ implementation of Differential Evolution with Competitive Control-Parameter Settings. The differential evolution (DE) has become one of the most popular algorithms for the continuous global optimization problems in last decade years. But it is known that the efficiency of the search for the global minimum is very sensitive to the setting of its control parameters. That is why the self-adaptive DE was proposed and included into this library.

Dependiencies

The library depends on:

Development Environment

The library is tested with following environment settings:

Compiller:g++ (GCC) 3.4.5
IDE:Code::Blocks (SVN 6181)
OS:MS Windows XP, Vista, GNU Linux (Ubuntu 9.10)

Installation instructions

  1. Unzip the sago.zip archive into a directory at your harddisk. The library contains C++ source and project files (*.h, *.cpp and *.cbp).

  2. Compile The SVMT library:

    The project file libsvmtl.cbp is located in folder sago/irafm/svmtl/lib. Open it in the Code::Blocks IDE and build whole project. The resulting static library libSVMTL.a will be created in sago/lib folder.

Library Usage

In the directory sago/irafm/ea/examples are included two self-explanatory examples of the library usage:

  1. DEComp: Demonstration of minimal requirements which have to be satisfied for the library usage.
  2. ProblemSuite: Demonstration of library usage for comparison study among several algorithm settings and different optimization problems to solve. This example is good starting point for making comparison reports.

Now let’s go through the first example and after its listing describe required steps in more details.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// STL
#include <iostream>

// IRAFM
#include <ea.h>

using namespace std;
using namespace irafm;

class ExampleMember : public PopulationMember {
public:
	ExampleMember(Vector aData) : PopulationMember(aData) { }

	virtual real criteria() const {
		return rastrigin(data);
	}

};

class ExampleProblem : public Problem {
public:
	ExampleProblem() : Problem("Rastrigin function") {
		searchSpace_.addDimension(math::Interval(-500, 500));
		searchSpace_.addDimension(math::Interval(-500, 500));
		searchSpace_.addDimension(math::Interval(-500, 500));
		searchSpace_.addDimension(math::Interval(-500, 500));
		searchSpace_.addDimension(math::Interval(-500, 500));
	}

	virtual ptrPopulationMember newMember(const Vector &aData) const {
		return new ExampleMember(aData);
	}

	virtual Population initialPopulation() const {
		return randomPopulation(10 * dimension());
	}

};

int main() {
	DEAlgorithm algorithm(CompetitiveMemberGenerator::DER9());

	ptrPopulationMember result = algorithm.optimize(
			new ExampleProblem(),
			new StreamReporter(cout, rlFull)
			);

	cout << endl << "Solution: " << result->print() << endl;

	return 0;
}

Step by step

These are the required steps wich the user must follow when using this library:

  1. Include the file <irafm/ea.h>. (line 5)
  2. Define problem-specific population member which knows how to compute the objective function:
    1. Derive your own class from the irafm::PopulationMember library class (line 10)
    2. Implement its virtual method real criteria() const which is the main part where is the definition of objective function to be minimized. (lines 14 – 16)
  3. Declare problem-specific options and settings:
    1. Derive your own class from the irafm::Problem library class (line 19)
    2. In its constructor initialize the searchSpace_ by adding appropriate box constraints for each dimension. This is the way how to determine dimensionality of the problem. (lines 21 – 27)
    3. Implement virtual method ptrPopulationMember newMember(const Vector aData) const. Its only task is to create appropriate problem-specific population member from given data vector. (lines 29 – 31)
    4. Implement virtual method Population initialPopulation() const. This is a place for employing your own heuristic how to create initial population which is used as starting population of optimization process. (lines 33 – 35)
  4. Use your problem-specific classes in similar way as in presented example. (lines 39 – 47)

Source Documentation

For more implementation details see source documentation generated by Doxygen.