This function is the genetic algorithm to be used to optimise a cFL model by fitting to data containing one time point.

1 2 3 4 | ```
gaDiscreteT1(CNOlist, model, paramsList, initBstring=NULL, sizeFac=0.0001,
NAFac=1, popSize=50, pMutation=0.5, maxTime=60, maxGens=500,
stallGenMax=100, selPress=1.2, elitism=5, relTol=0.1,
verbose=TRUE,maxSizeHashTable = 1000)
``` |

`CNOlist` |
a CNOlist on which the score is based (based on valueSignals[[2]], i.e. data at t1) |

`model` |
a Model list |

`paramsList` |
CellNOptR software parameters (this functions uses transfer functions to choose from) |

`initBstring` |
an initial bitsring to be tested, should be of the same size as the number of reactions in the model above. |

`sizeFac` |
the scaling factor for the size term in the objective function, default to 0.0001 |

`NAFac` |
the scaling factor for the NA term in the objective function, default to 1. |

`popSize` |
the population size for the genetic algorithm, default set to 50 |

`pMutation` |
the mutation probability for the genetic algorithm, default set to 0.5 |

`maxTime` |
the maximum optimisation time in seconds, default set to 60 |

`maxGens` |
the maximum number of generations in the genetic algorithm, default set to 500. |

`stallGenMax` |
the maximum number of stall generations in the genetic algorithm, default to 100. |

`selPress` |
the selective pressure in the genetic algorithm, default set to 1.2. |

`elitism` |
the number of best individuals that are propagated to the next generation in the genetic algorithm, default set to 5. |

`relTol` |
the relative tolerance for the best bitstring reported by the genetic algorithm, i.e.how different from the best solution can solutions be to be reported as well, default set to 0.1. |

`verbose` |
logical (default to TRUE) do you want the statistics of each generation to be printed on the screen? |

`maxSizeHashTable` |
a hash table is use to store bitstring and related score. This allows the GA to be very efficient is the case of small models. The size of the hash table is 5000 by default, which may be too large for large models |

The GA procedure is implemented based on the gaBinaryT1 in CellNOptR (see those man pages for a basic description). Necessary extensions to optimize a string of numbers rather than zero and one have been made. Additionally, since the scoring function is defined inside the function, it has also been altered for this function.

The parameters are similar to those used in CellNOptR and the returned list contains similar results as well.

This function returns a list with elements:

`bString` |
The best bitstring |

`results` |
A matrix with columns "Generation", "Best_score", "Best_bitString", "Stall_Generation", "Avg_Score_Gen", "Best_score_Gen" ,"Best_bit_Gen", "Iter_time". |

`stringsTol` |
The bitstrings whose scores are within the tolerance |

`stringsTolScores` |
The scores of the above-mentioned strings |

M. Morris based on gaBinaryT1 function by C. Terfve (CellNOptR package)

prep4simFuzzy, simFuzzyT1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
data(CNOlistToy,package="CellNOptR")
data(ToyModel,package="CellNOptR")
#pre-process model
model <- preprocessing(CNOlistToy, ToyModel, verbose=FALSE)
#set parameters
paramsList <- defaultParametersFuzzy(CNOlistToy, ToyModel)
# the GA algorithm
ToyT1opt<-gaDiscreteT1(
CNOlist=CNOlistToy,
model=model,
paramsList=paramsList,
maxTime=3,
verbose=FALSE)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.