Skip to content

Discrete Parameters

elinoreroebber edited this page Apr 25, 2024 · 3 revisions

Diver offers the ability to label one or more parameters as discrete rather than continuous, using the discrete keyword. This may be desirable because some parameter(s) are indeed discrete at some fundamental level, or simply as a means of labelling a set of individual fits that are interrelated in some way.

The main complication when working with discrete parameters is that mutation must be a floating-point operation in DE, in order to ensure that the donor vectors are valid, to allow for enough variety in potential donor vectors, and to ensure proper convergence. When treating a parameter as discrete in Diver, we deal with this by storing the values of the discrete parameter internally as floating-point values, so that mutation works as normal, but evaluation of the likelihood is done by rounding the parameter to the closest integer. The output .raw file stores the underlying floating-point representation of the parameters (to allow runs to be properly resumed), whereas the desired integer values are output in a .sam file (see Output Files).

The partitionDiscrete option can also be used to partition the DE population evenly into the allowed values of the discrete parameters. With this option, no vector is allowed to change its discrete value. This mode allows simultaneous fitting of multiple objective functions, with the discrete dimension simply treated as a label for assigning subpopulations to the different problems. One useful application of this option is to perform multi-objective optimisation where the value of each fitness function depends (preferably only weakly) on the best-fit parameters of the other subpopulations.

Relevant arguments to pass to diver() or cdiver():

  • nDiscrete (int, C/C++ only): the total number of discrete parameters. Note that this argument is only required for the C/C++ wrapper, and should not be used when calling Diver from Fortran.
  • discrete (int array): the indices of the discrete parameter, using 1-based array indexing.
  • partitionDiscrete(logical): if true, uses the discrete parameters as labels to partition the population
Clone this wiki locally