Index: trunk/packages/optimizer/src/pgapack/pgapack/include/pgapack.h
===================================================================
--- trunk/packages/optimizer/src/pgapack/pgapack/include/pgapack.h	(revision 1178)
+++ trunk/packages/optimizer/src/pgapack/pgapack/include/pgapack.h	(revision 1202)
@@ -144,4 +144,5 @@
 #define PGA_CROSSOVER_TWOPT     2    /* Two point crossover                */
 #define PGA_CROSSOVER_UNIFORM   3    /* Uniform   crossover                */
+#define PGA_CROSSOVER_SBX		4    /* Simulated Binary crossover		   */
 
 /*****************************************
@@ -278,4 +279,5 @@
     double FitnessCmaxValue; /* Cmax value used to convert minimizations  */
     double restartAlleleProb;/* prob of changing an allele in a restart   */
+    double randreplprop;     /* proportion of randomly generated individuals per generation post initialization*/
     int restart;             /* whether to use the restart operator       */
     int restartFreq;         /* frequency with which to restart           */
@@ -715,4 +717,6 @@
 int PGAGetRandomSeed(PGAContext *ctx);
 void PGASetRandomSeed(PGAContext *ctx, int seed);
+double PGAGetRandReplProp(PGAContext *ctx);
+void PGASetRandReplProp(PGAContext *ctx, double randreplprop);
 
 /*****************************************
Index: trunk/packages/optimizer/src/pgapack/pgapack/source/cross.c
===================================================================
--- trunk/packages/optimizer/src/pgapack/pgapack/source/cross.c	(revision 1178)
+++ trunk/packages/optimizer/src/pgapack/pgapack/source/cross.c	(revision 1202)
@@ -266,4 +266,5 @@
         case PGA_CROSSOVER_TWOPT:
         case PGA_CROSSOVER_UNIFORM:
+        case PGA_CROSSOVER_SBX:
             ctx->ga.CrossoverType = crossover_type;
             break;
Index: trunk/packages/optimizer/src/pgapack/pgapack/source/duplcate.c
===================================================================
--- trunk/packages/optimizer/src/pgapack/pgapack/source/duplcate.c	(revision 1178)
+++ trunk/packages/optimizer/src/pgapack/pgapack/source/duplcate.c	(revision 1202)
@@ -198,16 +198,19 @@
                    PGA_DOUBLE, (void *) &mr );
 
-    while (( changed == PGA_FALSE ) && (mr <= 1.0)) {
-	if (ctx->fops.Mutation) {
-	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
-            nflips = (*ctx->fops.Mutation)(&ctx, &fp, &pop, &mr);
-	} else {
-	    nflips = (*ctx->cops.Mutation)( ctx, p, pop, mr );
-	}
-
-        if ( nflips > 0 )
-            changed = PGA_TRUE;
-        else
-            mr = 1.1*mr;
+/**TODO: GTG (Clear)I dont see why we need to wait for iterations to mutate?****/
+/**TODO: can't we directly set mr = 1??**/
+    while (changed == PGA_FALSE) {
+		if (ctx->fops.Mutation) {
+		    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+	            nflips = (*ctx->fops.Mutation)(&ctx, &fp, &pop, &mr);
+		} else {
+		    	nflips = (*ctx->cops.Mutation)( ctx, p, pop, mr );
+		}
+	
+	        if ( nflips > 0 )
+	            changed = PGA_TRUE;
+	        else
+	            mr = ( mr>1 ? 1 :1.1*mr);
+	            
     }
 
Index: trunk/packages/optimizer/src/pgapack/pgapack/source/parallel.c
===================================================================
--- trunk/packages/optimizer/src/pgapack/pgapack/source/parallel.c	(revision 1178)
+++ trunk/packages/optimizer/src/pgapack/pgapack/source/parallel.c	(revision 1202)
@@ -127,12 +127,10 @@
 	if (rank == 0) {
 	    Restarted = PGA_FALSE;
-	    if ((ctx->ga.restart == PGA_TRUE) &&
-		(ctx->ga.ItersOfSame % ctx->ga.restartFreq == 0)) {
-		ctx->ga.ItersOfSame++;
-		Restarted = PGA_TRUE;
-		PGARestart(ctx, PGA_OLDPOP, PGA_NEWPOP);
+	    if (PGARestartCondition(ctx)) {
+			Restarted = PGA_TRUE;
+			PGARestart(ctx, PGA_OLDPOP, PGA_NEWPOP);
 	    } else {
-		PGASelect(ctx, PGA_OLDPOP);
-		CreateNewGeneration(ctx, PGA_OLDPOP, PGA_NEWPOP);
+			PGASelect(ctx, PGA_OLDPOP);
+			CreateNewGeneration(ctx, PGA_OLDPOP, PGA_NEWPOP);
 	    }
 	}
Index: trunk/packages/optimizer/src/pgapack/pgapack/source/pga.c
===================================================================
--- trunk/packages/optimizer/src/pgapack/pgapack/source/pga.c	(revision 1178)
+++ trunk/packages/optimizer/src/pgapack/pgapack/source/pga.c	(revision 1202)
@@ -200,6 +200,6 @@
 {
     int i, j, n, m1, m2;
-    int popsize, numreplace;
-    double pc;
+    int popsize, numreplace, randnumreplace;
+    double pc, randreplprop;
 
     PGADebugEntered("PGARunMutationAndCrossover");
@@ -207,7 +207,9 @@
     popsize = PGAGetPopSize(ctx);
     numreplace = PGAGetNumReplaceValue(ctx);
+    randreplprop = PGAGetRandReplProp(ctx);
+    randnumreplace = (int)randreplprop*popsize;
     /*** first, copy n best strings (sorted by fitness) to new pop ***/
     PGASortPop( ctx, oldpop );
-    n = popsize - numreplace;
+    n = popsize - numreplace - randnumreplace;
     for ( i=0; i < n; i++ ) {
         j = PGAGetSortedPopIndex( ctx, i );
@@ -216,5 +218,5 @@
     pc = PGAGetCrossoverProb(ctx);
     /*** reproduce to create the rest of the new population ***/
-    while ( n < popsize) {
+    while ( n < (popsize- randnumreplace)) {
         m1 = PGASelectNextIndex( ctx );
         m2 = PGASelectNextIndex( ctx );
@@ -230,5 +232,5 @@
               n++;
 
-              if ( n < popsize ) {
+              if ( n < (popsize-randnumreplace) ) {
               /*** mutate and copy second string to new population ***/
               PGAMutate ( ctx, PGA_TEMP2, newpop);
@@ -242,5 +244,5 @@
             PGACopyIndividual ( ctx, m1, oldpop, n, newpop );
             n++;
-            if ( n < ctx->ga.PopSize ) {
+            if ( n < (popsize-randnumreplace) ) {
                 PGACopyIndividual ( ctx, m2, oldpop, n, newpop );
                 n++;
@@ -248,4 +250,11 @@
        }
     }
+    
+    if(randnumreplace > 0){
+	    while(n < popsize){
+	    	PGACreateIndividual(ctx,n,newpop,PGA_TRUE);
+	    	n++;
+	    }
+    }
 
     PGADebugExited("PGARunMutationAndCrossover");
@@ -276,6 +285,6 @@
 {
     int i, j, n, m1, m2;
-    int popsize, numreplace;
-    double pc;
+    int popsize, numreplace, randnumreplace;
+    double pc, randreplprop;
 
     PGADebugEntered("PGARunMutationOrCrossover");
@@ -283,7 +292,9 @@
     popsize = PGAGetPopSize(ctx);
     numreplace = PGAGetNumReplaceValue(ctx);
+    randreplprop = PGAGetRandReplProp(ctx);
+    randnumreplace = (int)randreplprop*popsize;
     /*** first, copy n best strings (sorted by fitness) to new pop ***/
     PGASortPop( ctx, oldpop );
-    n = popsize - numreplace;
+    n = popsize - numreplace - randnumreplace ;
     for ( i=0; i < n; i++ ) {
         j = PGAGetSortedPopIndex( ctx, i );
@@ -292,5 +303,5 @@
     pc = PGAGetCrossoverProb(ctx);
     /*** reproduce to create the rest of the new population ***/
-    while ( n < popsize ) {
+    while ( n < (popsize-randnumreplace) ) {
         m1 = PGASelectNextIndex( ctx );
         m2 = PGASelectNextIndex( ctx );
@@ -305,5 +316,5 @@
             n++;
 
-            if ( n < popsize )
+            if ( n < (popsize-randnumreplace) )
             {
                  /*** copy second string to new population ***/
@@ -323,5 +334,5 @@
              n++;
 
-             if ( n < popsize ) {
+             if ( n < (popsize-randnumreplace) ) {
                   PGACopyIndividual(ctx, m2, oldpop, PGA_TEMP2, newpop);
                   PGAMutate ( ctx, PGA_TEMP2, newpop );
@@ -333,4 +344,11 @@
         }
     }
+    
+    if(randnumreplace > 0){
+	    while(n < popsize){
+	    	PGACreateIndividual(ctx,n,newpop,PGA_TRUE);
+	    	n++;
+	    }
+    }
 
     PGADebugExited("PGARunMutationOrCrossover");
Index: trunk/packages/optimizer/src/pgapack/pgapack/source/random.c
===================================================================
--- trunk/packages/optimizer/src/pgapack/pgapack/source/random.c	(revision 1178)
+++ trunk/packages/optimizer/src/pgapack/pgapack/source/random.c	(revision 1202)
@@ -403,2 +403,52 @@
     PGADebugExited("PGASetRandomSeed");
 }
+
+/*****************************************************************************
+ Category: Generation/Utility
+ 
+ Inputs:
+ 		ctx - context variable
+ 		randreplaceprop - proportion of individuals to be replaced per generation randomly, post initialization
+ 		
+ Outputs:
+ 		None
+ 		
+ Example:
+ 	PGAContext *ctx;
+ 	.
+ 	.
+ 	PGASetRandReplProp(ctx, 0.05);		
+ ***************************************************************************/
+void PGASetRandReplProp(PGAContext *ctx, double randreplprop){
+	PGADebugEntered("PGASetRandReplProp");
+	PGAFailIfSetUp("PGASetRandReplProp");
+	if(randreplprop < 0 || randreplprop > 1){
+		PGAError ( ctx, "PGASetRandReplProp: Invalid value set:",
+		  PGA_FATAL, PGA_DOUBLE, (void *) &randreplprop);
+	}else{
+		ctx->ga.randreplprop = randreplprop;
+	}
+	PGADebugExited("PGASetRandReplProp");
+}
+
+/*****************************************************************************
+ Category: Generation/Utility
+ 
+ Inputs:
+ 		ctx - context variable
+ 		
+ Outputs:
+ 		randreplprop - proportion of randomly generated individuals per population, post initialization
+ 		
+ Example:
+ 	PGAContext *ctx;
+ 	double randreplprop;
+ 	.
+ 	.
+ 	randreplprop = PGAGetRandReplProp(ctx);		
+ ***************************************************************************/
+double PGAGetRandReplProp(PGAContext *ctx){
+	PGADebugEntered("PGAGetRandReplProp");
+	PGADebugExited("PGAGetRandReplProp");
+	return ctx->ga.randreplprop;
+}
