| ||||||||||||||||||||
| ||||||||||||||||||||
|
||||||||||||||||||||
|
optiGA is a general purpose genetic algorithm ActiveX control that offers the programmer/user a range of existing features but also a good amount of flexibility. In short, optiGA's features include: Binary, real and integer data types, 4 different types of selection method, 4 crossover methods (including a user-defined one), 4 mutation methods (also including a user-defined method), 4 different termination functions and the option to minimize or maximize the objective.
The FeaturesThe features mentioned above are all well implemented, many of the properties can be set using the optiGA properties box that the "Visual" development environments offer. Below is a screenshot:
Ease of UseWhile I feel that optiGA's range of features is excellent, it is the "ease-of-use" factor that lets it down a little. The control seems very Visual Basic orientated; all the examples and the documentation is written in a form for VB users. When imported into Visual C++ it puts some strange restrictions on the programmer.For example, passing something as simple as an integer requires you to pass a reference to a long variable. This effectively requires you to create a variable for every parameter you need to pass to optiGA. Thankfully, most of the optiGA settings can be set using the property sheet shown above. Another ease issue has little to do with optiGA, but optiGA uses the VARIANT data type to pass things back and forth between the control and your application. This requires you to use SAFEARRAYs and other data types and functions that can overcomplicate simple issues. For example, here is the sample code required to display 4 values of a diophantine equation from the current generation:
void COptiGADlg::OnGenerationReportOptiga(float FAR* BestFitness,
long FAR* GenerationNumber, VARIANT FAR* BinaryGenes,
VARIANT FAR* RealGenes, VARIANT FAR* IntegerGenes,
long FAR* ElapsedTime, float FAR* GenerationMeanFitness)
{
VARIANT *pData;
SafeArrayAccessData(RealGenes->parray,(void**)&pData);
m_dA = pData[0].fltVal;
m_dB = pData[1].fltVal;
m_dC = pData[2].fltVal;
m_dD = pData[3].fltVal;
SafeArrayUnaccessData(RealGenes->parray);
UpdateData(FALSE);
}
Like I've mentioned, this complexity is due to the flexibility the VARIANT data type offers. Once the initial problem of using the SAFEARRAYs to pass information to and from the control, optiGA is easy to use. I managed to create the classic diophantine example relatively quickly, since creating the necessary fitness and generation statistic handlers was trivial using ClassWizard.
ConclusionIf you are either a Visual Basic user or are used to handling all sorts of ActiveX controls under Visual C++, optiGA is a nice solution since it provides a good balance of existing functionality and the ability to override key elements of the GA. The reasonable price also puts it within reach of most project budgets. For those with little ActiveX experience in C++ might find it a little "unfriendly".optiGA is available in a demonstration form that pops up a information dialog upon startup, see the OptiWater homepage for more details. Overall, optiGA is a good package with great features and excellent documentation but could have been a bit more language-independent.
Last Updated: 14/03/2001 |
|
|||||||||||||||||||
All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -