---
name: "PGACrossover"
section: "3"
platform: "linux"
package: "pgapack"
version: "1.1.1-3"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/PGACrossover"
---

# PGACrossover(3)

performs crossover on two parent strings to create two child strings (via side-effect).

## NAME

PGACrossover - performs crossover on two parent strings to create two child strings (via side-effect).

## DESCRIPTION

The type of crossover performed is either the default or that specified by PGASetCrossoverType

## INPUT PARAMETERS

- ctx

  \- context variable

- p1

  \- the first parent string

- p2

  \- the second parent string

- pop1

  \- symbolic constant of the population containing string p1 and p2

- c1

  \- the first child string

- c2

  \- the second child string

- pop2

  \- symbolic constant of the population to contain string c1 and c2

## OUTPUT PARAMETERS

- none

  ## SYNOPSIS

```
#include "pgapack.h"
void  PGACrossover(ctx, p1, p2, pop1, c1, c2, pop2)
PGAContext *ctx
int p1
int p2
int pop1
int c1
int c2
int pop2
```

## LOCATION

cross.c

## EXAMPLE

```
Example:
Perform crossover on the two parent strings mom and dad in population
PGA_OLDPOP, and insert the child strings, child1 and child1, in
population PGA_NEWPOP.
PGAContext *ctx;
int mom, dad, child1, child2;
:
PGACrossover(ctx, mom, dad, PGA_OLDPOP, child1, child2, PGA_NEWPOP);
```
