# About ROSA (in french "**R**echerche **O**pérationnelle grâce aux **S**quelettes **A**lgorithmiques", i.e. [Operational Research](https://en.wikipedia.org/wiki/Operations_research) with [Algorithmic Skeletons](https://en.wikipedia.org/wiki/Algorithmic_skeleton)). It relies on [alsk](https://phd.pereda.fr/dev/alsk) for the algorithmic skeletons. This is part of the work done for my Ph.D. thesis. ## Brief The main algorithm implemented and presented is GRASP×ELS. This metaheuristic can be represented as below:
When implemented as an algorithmic skeleton, its representation becomes this tree:
Obtained using the following source code. For the internal ELS: ```cpp template using SkelElsStruct = S, InnerSelect // Sel3 >, OuterSelect // Sel2 > >; template using SkelElsLinks = L(Solution const&), Solution(P<0>), L const&), L(P<0>), Solution(P<0>, RNG&), Solution(R<0> const&) >, Solution(Solution const&, Solution const&) >, Solution(Solution const&, Solution const&) > >; template< typename Solution, typename InitLS, typename Mutate, typename LS, typename InnerSelect, typename OuterSelect > using SkelEls = BuildSkeleton::skeleton< Pack, Pack >; ``` For the GRASP: ```cpp template using SkelGraspStructure = S, Select // Sel1 >; template using SkelGraspLinks = L(P<0>), Solution(P<0>, RNG), Solution(R<0>) >, Solution(Solution, Solution) >; template using SkelGrasp = BuildSkeleton::skeleton< Pack, Pack >; ``` Then the GRASP×ELS can be constructed: ```cpp // All arguments are defined types or functions, see full source code using ELS = SkelEls< tsp::Solution, Descent, Move2Opt, Descent, FN(selectMin) >; using GRASPxELS = SkelGrasp< tsp::Problem, tsp::Solution, RGreedy, ELS, FN(selectMin) >; ``` ## Performances The measures shown below are from using the GRASPxELS algorithm to solve an instance of [TSP](https://en.wikipedia.org/wiki/Travelling_salesman_problem) with 194 nodes. Various execution policies are used:
  • "hw_seq": handwritten sequential implementation;
  • "hw_par": handwritten parallel implementation;
  • "sk_seq": skeleton without parallelisation;
  • "sk_firstlevel": skeleton with parallelisation of the first level;
  • "sk_staticpool": skeleton with parallelisation using a thread pool with static task distribution;
  • "sk_dynamicpool": skeleton with parallelisation using a classical thread pool with dynamic task distribution;
  • "sk_thread": skeleton with parallelisation using dynamically created threads.
For an execution with only one allotted core, meaning that there is no parallelisation done, we obtain the data below. Note that this data set do not use the legend shown above. All subsequent images use it.
For parallel executions, measures give the following data. With 24 iterations for the outmost parallel loop:
With only 4 iterations for the outmost parallel loop:
## Related publications - "Repeatability with Random Numbers Using Algorithmic Skeletons", ESM 2020 (https://hal.archives-ouvertes.fr/hal-02980472); - "Modeling Algorithmic Skeletons for Automatic Parallelization Using Template Metaprogramming", HPCS 2019 (IEEE) [10.1109/HPCS48598.2019.9188128](https://doi.org/10.1109/HPCS48598.2019.9188128); - "Processing Algorithmic Skeletons at Compile-Time", ROADEF 2020 (https://hal.archives-ouvertes.fr/hal-02573660); - "Algorithmic Skeletons Using Template Metaprogramming", ICAST 2019; - "Parallel Algorithmic Skeletons for Metaheuristics", ROADEF 2019 (https://hal.archives-ouvertes.fr/hal-02059533). ## Organisation Main directories: - `src`: sources; - `src/rosa`: the library sources; - `rtbenchmarks`: scripts for compile-time/run-time benchmarking; - `results`: results presented in the thesis, obtained using mentioned scripts and codes. ## Usage To produce the `Makefile` and build the project: ```bash mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. make ```