PGACreate(8) PGAPack PGACreate(8)NAME
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
05/01/95 PGACreate(8)
Check Out this Related Man Page
PGASetRealInitRange(2) PGAPack PGASetRealInitRange(2)NAME
PGASetRealInitRange - sets the upper and lower bounds for randomly initializing real-valued genes.
DESCRIPTION
For each gene these bounds define an interval from which the initial allele value is selected uniformly randomly. The user specifies two
arrays containing lower and bound for each gene to define the interval. This is the default strategy for initializing real-valued strings.
The default interval is $[0,1.0]$ for each gene.
INPUT PARAMETERS
ctx - context variable
min - array containing the lower bound of the interval for each gene
mac - array containing the upper bound of the interval for each gene
OUTPUT PARAMETERS
none
SYNOPSIS
#include "pgapack.h"
void PGASetRealInitRange(ctx, min, max)
PGAContext *ctx
double *min
double *max
LOCATION
real.c
EXAMPLE
Set the initialization routines to select a value for each real-valued
gene i uniformly randomly from the interval [-10.,i]
Assumes all strings are of the same length.
PGAContext *ctx;
double *low, *high;
int i, stringlen;
:
stringlen = PGAGetStringLength(ctx);
low = (double *) malloc(stringlen*sizeof(double));
high = (double *) malloc(stringlen*sizeof(double));
for(i=0;i<stringlen;i++) {
low[i] = -10.0;
high[i] = i;
}
PGASetRealInitRange(ctx, low, high);
05/01/95 PGASetRealInitRange(2)
i found this code in the book but was unable to execute it.
/*myecho -- echo command line arguments */
main(int argc, char **argv)
{
while(--argc > 0)
printf("%s ", *++argv);
printf("\n");
}
this is another program that would invoke the one above
char * const argin =... (5 Replies)
what is the system call for moving directory?
i tried
main(int argc, char * argv){
if(link(argv, destinationDir)==-1){
perror("link failed");
//argv is the name of the directory i want to move input from command promt.
it displayed the link failed message.
thanks (1 Reply)
I searched on the forums. No advises.
I am using a previous source code. I changed the main function main(int argc, char **argv) in a function misc(int argc, char **argv). How do you use the argc and argv parameters? This is how I am calling the function :
char param;
strcat(param,"wgrib ");... (4 Replies)
Hi
How to pass multi line text as a command line argument to a program.
(i.e)
./a.out hi this is sample 0 file1
where
hi this is sample should be stored in argv
0 in argv and so on... (3 Replies)
In my program, I'm using argc and argv to accept command line arguments. However, if I have to get the '&' to work i.e. make it run the child as a background process, do I have to write some special code in C or does Unix handle it automatically? If I have to add the special code, how does it look... (2 Replies)
Hello Freinds
I have just started off with Unix (TCSH) although I have a pretty sound background with C-programming. Kindly convey any error in foll script.
#include<stdio.h>
#include<math.h>
#define PI 3.142857
main ()
{
float r, A;
printf("Enter the value of radius: ");
scanf(" %f... (12 Replies)
Hi C experts,
I have the following code for adding command line option for a program
int main (argc, argv)
int argc;
char *argv;
{
char *mem_type; //memory type
char *name; //name of the memory
int addr; //address bits
int data; ... (5 Replies)
I have the following program:
int main(int argc, char** argv){
unsigned long int mean=0;
for(int i=1;i<10;i++){
mean+=poisson(12);
cout<<mean<<endl;
}
cout<<"Sum of poisson: "<< mean;
return 0;
}
when I run it, I get the... (4 Replies)
I am trying to play and create processes and found this piece of code....
int myMain(int argc , char* argv){
childID = 0;
for (j=1;j<3;j++)
if (childID = fork())
break;
fprintf(stderr, " process ID:%d parent ID:%d child ID:%d\n", getpid(), getppid(), childID);
return... (3 Replies)
#include <stdio.h>
int main(int argc, char *argv) {
printf("%d\n", sizeof(argv));
return 0;
}
when I run the executable a.out after compiling the above program as:
a.out short (or) a.out "long double", I expected to get the output as 2 and 12, but I am always getting the size of... (2 Replies)
Hi All,
I am new to unix but have a requirement wherein I need to separate datatype,length, and column name from input file which is of below format --
record
integer(10) empid;
string(25) name;
date("YYYY-MM-DD") dob;
decimal(10) salary;
end
now after getting datatype,its length and... (4 Replies)
All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address).
I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
First, create a "hello world" program that prints "Hello World". But NOW, instead use argc to verify that a... (9 Replies)
Hello guys, i have this code:
int main(int argc, char *argv) {
int i, j, N, result = 0, **vec;
if (argc < 2) {
fprintf(stderr, "Usage: %s N\n", argv);
}
/* ... how many numbers to read */
N = atoi(argv);
/* check if N is a power of two; exit if not */
if (!... (3 Replies)