[galib] Unhandled exception

Daiyue Weng dweng01 at qub.ac.uk
Mon Feb 10 06:40:45 EST 2014

Hi,all, I am using GAlib in my Visual Studio MFC project and encountered a Unhandled exception when using GA initialize() :

Unhandled exception at 0x765b2eec in XMLDOMFromVC.exe: Microsoft C++ exception: _com_error at memory location 0x00f9de10..

My code is as follows:

void CGATrainingDlg::OnBnClickedGaTrainButton()
// TODO: Add your control notification handler code here
GARealAlleleSetArray alleles2a;
for(int i=0; i<m_nAlleleSetArrayLen; i++)
alleles2a.add(0, 1, GAAllele::EXCLUSIVE, GAAllele::INCLUSIVE);

GARealGenome genome2a(alleles2a, ObjectiveTrampoline, this);

// Now do a genetic algorithm for each one of the genomes that we created.
GASimpleGA ga(genome2a);

// Now that we have the genomes, create a parameter list that will be used for
// all of the genetic algorithms.
GAParameterList params;
params.set(gaNpCrossover, m_dPCross);
params.set(gaNpMutation, m_dPMut);

params.set(gaNpConvergence, m_fPconv);
params.set(gaNnConvergence, m_nConv);
params.set(gaNnGenerations, m_nGAGen);

params.set(gaNpopulationSize, m_nGAPopSize);
params.set(gaNscoreFrequency, m_nScoreFreq);
params.set(gaNflushFrequency, m_nFlushFreq);
params.set(gaNselectScores, (int)GAStatistics::AllScores);

if((m_fPconv == 0 || m_nConv == 0) && m_nGAGen == 0)
AfxMessageBox(_T("You need to specify parameters for GA Terminator"));

// the following line is where the exception happened
/* some other code*/

I have been followed an example (ex7.C) that use `initialize()`, but do not know why I encountered this runtime exception, can anyone suggest me what to do?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20140210/353cd917/attachment.htm

More information about the galib mailing list