Function PGACreate
Defined in File create.c
Function Documentation
-
PGAContext *PGACreate(int *argc, char **argv, int datatype, int len, int maxormin)
Create an uninitialized context variable.
Description
The Fortran version of this function call contains only the last three arguments.
The
datatypemust be one ofPGA_DATATYPE_BINARY,PGA_DATATYPE_CHARACTER,PGA_DATATYPE_INTEGER,PGA_DATATYPE_REAL, orPGA_DATATYPE_USERto specify binary-valued, character-valued, integer-valued, real-valued, or a user-defined datatype, respectively. See Constants for Datatypes for the constants and types.The
maxorminparameter must be one ofPGA_MAXIMIZEorPGA_MINIMIZEfor maximization or minimization, respectively. See Constants for Optimization Direction for the constants.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
- 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
len – The string length (number of genes)
maxormin – The direction of optimization.
- Returns:
A pointer to the context variable