Click here to Skip to main content
15,892,674 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
JokeRe: Funny Quotes #2 Pin
Sreram K14-Sep-15 6:56
Sreram K14-Sep-15 6:56 
GeneralRe: Funny Quotes #2 Pin
Ron Anders14-Sep-15 7:26
Ron Anders14-Sep-15 7:26 
GeneralRe: Funny Quotes #2 Pin
Jörgen Andersson14-Sep-15 7:27
professionalJörgen Andersson14-Sep-15 7:27 
GeneralRe: Funny Quotes #2 Pin
snorkie14-Sep-15 8:44
professionalsnorkie14-Sep-15 8:44 
GeneralRe: Funny Quotes #2 Pin
908236514-Sep-15 7:51
908236514-Sep-15 7:51 
GeneralRe: Funny Quotes #2 Pin
GuyThiebaut14-Sep-15 8:13
professionalGuyThiebaut14-Sep-15 8:13 
GeneralRe: Funny Quotes #2 Pin
ZurdoDev15-Sep-15 1:22
professionalZurdoDev15-Sep-15 1:22 
QuestionDeveloping a Genetic Algorithm Pin
Sreram K14-Sep-15 6:39
Sreram K14-Sep-15 6:39 
I am new to genetic algorithms, but now I have decided it must not be so for long! I have been thinking what it takes to develop a program that implements the genetic algorithm (in C++) and I have the following idea:

1. The program should have an array of function pointers, each holding a particular function that responds to the input given.
2. Each "organism" should just be a collection of functions held in the function pointer array, along with the input fed to the system.
3. Each of these functions in the function pointer array is the genetic material, and these have access to a memory space which can be read/altered.
4. Now the result gets evaluated by calling all the functions in the function array linearly, and the result is finally retrieved.
5. Mutation and crossover process also occurs; they are monitored globally


Example,
C++
typedef (int)(*FuncPtr)(int*, int); // the first int* gets the memory space and the second 'int'; determines its size.

struct GeneticCode{
      int* MemSpace;

      static int MemSpaceSize; // remains same for all organisms

      void SetMemSpace(int s); // mostly
      FuncPtr fnc[MAX_GENETIC];
      void Mutate(int seed);// if you want to mutate in random
      GeneticCode NextGen(GeneticCode);// crosses over

};


Now, this data structure shows how an individual organism should be defined. We just need to add a,
C++
void Evaluate(int* Input, GeneticCode Code);


function to evaluate the result for a given input. This is done by evaluating every function in the genetic material linearly. Like this,

C++
for(int i=0; i<MAX_GENETIC; ++i)
   Code.Fnc[i] (MemSpace, Code::MemSpaceSize); /// does modification to the MemSpace during each step of iteration. Once it is done, the MemSpace would contain the result. 


So what do you think about this Idea? I am thinking of forming a general 'framework' of code that works fine in most genetic algorithm situations. Do you think this would work for face recognition algorithms? Lets not follow what the books say, and lets get super creative! I am new to Forums based and programming (which means I am also new here. So please forgive me if I sound offbeat.)

And we would also need a fitness function monitoring the population.

modified 14-Sep-15 12:46pm.

AnswerRe: Developing a Genetic Algorithm Pin
Marc Clifton14-Sep-15 6:53
mvaMarc Clifton14-Sep-15 6:53 
GeneralRe: Developing a Genetic Algorithm Pin
Sreram K14-Sep-15 7:25
Sreram K14-Sep-15 7:25 
GeneralRe: Developing a Genetic Algorithm Pin
CDP180214-Sep-15 22:24
CDP180214-Sep-15 22:24 
GeneralRe: Developing a Genetic Algorithm Pin
Sreram K15-Sep-15 3:34
Sreram K15-Sep-15 3:34 
GeneralRe: Developing a Genetic Algorithm Pin
harold aptroot14-Sep-15 7:13
harold aptroot14-Sep-15 7:13 
AnswerRe: Developing a Genetic Algorithm Pin
Duncan Edwards Jones14-Sep-15 7:20
professionalDuncan Edwards Jones14-Sep-15 7:20 
GeneralRe: Developing a Genetic Algorithm Pin
Sreram K15-Sep-15 3:16
Sreram K15-Sep-15 3:16 
GeneralRe: Developing a Genetic Algorithm Pin
Duncan Edwards Jones15-Sep-15 4:33
professionalDuncan Edwards Jones15-Sep-15 4:33 
AnswerRe: Developing a Genetic Algorithm Pin
BillWoodruff14-Sep-15 11:07
professionalBillWoodruff14-Sep-15 11:07 
GeneralRe: Developing a Genetic Algorithm Pin
Sreram K14-Sep-15 15:41
Sreram K14-Sep-15 15:41 
QuestionRe: Developing a Genetic Algorithm Pin
Sreram K15-Sep-15 3:25
Sreram K15-Sep-15 3:25 
JokeRiddles of nature PinPopular
Duncan Edwards Jones14-Sep-15 5:37
professionalDuncan Edwards Jones14-Sep-15 5:37 
GeneralRe: Riddles of nature Pin
Richard Deeming14-Sep-15 6:04
mveRichard Deeming14-Sep-15 6:04 
JokeRe: Riddles of nature Pin
MacSpudster14-Sep-15 6:05
professionalMacSpudster14-Sep-15 6:05 
GeneralRe: Riddles of nature Pin
908236514-Sep-15 12:03
908236514-Sep-15 12:03 
GeneralRe: Riddles of nature Pin
MacSpudster15-Sep-15 5:54
professionalMacSpudster15-Sep-15 5:54 
GeneralRe: Riddles of nature Pin
908236514-Sep-15 8:04
908236514-Sep-15 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.