---
abstract: 'The Java implementation of a portfolio of parameter-less evolutionary algorithms is presented.  The *Parameter-less Evolutionary Portfolio* implements a heuristic that performs adaptive selection of parameter-less evolutionary algorithms in accordance with performance criteria that are measured during running time.  At present time, the portfolio includes three parameter-less evolutionary algorithms: Parameter/less Univariate Marginal Distribution Algorithm, Parameter/less Extended Compact Genetic Algorithm, and Parameter/less Hierarchical Bayesian Optimization Algorithm.  Initial experiments showed that the parameter-less portfolio can solve various classes of problems without the need for any prior parameter setting technique and with an increase in computational effort that can be considered acceptable.' 
author:
- |
    [**JosŽ C. Pereira**]{}\
    CENSE and DEEI-FCT\
    Universidade do Algarve\
    Campus de Gambelas\
    8005-139 Faro, Portugal\
    unidadeimaginaria@gmail.com
- |
    [**Fernando G. Lobo**]{}\
    CENSE and DEEI-FCT\
    Universidade do Algarve\
    Campus de Gambelas\
    8005-139 Faro, Portugal\
    fernando.lobo@gmail.com
title: '**Java Implementation of a Parameter-less Evolutionary Portfolio**'
---

Introduction {#sec:intro}
============

The *Parameter-less Evolutionary Portfolio* (P-EP) implements a heuristic that performs adaptive selection of parameter-less evolutionary algorithms (P-EAs) in accordance with performance criteria that are measured during running time.  This heuristic is inspired by the parameter/less genetic algorithm (P-GA) [@HarikLobo:99] and was first proposed by [@Lobo:10a].  We direct the interested reader to these papers for a more general and detailed description of the heuristic itself. 

The main goal of this technical report is to present a Java implementation of the Parameter-less Evolutionary Portfolio (P-EPJava) whose source code is available for free download at . 

The remainder of this paper is organized as follows.  In Section \[sec:PGA\] we briefly describe the main concept of the Parameter-less Evolutionary Portfolio.  In Section \[sec:P-EAJava\] we discuss the P-EPJava implementation itself and provide detailed instructions on how to use it and how to implement new problems with it. 

The Parameter-less Evolutionary Algorithm {#sec:PGA}
=========================================

The Parameter-less Evolutionary Portfolio always includes P-EAs that can be informally, but quantifiably, ordered by their increasing “complexity”.  The more complex P-EAs should be capable of tackling more difficult problems, usually at the expense of using an increased cost in model building.  Following this order, the P-EP alternates between each algorithm on a continuous loop, giving the same amount of CPU time to all P-EAs in each iteration.  Starting with a chosen initial time, $T_0$, the allowed CPU time is updated at each loop iteration to at least match the maximum time spent in one generation by any of the P-EAs.  At the same time, because they are able to advance further in the search due to faster model building, simpler P-EAs are eliminated from the loop as soon as their current best average fitness is lower than the best average fitness of a more complex P-EA. 

The use of parameter/less algorithms allows P-EP to work as a black-box algorithm, without the need for any prior parameter settings.  Additionally, P-EP is designed to run forever, physical constraints aside, because in practice the quality of the optimal solution is often unknown for many problems, making it impossible to distinguish, for instance, when an algorithm has reached the optimum result from when it simply got “stuck” in some plateau of the search space.  Therefore, P-EP leaves to the user the decision when to stop the computation, based on the quality of the solutions already found and on the time and resources that she or he is willing to spend. 

A Java Implementation of the Parameter-less Evolutionary Portfolio {#sec:P-EAJava}
==================================================================

At present time, the Java implementation of the Parameter-less Evolutionary Portfolio (P-EPJava) includes three P-EAs: Parameter/less Univariate Marginal Distribution Algorithm (P-UMDA)[^1], Parameter/less Extended Compact Genetic Algorithm (P-ECGA) [@Lobo:00], and Parameter/less Hierarchical Bayesian Optimization Algorithm (P-HBOA) [@PelikanHartLin:07].  As presented in detail in another arXiv report from the same authors, these three P-EAs (plus the P-GA) are also implemented in Java as independent algorithms.  The source and binary files of those Java implementations are available for free download at . 

All algorithms integrated in the evolutionary portfolio must be parameter-less in the sense that they use the population sizing method employed by the Parameter-less Genetic Algorithm [@HarikLobo:99].  In addition, each P-EA must satisfy the following two constraints in order to be integrated in the P-EPJava:

1.   The algorithm represents possible solutions (individuals) as strings of zeros and ones. 

2.   All individuals have the same string size. 

How to use the P-EPJava
-----------------------

The P-EPJava is a Java application developed with the Eclipse[^2] IDE.  The available code is already compiled and can be executed using the command line. 

#### Run the P-EAJava from a command line

1.   Unzip the source file *2015ParameterlessPortfolio.zip* to any directory. 

2.   Open your favourite terminal and execute the command\

    \

    where is the name of the directory chosen in step 1. 

3.   Execute the command\

The argument “PortParameters.txt” is in fact the name of the file containing all the options concerning the portfolio settings and can be changed at will. 

After each execution of a single or multiple runs, the P-EPJava produces one output file –*PORTFOLIO\_\_.txt* – that records how each run progressed in terms of time allowed to each algorithm, which algorithms were deactivated and when, number of fitness calls performed by each algorithm, best individual and average fitnesses, the evolution of the population sizes, among other relevant information.  All this information is also displayed on the screen during execution time. 

At present time, the P-EPJava version made available with this paper already includes the following set of test problems:\
*ZERO* Problems *ONE* Problems

  ------------------- ------------------------------ -------------------- -------------------------
      0 $\rightarrow$ ZeroMax                            10 $\rightarrow$ OneMax
      1 $\rightarrow$ Zero Quadratic                     11 $\rightarrow$ Quadratic
      2 $\rightarrow$ Zero 3-Deceptive                   12 $\rightarrow$ 3-Deceptive
      3 $\rightarrow$ Zero 3-Deceptive Bipolar           13 $\rightarrow$ 3-Deceptive Bipolar
      4 $\rightarrow$ Zero 3-Deceptive Overlapping       14 $\rightarrow$ 3-Deceptive Overlapping
      5 $\rightarrow$ Zero Concatenated Trap-k           15 $\rightarrow$ Concatenated Trap-k
      6 $\rightarrow$ Zero Uniform 6-Blocks              16 $\rightarrow$ Uniform 6-Blocks
  ------------------- ------------------------------ -------------------- -------------------------

\
*Hierarchical* Problems

  -------------------- -----------------------
      21 $\rightarrow$ Hierarchical Trap One
      22 $\rightarrow$ Hierarchical Trap Two
  -------------------- -----------------------

\
The Zero problems always have the string with all zeros as their best individual.  The One problems are the same as the Zero problems but their best individual is now the string with all ones.  A description of these problems can be found, for instance, in [@PelikanPazGoldberg:2000].  The Hierarchical problems are thoroughly described in [@Pelikan:05]. 

It is also possible to define a noisy version for any of the previous problems.  This is done by adding a non-zero Gaussian noise term to the fitness function. 

The source code that implements all the problems mentioned in this section can be found in the file *src/com/z\_PORTFOLIO/Problem.java*. 

As mentioned previously, all options concerning the evolutionary portfolio are in the file *PortParameters.txt*.  In particular, it is in this file that are made the choices for the problem to be solved. 

To choose a particular problem the user must set the value of the following three options:\

  ------------- ---------------------------------------------
       Line 81: *problemType*
       Line 90: *stringSize*
      Line 107: *sigmaK*      (defines the noise component)
  ------------- ---------------------------------------------

\
All other options are set to default values and their role in the behaviour or the portfolio is explained with detail in the file’s comments.  This is also true for the parameters specific to the parameter-less strategy and to each of the implemented parameter-less algorithms which are defined in four separate files:\

  ----------------- --------------------
    PARAMETER-LESS: ParParameters.txt
              UMDA: UMDAParameters.txt
              ECGA: ECGAParameters.txt
              HBOA: HBOAParameters.txt
  ----------------- --------------------

\
Note that the default settings defined in these four files were chosen to ensure a robust behavior of the corresponding algorithms, in accordance with current theory.  Therefore, the user is advised to proceed with caution when performing any changes in those settings.  In fact, the whole idea behind the portfolio and the parameter-less strategy is to eliminate the need of such fine tuning when solving a particular problem.  After choosing a problem to be solved and a particular algorithm to solve it, the user has only to press the start button and wait until the P-EPJava finds a solution with good enough quality. 

![ The P-EPJava uses the design pattern strategy [@Gamma:95] to allow an easy implementation of new problems to be solved by the framework.[]{data-label="fig:IProblem"}](./IProblem.pdf){width="85.00000%"}

How to implement a new problem with P-EAJava
--------------------------------------------

The P-EPJava uses the design pattern strategy [@Gamma:95] to decouple the implementation of a particular problem from the remaining portfolio structure (see Figure \[fig:IProblem\]).  As a consequence, to plug in a new problem to the framework it is only necessary to define one class that implements the interface IProblem and change some input options to include the new choice.  The interface IProblem can be found in the file *src/com/z\_PORTFOLIO/Problem.java*. 

In the following let us consider that we want to solve a new problem called *NewProblem* with one of the parameter-less algorithms.  To plug in this problem it is necessary to:

1.   Define a class called *NewProblem* in the file *src/com/z\_PORTFOLIO/Problem.java*.  The signature of the class will be

    ![ image](./NewProblem.pdf){width="65.00000%"}

2.   Code the body of the function computeFitness(Individual) according to the nature of problem *newProblem*.  The class *Individual* provides all the necessary functionalities to operate with the string of zeros and ones that represents an individual (e.g., getAllele(int)).  This class can be found in the file *src/com/z\_PORTFOLIO/Individual.java*. 

3.   To define the new problem option, add the line

    ![ image](./InitializeNewProblem.pdf){width=".95\textwidth"} to the **switch** command in line 174 of the file *src/com/z\_PORTFOLIO/PortParameter.java*.  The case number – 99 – is a mere identifier of the new problem option.  The user is free to choose other value for this purpose.  The rest of the line is to be written verbatim. 

4.   Validate the new problem – option value 99 – by adding the case *problemType* == 99 to the conditional in line 111 of the same *PortParameter.java* file. 

Although not strictly necessary, it is also advisable to keep updated the problem menu in the file *PortParameters.txt*. 

Acknowledgements {#acknowledgements .unnumbered}
================

The current version of the P-EAJava is one of the by-products of the activities performed by the PhD fellow, JosŽ C. Pereira within the doctoral program entitled *Search and Optimization with Adaptive Selection of Evolutionary Algorithms*.  The work program is supported by the Portuguese Foundation for Science and Technology with the doctoral scholarship SFRH/BD/78382/2011 and with the research project PTDC/EEI-AUT/2844/2012. 

Eiben, A. E. and Smith, J. E. (2003). .  SpringerVerlag. 

Gamma, E., Helm, R., Johnson, R., and Vlissides, J. (1995). .  Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. 

Goldberg, D. E. (1989). .  Addison-Wesley, Reading, MA. 

Goldberg, D. E., Deb, K., and Thierens, D. (1993).  Toward a better understanding of mixing in genetic algorithms. ,  32(1):10–16. 

Harik, G. R. (1999).  Linkage learning via probabilistic modeling in the [ECGA]{}.  Illi[GAL]{} Report No.  99010, Illinois Genetic Algorithms Laboratory, University of Illinois at Urbana-Champaign, Urbana, IL. 

Harik, G. R. and Lobo, F. G. (1999).  A parameter-less genetic algorithm.  In Banzhaf, W. et al.,  editors, [*Proceedings of the [G]{}enetic and [E]{}volutionary [C]{}omputation [C]{}onference [GECCO]{}-99*]{}, pages 258–265, San Francisco, CA.  Morgan Kaufmann. 

Holland, J. H. (1975). .  University of Michigan Press, Ann Arbor, MI. 

Lobo, F. G. (2000). .  PhD thesis, Universidade Nova de Lisboa, Portugal.  Also Illi[GAL]{} Report No.  2000030. 

Lobo, F. G. and Lima, C. F. (2007).  Adaptive population sizing schemes in genetic algorithms.  In [*Parameter Setting in Evolutionary Algorithms*]{}, pages 185–204.  Springer. 

Lobo, F. G. and Lima, C. F. (2010).  Towards automated selection of estimation of distribution algorithms.  In Pelikan, M. and Branke, J., editors, [*ACM Genetic and Evolutionary Computation Conference (GECCO-2010), Companion Material*]{}, pages 1945–1952.  ACM. 

M[ü]{}hlenbein, H. and Paa[ß]{}, G. (1996).  From recombination of genes to the estimation of distributions [I.]{} [B]{}inary parameters.  In Voigt, H.-M. et al.,  editors, [*Parallel [P]{}roblem [S]{}olving from [N]{}ature – [PPSN]{} [IV]{}*]{}, pages 178–187, Berlin.  Kluwer Academic Publishers. 

Pelikan, M. (2005). .  Springer. 

Pelikan, M. and Goldberg, D. (2006).  Hierarchical bayesian optimization algorithm.  In Pelikan, M., Sastry, K., and CantœPaz, E., editors, [*Scalable Optimization via Probabilistic Modeling*]{}, volume 33 of [*Studies in Computational Intelligence*]{}, pages 63–90.  Springer Berlin Heidelberg. 

Pelikan, M., Goldberg, D. E., and Cant[ú]{}-Paz, E. (2000).  Linkage problem, distribution estimation, and [B]{}ayesian networks. ,  8(3):311–341. 

Pelikan, M., Hartmann, A., and Lin, T.-K. (2007).  Parameter-less hierarchical bayesian optimization algorithm.  In [*Parameter Setting in Evolutionary Algorithms*]{}, volume 54, pages 225–239.  Springer Berlin Heidelberg, Berlin. 

Pelikan, M. and Lobo, F. G. (1999).  Parameter-less genetic algorithm: [A]{} worst-case time and space complexity analysis.  IlliGAL Report No.  99014, University of Illinois at Urbana-Champaign, Illinois Genetic Algorithms Laboratory, Urbana, IL. 

Spinosa, E. and Pozo, A. (2002).  Controlling the population size in genetic programming.  In [*Proceedings of the 16th Brazilian Symposium on Artificial Intelligence: Advances in Artificial Intelligence*]{}, SBIA ’02, pages 345–354, London, UK, UK.  Springer-Verlag. 

Thierens, D. and Goldberg, D. E. (1993).  Mixing in genetic algorithms.  In Forrest, S., editor, [*Proceedings of the [F]{}ifth [I]{}nternational [C]{}onference on [G]{}enetic [A]{}lgorithms*]{}, pages 38–45, San Mateo, CA.  Morgan Kaufmann. 

[^1]: See, for example, [@Muhlenbein:96] for a description of the original, non parameter-less version of the UMDA. 

[^2]: Version: Kepler Service Release 2
