home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 13
/
mediashare_13.zip
/
mediashare_13
/
ZIPPED
/
PROGRAM
/
APR94_1.ZIP
/
GA.ZIP
/
SOURCE.ZIP
/
GDRIVER.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-10
|
2KB
|
83 lines
//Copyright (C) Man Machine Interfaces 1994. All rights reserved.
//gdriver.h
#ifndef __GDRIVER_H__
#define __GDRIVER_H__
//flag an empty cell in the grid
const EMPTY_CELL = 0xFFFF ;
class CGAGraphDriver
{
//Interface
public:
CGAGraphDriver(int numNodes, int width, int height) ;
~CGAGraphDriver() ;
void SetGraph(CWordMatrix &graph) ;
void Optimize(int numGenrations) ;
void DrawOptimized(CDC &dc) ;
void DrawUnOptimized(CDC &dc) ;
//Query members (const)
//Calc the length of a chromosome
//needed based on the graph and grid
UINT CalcChromosomeLength() const ;
UINT CalcRowAlleleLength() const ; ;
UINT CalcColAlleleLength() const ; ;
int GetWidth() const ;
int GetHeight() const ;
int GetNumNodes() const ;
BOOL Connected(WORD node1, WORD node2) const;
int GetNumConnections(WORD node) const ;
int GetConnectivity() ;
void Stop() ;
PTIndividual m_pBest ;
PTIndividual m_pWorst ;
BOOL m_Stop ;
//Implementation
private:
//Draw the graph in this grid
void Draw(CDC &dc, CWordMatrix &Grid) ;
//num nodes in the graph
int m_NumGraphNodes ;
//width of grid to draw on (in cells)
int m_GridWidth ;
//height of grid to draw on (in cells)
int m_GridHeight ;
//connection table representation of a graph
CWordMatrix *m_pGraph ;
//GA that will find the "optimal" drawing
//of the graph on the grid
TBasicGA *m_pTheGA ;
} ;
//Inline simple members
inline int CGAGraphDriver::GetWidth() const
{
return m_GridWidth ;
}
inline int CGAGraphDriver::GetHeight() const
{
return m_GridHeight ;
}
inline int CGAGraphDriver::GetNumNodes() const
{
return m_NumGraphNodes ;
}
#endif