PGACreate - creates an uninitialized context variable. The Fortran version
of this function call contains only the last three arguments
INPUT PARAMETERS
argc
- address of the count of the number of command line arguments.
argv
- array of command line arguments.
datatype
- the data type used for the strings. Must be one of
PGA_DATATYPE_BINARY, PGA_DATATYPE_CHARACTER,
PGA_DATATYPE_INTEGER, PGA_DATATYPE_REAL, or PGA_DATATYPE_USER
binary
-valued, character-valued, integer-valued,
real
-valued, or a user-defined datatype, respectively.
len
- the string length (number of genes).
maxormin
- the direction of optimization. Must be one of PGA_MAXIMIZE or
PGA_MINIMIZE for maximization or minimization, respectively.
OUTPUT PARAMETERS
none
SYNOPSIS
#include "pgapack.h"
PGAContext * PGACreate(argc, argv, datatype, len, maxormin)
int *argc
char **argv
int datatype
int len
int maxormin
LOCATION
create.c
EXAMPLE
Example:
In C:
void main(int argc, char **argv) {
PGAContext *ctx;
:
ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
:
// Set options here
:
PGASetUp(ctx);
:
// Run the GA here
:
PGADestroy(ctx);
}
In FORTRAN:
integer ctx
:
ctx = PGACreate(PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE)
:
c Set options here
:
call PGASetUp(ctx)
:
c Run the GA here
:
call PGADestroy(ctx)
stop
end