home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 13
/
mediashare_13.zip
/
mediashare_13
/
ZIPPED
/
PROGRAM
/
APR94_1.ZIP
/
GA.ZIP
/
SOURCE.ZIP
/
GRAPHIND.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-10
|
2KB
|
82 lines
//Copyright (C) Man Machine Interfaces 1994. All rights reserved.
#include "stdafx.h"
//Headers needed for EOS programs
//You need EOS v1.1 to compile this code
#include "eos.h"
//headers specific to graph GA
#include "graphind.h"
//This file implements an "auto decoding" binary individual
//used for performance reasons. The phenotype will decoded
//only when necessary.
CGraphDrawingInd::CGraphDrawingInd()
: TBinaryIndividual()
{
m_Decoded = 0 ;
}
CGraphDrawingInd::CGraphDrawingInd(PTBinaryGenotype geno, PTPhenotype pheno)
: TBinaryIndividual(geno, pheno)
{
m_Decoded = 0 ;
}
CGraphDrawingInd::CGraphDrawingInd(const CGraphDrawingInd & individ)
: TBinaryIndividual(individ)
{
m_Decoded = 0 ;
}
const CGraphDrawingInd & CGraphDrawingInd::operator =(const CGraphDrawingInd & individ)
{
if (this != &individ) {
this->TBinaryIndividual::operator =(individ) ;
m_Decoded = 0 ;
}
return *this ;
}
void CGraphDrawingInd::CalcFitness()
{
if (!m_Decoded)
Decode() ;
TBinaryIndividual::CalcFitness() ;
}
void CGraphDrawingInd::Decode()
{
TBinaryIndividual::Decode() ;
m_Decoded = 1 ;
}
void CGraphDrawingInd::CopyFrom(CGraphDrawingInd * source)
{
TBinaryIndividual::CopyFrom(source) ;
m_Decoded = 0 ;
}
PTIndividual CGraphDrawingInd::Copy()
{
return new CGraphDrawingInd(*this) ;
}
void CGraphDrawingInd::GetPhenoInfo(void *pInfoStruct)
{
if (!m_Decoded)
Decode() ;
TBinaryIndividual::GetPhenoInfo(pInfoStruct) ;
}
const void * CGraphDrawingInd::GetPhenoInfo(int key)
{
if (!m_Decoded)
Decode() ;
return TBinaryIndividual::GetPhenoInfo(key) ;
}