COPASI API
4.16.103
|
#include <CGA.h>
Public Member Functions | |
CGA () | |
CGA (const CGA &source) | |
int | cleanup () |
void | copy (unsigned int o, unsigned int d) |
void | creation (unsigned int l, unsigned int u) |
void | crossover (unsigned int p1, unsigned int p2, unsigned int c1, unsigned int c2) |
void | dumpData (unsigned int i) |
double | evaluate (unsigned int i) |
unsigned int | fittest (void) |
double | getBestCandidate () |
unsigned int | getGeneration () |
int | getParamNum () |
int | getPopSize () |
void | initFirstGeneration () |
bool | initialize () |
int | initOptRandom () |
void | mutate (unsigned int i) |
CGA & | operator= (const CGA &source) |
int | optimise () |
void | replicate (void) |
void | select (int method) |
void | setBest (unsigned int num) |
void | setCandx (int i, double num) |
void | setGeneration (int num) |
void | setIndv (int i, int j, double num) |
void | setMax (double num) |
void | setMin (double num) |
void | setMutVar (double num) |
void | setParamNum (int num) |
void | setPopSize (int num) |
void | setRealProblem (CRealProblem &aProb) |
void | shuffle (void) |
void | swap (unsigned int o, unsigned int d) |
~CGA () | |
Private Attributes | |
unsigned int | mBest |
double * | mCandX |
int | mCrossNum |
unsigned int * | mCrp |
unsigned int | mGener |
double ** | mIndV |
double | mMax |
unsigned int * | mMidX |
double | mMin |
double | mMutProb |
double | mMutVar |
int | mParamNum |
unsigned int | mPopSize |
CRealProblem | mRealProblem |
unsigned int * | mWins |
CGA::CGA | ( | ) |
default constructor
File name: CGA.cpp
Programmer: Yongqun He Contact email: yohe@ Purpose: This is the implementation (.cpp file) of the vt.e duCGA class. It is to implement the genetic algorithm for COPASI optimization Note: Modified from Gepasi and Dingjun Chen's implementation
Definition at line 42 of file CGA.cpp.
References mCandX, mCrp, mGener, mIndV, mMidX, mParamNum, mPopSize, and mWins.
CGA::CGA | ( | const CGA & | source | ) |
CGA::~CGA | ( | ) |
int CGA::cleanup | ( | ) |
void CGA::copy | ( | unsigned int | o, |
unsigned int | d | ||
) |
void CGA::creation | ( | unsigned int | l, |
unsigned int | u | ||
) |
void CGA::crossover | ( | unsigned int | p1, |
unsigned int | p2, | ||
unsigned int | c1, | ||
unsigned int | c2 | ||
) |
void CGA::dumpData | ( | unsigned int | i | ) |
double CGA::evaluate | ( | unsigned int | i | ) |
evaluate the fitness of one individual
Definition at line 296 of file CGA.cpp.
References CRealProblem::calculate(), mIndV, mParamNum, and mRealProblem.
Referenced by creation(), initFirstGeneration(), and mutate().
unsigned int CGA::fittest | ( | void | ) |
check the best individual at this generation
Definition at line 591 of file CGA.cpp.
References mCandX, and mPopSize.
Referenced by creation(), initFirstGeneration(), and optimise().
double CGA::getBestCandidate | ( | ) |
unsigned int CGA::getGeneration | ( | ) |
get generation number
Definition at line 275 of file CGA.cpp.
References mGener.
Referenced by optimise().
int CGA::getParamNum | ( | ) |
int CGA::getPopSize | ( | ) |
get population size
Definition at line 281 of file CGA.cpp.
References mPopSize.
Referenced by optimise().
void CGA::initFirstGeneration | ( | ) |
initialize the first generation
Definition at line 116 of file CGA.cpp.
References creation(), evaluate(), fittest(), max, mBest, mCandX, mIndV, mParamNum, and mPopSize.
Referenced by initialize().
bool CGA::initialize | ( | ) |
int CGA::initOptRandom | ( | ) |
void CGA::mutate | ( | unsigned int | i | ) |
process mutation
Definition at line 384 of file CGA.cpp.
References evaluate(), mCandX, mIndV, mMax, mMin, mMutVar, and mParamNum.
Referenced by replicate().
int CGA::optimise | ( | ) |
optimization function
Definition at line 696 of file CGA.cpp.
References creation(), dumpData(), fittest(), getBestCandidate(), getGeneration(), getPopSize(), initOptRandom(), mMax, mMin, mParamNum, mRealProblem, replicate(), select(), and setBest().
replicate the individuals w/ crossover
Definition at line 518 of file CGA.cpp.
References copy(), crossover(), mMidX, mPopSize, mutate(), and shuffle().
Referenced by optimise().
void CGA::select | ( | int | method | ) |
void CGA::setBest | ( | unsigned int | num | ) |
set the best result
Definition at line 255 of file CGA.cpp.
References mBest.
Referenced by optimise().
void CGA::setCandx | ( | int | i, |
double | num | ||
) |
void CGA::setGeneration | ( | int | num | ) |
void CGA::setIndv | ( | int | i, |
int | j, | ||
double | num | ||
) |
void CGA::setMax | ( | double | num | ) |
void CGA::setMin | ( | double | num | ) |
void CGA::setMutVar | ( | double | num | ) |
void CGA::setParamNum | ( | int | num | ) |
void CGA::setPopSize | ( | int | num | ) |
void CGA::setRealProblem | ( | CRealProblem & | aProb | ) |
Declare the prototype of member functions set real problem
Definition at line 201 of file CGA.cpp.
References mRealProblem.
shuffle data
Definition at line 500 of file CGA.cpp.
References mMidX, and mPopSize.
Referenced by replicate().
void CGA::swap | ( | unsigned int | o, |
unsigned int | d | ||
) |
|
private |
Definition at line 46 of file CGA.h.
Referenced by CGA(), creation(), dumpData(), getBestCandidate(), initFirstGeneration(), operator=(), and setBest().
|
private |
Definition at line 49 of file CGA.h.
Referenced by CGA(), copy(), creation(), dumpData(), fittest(), getBestCandidate(), initFirstGeneration(), initialize(), mutate(), operator=(), select(), setCandx(), swap(), and ~CGA().
|
private |
Definition at line 42 of file CGA.h.
Referenced by CGA(), crossover(), and operator=().
|
private |
Definition at line 50 of file CGA.h.
Referenced by CGA(), crossover(), initialize(), operator=(), and ~CGA().
|
private |
Definition at line 40 of file CGA.h.
Referenced by CGA(), getGeneration(), initialize(), operator=(), and setGeneration().
|
private |
Definition at line 48 of file CGA.h.
Referenced by CGA(), copy(), creation(), crossover(), dumpData(), evaluate(), initFirstGeneration(), initialize(), mutate(), operator=(), setIndv(), swap(), and ~CGA().
|
private |
Definition at line 43 of file CGA.h.
Referenced by CGA(), creation(), initialize(), mutate(), operator=(), optimise(), and setMax().
|
private |
Definition at line 51 of file CGA.h.
Referenced by CGA(), initialize(), operator=(), replicate(), shuffle(), and ~CGA().
|
private |
Definition at line 43 of file CGA.h.
Referenced by CGA(), creation(), initialize(), mutate(), operator=(), optimise(), and setMin().
|
private |
Definition at line 45 of file CGA.h.
Referenced by CGA(), and operator=().
|
private |
Definition at line 44 of file CGA.h.
Referenced by CGA(), initialize(), mutate(), operator=(), and setMutVar().
|
private |
Definition at line 47 of file CGA.h.
Referenced by CGA(), copy(), creation(), crossover(), dumpData(), evaluate(), getParamNum(), initFirstGeneration(), initialize(), mutate(), operator=(), optimise(), setParamNum(), and swap().
|
private |
Definition at line 41 of file CGA.h.
Referenced by CGA(), fittest(), getPopSize(), initFirstGeneration(), initialize(), operator=(), replicate(), select(), setPopSize(), and shuffle().
|
private |
Definition at line 55 of file CGA.h.
Referenced by evaluate(), initialize(), optimise(), and setRealProblem().
|
private |
Definition at line 52 of file CGA.h.
Referenced by CGA(), initialize(), operator=(), select(), swap(), and ~CGA().