2

different between genetic algorithm and normal algorithm

Comments
  • 0
    THE DIFFERENCE IS THE PRODUCED RESULT.
  • 3
    Genetic algorithm is an optimization algorithm. Difficult to know how to contrast with "normal" without knowing what you mean by normal.
  • 0
    @platypus it means our daily written algorithm
  • 1
    @aryan221304 And what algorithm are you using there? Can you describe it?
  • 1
    a genetic algorithm has more if statements
  • 0
    @platypus ahh well its means a simple algorithm to do a tasks
  • 4
    A genetic algorithm can be compared to simple evolution. So let's say you have a generation of 100 birds playing the game flappy bird. Now the best of them (those that have a higher score) get into the next generation.

    This happens either by just taking them and giving them a chance to mutate (eg 1% chance that their values get tweaked a little) or by taking two birds and creating a new bird which has some values from both of them (this would be like a 'child')

    Daniel Shiffman aka The coding train has a series on genetic algorithms:

    9: Genetic Algorithms - The Nature of Code: https://youtube.com/playlist/...
  • 0
    @SukMikeHok really i thought it was more complex
  • 1
    Then, I would guess that the difference is that your "normal" algorithms are imperative, while a GA is a search algorithm.
  • 1
    @platypus thanks for solving my doubt
  • 0
    The difference is when something is rotten genetically, you can't correct that with beating alone.
  • 2
    @aryan221304
    Genetic algorithms simply rely on some sort of evolution-inspired process - they figure out patterns in the data that work and form combinations of those high performance patterns by trial and error. It's a very intuitive and pretty damn successful way of solving problems.

    I think @404response explained it pretty well, let me give you another example. Suppose you want to find the value of x that maximises f(x) = x, with the restriction that x is a 32 bit number. You can encode your solution as a bit string of 32 bits.

    Start with a random collection of bit strings. The genetic algorithm will then figure out which bit strings are highest value, get those bit strings to have children with each other, with preference given to higher value ones (i.e. in the next generation there will be more "children" of higher value bit strings than of lower).

    In this way it tries to increase the number of high value strings via selective breeding. Repeat till you feel it's optimized.
  • 1
    @aryan221304 as you can see there are a lot of choices here. The art of genetic algorithm design is to figure out
    1. What kind of representation you want for your solution i.e. what form the "genes" take. Bit strings are pretty common, though there are others (trees, etc.)
    2. How to assign scores to candidate solutions so that you can rank them.
    3. How to select mating candidates from the current pool of solutions (in general you want to give preference to high value solutions)
    4. How two (or more) solutions have sex and produce children (the general method is something called crossover).
    5. If you want the solutions to be able to mutate (i.e. spontaneous arbitrary changes in the representation eg. flip a random bit in the bit string), how often should mutation occur and how.

    (I may have missed some stuff)
    As you can see it's a pretty varied and flexible approach. And it works really well for problems that are extremely tough for other optimization algos.
  • 1
    @aryan221304 so GAs are just another kind of algos, basically, it's a "normal" algorithm in that sense. It's just distinguished by this pattern-finding-and-combining approach that's common to all GAs (technically the correct word to use here is "schemata", not "pattern", but eh).
Add Comment