Quick Start
Prerequirements
- GCC 6.1.0 or any other C++11 feature complete compiler
- CMake 3.5
- Armadillo C++ 8.200.0
If you have already installed a newer compiler, Cmake or Armadillo, this will also work.
We have tested the software with the latest version available (last update: 12. November 2018):
- GCC 8.2.0
- CMake 3.12.3
- Armadillo C++ 9.200.4
Linux Installation
The following commands are based on Ubuntu, using apt-get. If you are using another Linux distributions, the names of each package might also differ.
If you are using any recent Linux distribution, you should already be equipped with a C++11 feature complete compiler, like GCC 6.1.0+
- Install CMake
sudo apt-get install cmake
- Install Armadillo C++ with OpenBLAS support (visit Armadillo’s download page to find more information on how to use other implementations of BLAS and LAPACK):
sudo apt-get install libblas-dev liblapack-dev libopenblas-dev
--quiet -O armadillo.tar.gz http://downloads.sourceforge.net/project/arma/armadillo-6.500.5.tar.gz
mkdir armadillo
tar -xzf armadillo.tar.gz -C ./armadillo --strip-components=1
cd armadillo
cmake .
make
sudo make install
- Download and install PASS
git clone --depth 1 --branch master https://github.com/SRAhub/PASS.git
cd PASS
cmake.
make
sudo make install
MacOS Installation
The following commands are based on Homebrew, a package manager for OS X.
- Install CMake
brew install cmake
- Install Armadillo C++ with OpenBlas support
brew install openblas
brew install armadillo
- Download and install PASS
git clone --depth 1 --branch master https://github.com/SRAhub/PASS.git
cd PASS
cmake.
make
sudo make install
Example Program
#include
int main() {
// 1. Get the problem
unsigned int number_of_dimensions = 2;
pass::ackley_function problem(number_of_dimensions);
// 2. Run the algorithm and get the outputs
pass::parallel_swarm_search alg;
auto results = alg.optimise(problem);
// 3. Print your result!
std::cout << "Fitness: " << results.fitness_value << std::endl;
std::cout << "Evaluations: " << results.evaluations << std::endl;
std::cout << "Iterations: " << results.iterations << std::endl;
std::cout << "Time: " << results.duration.count() << std::endl;
return 0;
}
If you save the above program as main.cpp, under Linux and Mac OS X it can be compiled using:
g++ main.cpp -o main -O3 -lpass