• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Generic Algorithm

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pls can enybody tell me about generic algothim with respect to java, it applications and it advanteges

Juwonlo - Nigeria
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you're referring to. Could you tell us where you heard the term? Is it possible you meant genetic algorithm? Or just generics, without the word algorithm?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since your last question was about how to build a search engine, you most likely mean genetic algorithm (not generic).
 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A genetic algorithm is trivial in any programming language and so it easy to implement in Java. It is capable of finding global maxima much much quicker than other methods such as simulated annealing, as you can only jump between neighbouring solutions using a SA algorithm rather than around the entire search space with a GA (made possible through crossover). Consequently, it is much less prone to getting stuck in a local maxia (which is a problem if you are trying to maximise the fitness value) or local minima (which is a problem if you are trying to minimise the fitness value)

As for applications, I programmed an automated timetabling system that timetable extra curriculum activies (such as workshops, group meetings, tutorials) around an existing lecture timetable which had to take into account 8 constraints/rules on how they had to be timetabled. This employed a GA - worked really well.

A genetic algorithm involves the use of encoding a solution as a chromosome and optimising that solution through the use of mutation and crossover operators - hence 'genetic' as it is imitating what happenins in out DNA - over a number of generations until either the maximum number of generations have been met or the desired fitness has been met/exceeded.

This means you will need a fitness function also that will evaluate your solutions that are present in the initial population and then present in the subsequent populations formed over the different generations.

Here is an outline of a GENERAL GA:



Note: the population sizes you are working with are up to you but there will be a range of sizes that will be optimal for the problem you have i.e. will allow you to find the BETTER solution quicker

There are many different ypes of crossover and mutational methods you can employ. Crossover will depenend on your encoding of the chromosome you use and sometimes standard crossover will not work and so you may need to use different forms, such as partially matched crossover (PMX).

You will need to decide if you want to score your solutions by giving those that are 'better' lower or higher scores - if you assign higher values to more desirable solutions then you will be aiming to achieve a global maxima, otherwise you will be aiming to achieve a global minima.

Let me know if you have any other questions.

[ May 30, 2007: Message edited by: Sam Bluesman ]

[ May 30, 2007: Message edited by: Sam Bluesman ]
[ May 30, 2007: Message edited by: Sam Bluesman ]
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JGAP is a Java implementation of a genetic algorithm/programming framework.
 
BWA HA HA HA HA HA HA! Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic