From jerry.chyau at gmail.com Mon Aug 4 06:11:53 2008 From: jerry.chyau at gmail.com (Jerry, Chi Hang Yau) Date: Mon, 4 Aug 2008 18:11:53 +0800 Subject: [galib] problem in installing GAlib graphic's examples Message-ID: <4f735d090808040311o2d1b3764t2bd70b46d565a11b@mail.gmail.com> Hello, I encountered a problem in installing GAlib graphic's examples on Linux platform. According to the instruction from the web, after typing: To build the graphic examples: % cd examples/graphic; make I got such error during compilation: ***************************************************************************************** [root at localhost graphic]# make g++ -Wall -O -g -DUSE_MOTIF -I../.. -c tspview.C tspview.C: In function 'void DrawCB(_WidgetRec*, void*, void*)': tspview.C:413: warning: converting to 'int' from 'float' tspview.C:414: warning: converting to 'int' from 'float' tspview.C: In function 'void DrawIndividual(GAGenome&, Display*, Drawable, _XGC*, int, int)': tspview.C:438: warning: converting to 'int' from 'double' tspview.C:439: warning: converting to 'int' from 'double' tspview.C:440: warning: converting to 'int' from 'double' tspview.C:441: warning: converting to 'int' from 'double' tspview.C: At global scope: tspview.C:675: error: explicit specialization of 'int GAListGenome::write(std::ostream&) const' must be introduced by 'template <>' tspview.C:675: error: template-id 'write<>' for 'int GAListGenome::write(std::ostream&) const' does not match any template declaration tspview.C:675: error: invalid function declaration make: *** [tspview.o] Error 1 ************************************************************************* If any one have encountered such compilation error and solved it, please help me. Thanks. Jerry -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.mit.edu/pipermail/galib/attachments/20080804/451c4806/attachment.htm From michael.kupfer at nasa.gov Mon Aug 18 20:02:10 2008 From: michael.kupfer at nasa.gov (Kupfer, Michael (ARC-AFA)[UC SANTA CRUZ]) Date: Mon, 18 Aug 2008 19:02:10 -0500 Subject: [galib] replacement of best individual Message-ID: <87D67DA289F034488A9D7E4CDEFD28CC7E2EDF@NDMSEVS34B.ndc.nasa.gov> Dear all, Under certain conditions, I would like to replace the current best individual with another one: Each time a new best individual is found I want to run a local search heuristic to improve this current best. If this improvement routine was successful, I would like to replace the current best with the result of the local search. How can I do the replacement? How can I replace pop.best() with the gene-values found in the improvement routine? Best, Michael Kupfer michael.kupfer at nasa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.mit.edu/pipermail/galib/attachments/20080818/7a3e3555/attachment.htm From akyi_dan at hotmail.com Tue Aug 19 17:55:15 2008 From: akyi_dan at hotmail.com (LiuDan) Date: Tue, 19 Aug 2008 21:55:15 +0000 Subject: [galib] how in install GALIB Message-ID: Hi, I am doing a project on Genetic Algorithm using Visual C++ 2005. Anyway, I was having the lots of problem as many of the new members in this mailing list. I cannot compile ex1.C. I am a very new beginner of Visual C++ 2005. I couldn't really understand the Installation guide. Can you help me to figure out those problems below? 1 how to set the includes path so that the directory in which the GAlib headers are located is searched? 2 how to set the compiler to use strict ANSI compilation? 3 how to set the development environment to use the C++ compiler on .C files(this is the /TP flag in MS Visual C++). 4 how to enable RTTI in Visual C++. I hope you can show me how to install GALib in Visual C++. Thank you very much. Sincerely, Dan _________________________________________________________________ 多个邮箱同步管理,live mail客户端万人抢用中 http://get.live.cn/product/mail.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.mit.edu/pipermail/galib/attachments/20080819/abc2bdc5/attachment.htm From alitis at gmail.com Wed Aug 20 08:02:41 2008 From: alitis at gmail.com (Alitis) Date: Wed, 20 Aug 2008 08:02:41 -0400 Subject: [galib] The Genome Constructor and Member Functions Message-ID: Hello, I am using GALib as part of a network simulation project on the application layer of a simulated node. Due to the way the simulator I am using is set up, the application layer must be a C++ class and everything in the application layer must be a member of that class. The problem I am experiencing is during construction of a genome. The constructor requires an pointer to the Objective function of type * (GAGenome&). Since the Objective function is now a member function of the application layer class, its type changes to something which is not recognized by the constructor. I can't simply make it a static function, as it needs access to the application layer's data members in order to compute a score. A number of FAQs have advised against trying to cast a pointer to a member function into a standard function pointer, since the size of the former is often greater than that of the latter. As such I seem to be able to neither make the function static, nor cast it into a form acceptable to the Genome constructor. Any suggestions as to how I can get around this difficulty would be greatly appreciated. From xavier.chardon at rennes.inra.fr Wed Aug 20 08:32:13 2008 From: xavier.chardon at rennes.inra.fr (Xavier Chardon) Date: Wed, 20 Aug 2008 14:32:13 +0200 Subject: [galib] The Genome Constructor and Member Functions In-Reply-To: References: Message-ID: <48AC0ECD.2000300@rennes.inra.fr> Hi, You need to derive your own genome and define the Evaluator() method. Let's say you have a class "Application" with a ObjectiveFunction(MyGenome) member. Then you create your own genome (let's call it MyGenome). You give it as attribute a pointer to an instance of Application (name: mpApplication) Then you must write something like: float MyGenome::Evaluator(GAGenome& g) { MyGenome& genome = (MyGenome&) g; float score = genome.mpApplication->ObjectiveFunction(g); return score; } To derive your own genome, you will need to read the help of GALib on this topic. In your case, there won't be much to do. Hope this is clear. Not sure it's the best solution, but it works for me. I don't have much time right now to elaborate on that, but feel free to contact me next week if you need more explanations. Xavier Alitis a ?crit : > Hello, > I am using GALib as part of a network simulation project on the > application layer of a simulated node. Due to the way the simulator I > am using is set up, the application layer must be a C++ class and > everything in the application layer must be a member of that class. > The problem I am experiencing is during construction of a genome. The > constructor requires an pointer to the Objective function of type * > (GAGenome&). Since the Objective function is now a member function of > the application layer class, its type changes to something which is > not recognized by the constructor. I can't simply make it a static > function, as it needs access to the application layer's data members > in order to compute a score. A number of FAQs have advised against > trying to cast a pointer to a member function into a standard function > pointer, since the size of the former is often greater than that of > the latter. As such I seem to be able to neither make the function > static, nor cast it into a form acceptable to the Genome constructor. > Any suggestions as to how I can get around this difficulty would be > greatly appreciated. > _______________________________________________ > galib mailing list > galib at mit.edu > http://mailman.mit.edu/mailman/listinfo/galib > > -- Xavier Chardon Th?sard Institut de l'?levage / INRA Projet ACTA "mod?lisation environnementale des syst?mes bovins et porcins" xavier.chardon at inst-elevage.asso.fr xavier.chardon at rennes.inra.fr 02 23 48 50 91 From mwall at oculustech.com Wed Aug 20 08:51:15 2008 From: mwall at oculustech.com (matthew wall) Date: Wed, 20 Aug 2008 08:51:15 -0400 Subject: [galib] replacement of best individual In-Reply-To: <87D67DA289F034488A9D7E4CDEFD28CC7E2EDF@NDMSEVS34B.ndc.nasa.gov> References: <87D67DA289F034488A9D7E4CDEFD28CC7E2EDF@NDMSEVS34B.ndc.nasa.gov> Message-ID: <2C85F6B2-4C67-4B2B-8073-B3D6D3C43F84@oculustech.com> On 18 Aug 2008, at 20:02, Kupfer, Michael (ARC-AFA)[UC SANTA CRUZ] wrote: > Dear all, > > Under certain conditions, I would like to replace the current best > individual with another one: > > Each time a new best individual is found I want to run a local > search heuristic to improve this current best. > If this improvement routine was successful, I would like to replace > the current best with the result of the local search. > How can I do the replacement? How can I replace pop.best() with the > gene-values found in the improvement routine? > hi michael, one approach is to create your own genetic algorithm object, since it has access to and complete control over the population. for example, this is a derivative of a simple ga that does repair class MyGA : public GASimpleGA { public: virtual void step(); } void MyGA::step() { // let the simple ga do its logic for a single step of evolution GASimpleGA::step(); // this is the genome into which you stick the repairs MyGenome genome; genome.copy(pop->individual(x)); // do your heuristic to improve the best here genome.setSomeValue(); genome.modifySomeAttribute(); // insert the genome into the population at the appropriate location pop->individual(x).copy(genome); } From michael.kupfer at nasa.gov Wed Aug 20 17:38:57 2008 From: michael.kupfer at nasa.gov (Kupfer, Michael (ARC-AFA)[UC SANTA CRUZ]) Date: Wed, 20 Aug 2008 16:38:57 -0500 Subject: [galib] how in install GALIB Message-ID: <87D67DA289F034488A9D7E4CDEFD28CC7E305E@NDMSEVS34B.ndc.nasa.gov> Hello Dan! What a coincidence: I just did that this morning as I found a very good (precise) step-by-step guide. Here is the link: http://hyperdrifter.com/ai/software/compiling_galib_using_microsoft_visual_cpp.html Please feel free to contact me again if you have problems. But I have to tell you that my knowledge is limited. Best, Michael. ________________________________ From: galib-bounces at mit.edu [mailto:galib-bounces at mit.edu] On Behalf Of LiuDan Sent: Tuesday, August 19, 2008 2:55 PM To: galib at mit.edu Subject: [galib] how in install GALIB Hi, I am doing a project on Genetic Algorithm using Visual C++ 2005. Anyway, I was having the lots of problem as many of the new members in this mailing list. I cannot compile ex1.C. I am a very new beginner of Visual C++ 2005. I couldn't really understand the Installation guide. Can you help me to figure out those problems below? 1 how to set the includes path so that the directory in which the GAlib headers are located is searched? 2 how to set the compiler to use strict ANSI compilation? 3 how to set the development environment to use the C++ compiler on .C files(this is the /TP flag in MS Visual C++). 4 how to enable RTTI in Visual C++. I hope you can show me how to install GALib in Visual C++. Thank you very much. Sincerely, Dan ________________________________ ? Windows Live Spaces ??????????????? ??????? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.mit.edu/pipermail/galib/attachments/20080820/1a139f56/attachment.htm From alitis at gmail.com Mon Aug 25 10:10:46 2008 From: alitis at gmail.com (Alitis) Date: Mon, 25 Aug 2008 10:10:46 -0400 Subject: [galib] Non-repeating alleles Message-ID: Hello, I am creating a 2D Array genome. The array is two rows deep, and possible values for each gene in both of the rows are drawn from the same allele set. However, I would like one row to be able to repeat values taken from the allele set (the default behavior of GALib) and one row to only select a given allele once. Is this possible without deriving my own classes? I realize I could simply impose extreme penalties in the objective function for repeated values, but this does not seem like the most efficient of solutions. Thanks, -Rick From Michael.Kupfer at nasa.gov Fri Aug 29 17:57:29 2008 From: Michael.Kupfer at nasa.gov (Kupfer, Michael (ARC-AFA)[UC SANTA CRUZ]) Date: Fri, 29 Aug 2008 16:57:29 -0500 Subject: [galib] replacement of best individual In-Reply-To: <2C85F6B2-4C67-4B2B-8073-B3D6D3C43F84@oculustech.com> References: <87D67DA289F034488A9D7E4CDEFD28CC7E2EDF@NDMSEVS34B.ndc.nasa.gov> <2C85F6B2-4C67-4B2B-8073-B3D6D3C43F84@oculustech.com> Message-ID: <87D67DA289F034488A9D7E4CDEFD28CC8A7C1B@NDMSEVS34B.ndc.nasa.gov> Hello! Unfortunately I still have some issue with replacing the best individual with some improved solution. What I did is: when a new current best is found, I generate an improved solution using my heuristic and then, replace it with the original best. I check with screen output if the right things are done. However, the problem I am having is that the best of the next iteration is not the improved solution from the previous step. Somehow it does not get updated. I did the following: ... class MyGA : public GASimpleGA { public: virtual void step(GARealAlleleSetArray alleles); MyGA(GARealGenome & garg) : GASimpleGA(garg){} ~MyGA() {} }; void MyGA::step(GARealAlleleSetArray alleles) { //GARealGenome& genome = (GARealGenome&)g; GASimpleGA::step(); GARealGenome genome_tmp(alleles, Objective); genome_tmp.copy(pop->individual(0)); if(SOME CONDITION) { cout << "best: " << ""; cout << pop->best(0) << "\n"; //The current best //gets printed correctly int sep_value = 0; for(int i = 0; i < (int) ac; i++) { if(i > 0) { IMPROVEMENTHEURISTIC } } cout << "genome_tmp: " << ""; for(int i = 0; i < (int) ac; i++) { cout << genome_tmp.gene(i) << " "; // The improved solution // gets printed correctly } cout << endl; pop->individual(0).copy(genome_tmp); cout << "best after: " << pop->best(0) << "\n"; //After Copy, the new //best is the improved //solution from the //heuristic which is //correct pop->evaluate(gaTrue); } } int main(int argc, char* argv []) { ... GARealAlleleSetArray alleles; for (int i = 0; i < (int) ac; i++) { alleles.add(aircraft[i].arrival_fast, aircraft[i].arrival_slow, 10); } GARealGenome genome(alleles, Objective); genome.initializer(MyArrayInitializer); genome.crossover(GARealGenome::OnePointCrossover); GAStatistics stats; GAParameterList params; GASimpleGA::registerDefaultParameters(params); params.set(gaNnGenerations, 30000); params.set(gaNpopulationSize, 30); params.set(gaNpMutation, 0.01); params.set(gaNpCrossover, 0.4); params.set(gaNscoreFrequency, 10); params.set(gaNflushFrequency, 10); params.set(gaNnBestGenomes,1); params.set(gaNselectScores, (int)GAStatistics::AllScores); params.parse(argc, argv, gaFalse); MyGA ga(genome); ga.minimize(); ga.parameters(params); GAPopulation pop(genome, ga.populationSize()); ga.initialize(seed); while(!ga.done()) { ga.step(alleles); ... } } float Objective(GAGenome& g ) { ... } Everything gets computed and shown on the screen correctly. BUT in the next iteration the current best is not the improved solution found with the heuristic from the previous iteration what I would expect; in other words, the improved solution which is even shown as current best does not get transferred into the next iteration. Did I forget something like an update-population-step? Thanks! Best, Michael. -----Original Message----- From: galib-bounces at mit.edu [mailto:galib-bounces at mit.edu] On Behalf Of matthew wall Sent: Wednesday, August 20, 2008 5:51 AM To: galib at mit.edu Subject: Re: [galib] replacement of best individual On 18 Aug 2008, at 20:02, Kupfer, Michael (ARC-AFA)[UC SANTA CRUZ] wrote: > Dear all, > > Under certain conditions, I would like to replace the current best > individual with another one: > > Each time a new best individual is found I want to run a local > search heuristic to improve this current best. > If this improvement routine was successful, I would like to replace > the current best with the result of the local search. > How can I do the replacement? How can I replace pop.best() with the > gene-values found in the improvement routine? > hi michael, one approach is to create your own genetic algorithm object, since it has access to and complete control over the population. for example, this is a derivative of a simple ga that does repair class MyGA : public GASimpleGA { public: virtual void step(); } void MyGA::step() { // let the simple ga do its logic for a single step of evolution GASimpleGA::step(); // this is the genome into which you stick the repairs MyGenome genome; genome.copy(pop->individual(x)); // do your heuristic to improve the best here genome.setSomeValue(); genome.modifySomeAttribute(); // insert the genome into the population at the appropriate location pop->individual(x).copy(genome); } _______________________________________________ galib mailing list galib at mit.edu http://mailman.mit.edu/mailman/listinfo/galib