Re: some module contributions

From: Tomaz Solc <tomaz.solcREMOVE@THISsiol.net>
Date: Fri Nov 26 2004 - 18:32:17 CET

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I've been looking through your code (I was pleasantly surprised to see
so many comments) and I've made a few changes:

The fitness functions in "subject_sameperiod.so" and
"subject_sameroom.so" are not continuous. This means that a timetable
with a larger error does not get a larger penalty. For example in
"subject_sameroom.so": the sum of errors does not depend on the number
of different rooms that are used by a subject. It is either "0" when all
tuples are scheduled in the same room or "1" if there is one or more
tuples scheduled in different rooms. Such fitness functions are not very
efficient when used with genetic algorithms.

A simple change that fixes this (diff attached below) improves time
needed to solve my test case for "subject_sameroom.so" from 36s to 6s.

Thanks again for your contribution. I've added teacher_dayoff.so to the
CVS repository without changes and I will be adding other modules as
soon as I finish writing TTF test cases for them.

Best regards
Tomaz Solc

- --- ../patches/mymodules/subject_sameroom.c 2004-11-24
04:55:43.000000000 +0100
+++ subject_sameroom.c 2004-11-26 17:57:54.000000000 +0100
@@ -48,7 +48,7 @@
~ for (a=0;a<nsu;a++) {
~ if (sid==su[a]) {
~ flag=0;
- - if (rid != rm[a]) multiroom[a]=1;
+ if (rid != rm[a]) multiroom[a]++;
~ break;
~ }
~ }
@@ -65,7 +65,7 @@
~ // count number of multiroom subjects
~ sum=0;
~ for (a=0;a<nsu;a++) {
- - if (multiroom[a]) sum++;
+ sum+=multiroom[a];
~ }

~ return(sum);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBp2ihsAlAlRhL9q8RAjxOAKCHRYC9LtPpb9gBv7ocdaQq8BupfgCggt4g
nRo0O6TUNmU89cfnUuOXHkY=
=XChz
-----END PGP SIGNATURE-----
Received on Fri Nov 26 18:36:14 2004

This archive was generated by hypermail 2.1.8 : Tue Aug 16 2005 - 20:42:28 CEST