I'd have to question why you think you need a GA for this problem. There are a lot of timetabling algorithms out there, as most scheduling problems can be modelled as graph matching/coloring problems. Maybe you just want to learn about GAs, which I think is a great reason! Even though this problem doesn't seem well-suited to a GA, you'll learn a lot along the way.

I disagree with eduardo's suggestion to not use Perl for this. Sure, EA/GAs do a lot of number-crunching, but I doubt you're dealing with gigs and gigs of data either. In my experience, Perl's many strengths have almost always made up for its raw computational speed. But I also have not used GAlib. If it really does make things that easy for you, and if you're as comfortable with C as with Perl, go for it. But I wouldn't put off Perl just because it's "slower." Besides, if you were out to make the fastest algorithm for this problem, you wouldn't be using a genetic algorithm anyway.

I'm obliged to plug my A Beginning Guide To Evolutionary Algorithms node. It is fairly general, but maybe you may find it helpful. Give it a read if you're not sure about how to put together the parts of an EA/GA. I also have a bunch of (biased) evolutionary algorithm links at the bottom of my homenode.

You seem to be having trouble coming up with a data representation, and that is usually the hardest part. If your goal is to make a conflict-free schedule, perhaps your fitness function could be the number of schedule conflicts, and your evolution can try to minimize that number. In picking a data representation for the schedule chromosome, try to make it one that facilitates easily mixing two schedules to a new schedule, preserving many aspects of the original schedules. I suggest an array indexed by either classes, students or teachers. That way you can just crossover the two arrays and not get any new schedule conflicts for whatever your indexing is in. Without more information about your problem, I don't think I can be more specific.

blokhead


In reply to Re: Perl, Genetic Algorithms and Encoding... by blokhead
in thread Perl, Genetic Algorithms and Encoding... by parcelforce

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.