PGASetRealInitPercent(2)

PGASetRealInitPercent2

Sets the upper and lower bounds for randomly initializing real-valued genes.

Usage

#include "pgapack.h"
void  PGASetRealInitPercent(ctx, median, percent)
PGAContext *ctx
double *median
double *percent

Overview

For each gene these bounds define an interval from which the initial allele value is selected uniformly randomly. With this routine the user specifies a median value and a percent offset for each allele.

Input parameters

ctx

- context variable

median

- an array containing the mean value of the interval

percent

- an array containing the percent offset to add and subtract to the median to define the interval

Output parameters

none

Location

real.c

Examples

Set the initialization routines to select a value for each real-valued
gene i uniformly randomly from the interval [i-v,i+v], where $v = i/2$.
Assumes all strings are the same length.
PGAContext *ctx;
double *median, *percent;
int i, stringlen;
:
stringlen = PGAGetStringLength(ctx);
median  = (double *) malloc(stringlen*sizeof(double));
percent = (double *) malloc(stringlen*sizeof(double));
for(i=0;i<stringlen;i++) {
median[i]  = (double) i;
percent[i] = 0.5;
}
PGASetRealInitPercent(ctx, median, percent);

Releases

Unchanged in 4 releases since Debian 5.0 (Lenny).

  1. 5.0–8

From pgapack 1.1.1-3 in Debian 8 (Jessie). Parsed by carta from the page's man source.