Re: [tablix-list] Tablix 0.2.1 development release

From: Tomaz Solc <tomaz.solcREMOVE@THISsiol.net>
Date: Fri May 06 2005 - 19:47:07 CEST

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

Hi

There was indeed a bug in the new parser that caused event restriction
handlers not to be called in your case. It is now fixed in the CVS version.

On the other hand, your configuration file t3.xml also had an error.

        <event name="Games 4" repeats="4">
                <resource type="teacher" name="NPR"/>
                <resource type="teacher" name="SAH"/>
                <resource type="class" name="1A"/>
                <resource type="class" name="1B"/>
        </event>

You can have only one definition per resource type. I've fixed the
parser so it no longer ignores this type of errors.

        <event name="Choir" repeats="1" preferred-day="3">

"preferred-day" attribute is ignored here.

Your module seems to be working fine now. It had a bug in the
module_fitness function though. Following is the modified function
together with comments what it is actually doing. I hope they are clear
enough to show why the second for loop is not needed to check all events.

int module_fitness(chromo **c, ext **e, slist **s)
{
        int a,m;
        int n;
        int u;
        int sum;
        slist *list;
        chromo *time;

        list=s[0];
        time=c[1];
        
        sum=0;

        // time->gennum is the number of defined tuples. This loop
        // iterates through all tuple IDs
        for(m=0;m<time->gennum;m++)
        {
                // a holds the resource ID of the time slot of the
                // tuple with ID m
                a=time->gen[m];
                
                for(n=0;n<list->tuplenum[a];n++)
                {
                        int b;
                        // b holds the tuple ID of the nth tuple that is
                        // using time slot a
                        b=list->tupleid[a][n];

                        // ADDED THIS
                        // u holds the resource ID of the time slot
                        // that tuple with ID b is using
                        // (same as a)
                        u=time->gen[b];

                        int d,t;
                        // CHANGED b TO u
                        // time->restype->res[u].name is the name
                        // of the resource with ID u and type
                        // "time".
                        sscanf(time->restype->res[u].name, "%d %d", &d, &t);
                        if(pday[b]>-1)
                        {
                                if(d!=pday[b]) sum++;
                        }
                        if(pperiod[b]>-1)
                        {
                                if(t!=pperiod[b]) sum++;
                        }
                }
        }
        
        return(sum);
}

I have just one more remark. This module is practical only when the
"mandatory" option is set to "no". If it is set to "yes", then this
functionality is better implemented by setting resource domains. I'll
write a module demonstrating this approach as soon as possible.

Best regards
Tomaz Solc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCe62asAlAlRhL9q8RAgoJAJ9YWUkG8f0/YBdYn5y0B8RhNkNyXQCgysE/
qVRnCegPwxj4SuoxEU0O4D4=
=JaA8
-----END PGP SIGNATURE-----
Received on Fri May 06 19:40:13 2005

This archive was generated by hypermail 2.1.8 : Tue Aug 16 2005 - 20:43:21 CEST