This projects proposes a programming tool written in ANSI C+ for global optimization problems. The main components of the software are: a) Coding of the objective problem in a high level language such as ANSI C++ b) Incorporation of many global optimization techniques to tackle the objective problem c)Parameterization of global optimization methods using user-defined parameters.
- A C++ compiler (GNU GCC is recommended).
- The GNU make utility
- The OpenMP programming library
- The QT programming library.
The following steps are required in order to build the tool:
- Download and install the QT programming library from https://qt.io
- Download the software from https://github.com/itsoulos/OPTIMUS.git
- Set the OPTIMUSPATH environment variable pointing at the installation directory of OPTIMUS e.g. OPTIMUSPATH=/home/user/OPTIMUS/
- Set the LD_LIBRAPY_PATH to include the OPTIMUS/lib subdirectory e.g. LD_LIBRAPY_PATH=$LD_LIBRAPY_PATH:$OPTIMUSPATH/lib/:
- Issue the command: cd $OPTIMUSPATH
- Execute the compilation script: ./compile.sh After the compilation the executable OptimusApp will be placed under bin subdirectory.
The software has the following subdirectories
- bin: After compilation of the package, it will contain the executable OptimusApp
- include: with the header files needed for compilation
- src: the subdirecotry containing the following functions
- Bfgs: the source code of the Bfgs optimization method
- De: the source code for the Differential Evolution optimization method
- DoubleGenetic: the source code of double precision genetic algorithm
- GCRS: the source code of the improved Controlled Random Search method
- IntegerGenetic: the source code of the Integer genetic algorithm
- iPso: the source code for the Improved Particle Swarm Optimization method
- MinCenter: the source code of the MinCenter global optimization method
- Minfinder: the source code of the MinFinder global optimization method
- Multistart: the source code of the Multistart global optimization method
- NeuralMinimizer: the source code of the NeuralMinimizer global optimization method
- Optimus: the base class for the implemented optimizers
- ParallelDe: the source code of the Parallel Differential Evolution method
- Tmlsl: the source code of the Topographical Multi Livel Single Linkage optimization method
- Pso: the source code of the Particle Swarm Optimization method
- lib: the directory holding the compiled optimization methods
- MANUAL: the Doxygen manual of the software
- doc: This directory contains the documentation of the package
- PROBLEMS: A directory that contains some test functions.
- compile.sh: The main compilation script.
An example for the implementation of the Rastrigin function has as follows:
extern "C" { void init(QJsonObject data) { } int getdimension() { return 2; } void getmargins(vector &x) { for(int i=0;i &x) { return (x[0]*x[0])+(x[1]*x[1])-cos(18.0*x[0])-cos(18.0*x[1]); } void granal(vector &x,vector &g) { g[0]=2.0*x[0]+18.0*sin(18.0*x[0]); g[1]=2.0*x[1]+18.0*sin(18.0*x[1]); } QJsonObject done(vector &x) { return QJsonObject(); } }
The implemented functions are:
-
void init(QJsonObject data). The function init() is called before the objective function is executed and its purpose is to pass parameters from the execution environment to the objective function.
-
int getDimension(), the dimension of the objective problem.
-
void getmargins(vector &x). The getmargins() functions returns in the vector x the bounds of the objective problem. The class Interval is a simple class located in the folder PROBLEMS of the distribution, that represents double precision intervals.
-
double funmin(vector &x). This function returns the objective problem f(x) for a given point x.
-
void granal(vector &x,vector &g). This functions stores in vector g the gradient f(x) for a given point x.
-
QJsonObject done(vector &x). This function is executed after the objective function optimization process is completed. The point x is the global minimum for the function f(x).
In order to build the objective function the user should create an accompaniment project file as shown below
TEMPLATE=lib SOURCES+=rastrigin.cc interval.cpp HEADERS += interval.h
The software incorporates the utility qmake of the QT library to compile the objective function. The compilation is performed with the following series of commands in the terminal:
-
qmake file.pro
-
make
where file.pro stands for the name of the project file. The final outcome of this compilation will be the shared library libfile.so
A full working command for the Rastrigin problem using the utility program OptimusApp is shown below
./OptimusApp --filename=librastrigin.so --opt_method=Pso --pso_particles=100 --pso_generations=10 The parameters for the above command line are as follows:
-
The argument of --filename determines the objective problem in shared library format.
-
The argument of --opt_method sets the used global optimization procedure.
-
The argument of --pso_particles sets the number of particles of the PSO optimizer.
-
The argument of --pso_generations sets the maximum number of generations allowed.
-
The argument of --localsearch_method sets the used local optimization procedure. The output of the previous command is as follows:
Generation 1 value: -1.7464048
Generation 2 value: -1.8619942
Generation 3 value: -1.8852439
Generation 4 value: -1.9490074
Generation 5 value: -1.9490074
Generation 6 value: -1.9490074
Generation 7 value: -1.9490074
Generation 8 value: -1.9775267
Generation 9 value: -1.9972928
Generation 10 value: -1.9977027
Minimum: -2.0000000000 Function calls: 1028
Full documentation at manual