Results 1 to 5 of 5
  1. #1
    C-9
    C-9 is offline Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Default Using JGAP to evolve music

    Hi!

    HELP!
    I'm a newbie in Java and I'm trying to use Genetic Algorithms with music. I would like to use JGAP framework, but I'm getting a little discouraged, because I can't establish a comparison between the examples and what I want my JAVA program to do.

    For instance, I want the user to assign the fitness value of certain GA created melodies. How can I do that? All the examples demand you to build the fitness function.

    Does anyone got some simple examples of JGAP application with music? I would appreciate if you could help me out.

    Thanks!

  2. #2
    Jodokus's Avatar
    Jodokus is offline Senior Member
    Join Date
    Jan 2011
    Location
    Amsterdam, the Netherlands
    Posts
    230
    Rep Power
    4

    Default Re: Using JGAP to evolve music

    I've a citation here (Jamie Craane's blog on JGAP) citing John R. Koza:
    “The genetic algorithm is a probabilistic search algorithm that iteratively transforms a set (called a population) of mathematical objects (typically fixed-length binary character strings), each with an associated fitness value, into a new population of offspring objects using the Darwinian principle of natural selection ...". That is not true! There is not an inherent need for a fitness function based directly on the "chromosome" (see my signature). Maybe in JGAP there is though. You can also set up some competition, but you need a reasonably consistent criterium to tell who is the winner. Of course you can let the user decide (as you suggest) or develop some fancy algorithm to recognize good music. But that’s not trivial (a good algorithm makes boogie woogie win of course).
    Warning: newbie’s can learn, but this is not a simple undertaking.
    No bug ever had to calculate its fitnessfunction.

  3. #3
    C-9
    C-9 is offline Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Default Re: Using JGAP to evolve music

    Thanks for your help Jodokus!


    Right now I've created a randomInitialGenotype (Genotype.randomInitialGenotype(gaConf)) and I've already managed to put all chromosomes into a String:

    List chromosomes = genotipo.getPopulation().getChromosomes();
    for (Object chromosome : chromosomes) {
    IChromosome chrom = (IChromosome) chromosome;
    for (int j = 0; j < chrom.size(); j++) {
    Gene geneteste = chrom.getGene(j);
    populinicial += geneteste.getAllele().toString();



    But now I want to see the value of each gene of each chromosome (individually) and I want to be able to change any of these values​​.
    How can I do this?

    Thanks in advance for your precious help!

  4. #4
    Jodokus's Avatar
    Jodokus is offline Senior Member
    Join Date
    Jan 2011
    Location
    Amsterdam, the Netherlands
    Posts
    230
    Rep Power
    4

    Default Re: Using JGAP to evolve music

    I don't know JGAP, I only read some documentation about it. I just wanted to warn you that a lot of GA-frameworks stress the importance of the fitnessfunction, often based on the chromosome alone. That's one thing that troubled you. (For instance, if you want to select on speed, set up a race: you don't need to know by inspecting the genes which one is faster.)

    Also the naming is not right (in your code and in Jamie's blog): the genotype is not "the population of solutions" (Jamie), but just the code defining one individual. Thus population->individual->genotype(=chromosomes)->gene. I say this as a biologist, I don't know how it's defined in JGAP.

    Further, in most GA-programs there is a tight coupling between genotype (genes) and fenotype (the effect: what the "organism" does or how it looks). In your case probably one note per gene or the like. In nature genotype and fenotype are decoupled: there is not a gene for eye-color. But it is rather difficult to do that in code. I would follow two tracks: study JGAP (I can't help you with that), and in the meantime start to think about how to code music on the chromosome(s), and how to select good music (probably with help of the user).
    No bug ever had to calculate its fitnessfunction.

  5. #5
    Jodokus's Avatar
    Jodokus is offline Senior Member
    Join Date
    Jan 2011
    Location
    Amsterdam, the Netherlands
    Posts
    230
    Rep Power
    4

    Default Re: Using JGAP to evolve music

    Cross posted:
    Old Nabble - FW: Using JGAP to evolve music
    Never do this without mentioning. But at least I read some introductory material on JGAP.
    No bug ever had to calculate its fitnessfunction.

Similar Threads

  1. playing music
    By snowhite in forum Java Servlet
    Replies: 5
    Last Post: 05-06-2012, 02:41 PM
  2. JGAP genetic algorithms for Java
    By Iskatel in forum Advanced Java
    Replies: 10
    Last Post: 11-04-2010, 05:26 PM
  3. Play music
    By carderne in forum New To Java
    Replies: 4
    Last Post: 08-05-2008, 02:09 PM
  4. Jgap 3.3
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-12-2007, 07:03 PM
  5. Jgap 3.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 06-24-2007, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •