Back to index

fet  5.18.0
spaceconstraint.h
Go to the documentation of this file.
00001 /*
00002 File spaceconstraint.h
00003 */
00004 
00005 /*
00006 Copyright 2002, 2003 Lalescu Liviu.
00007 
00008 This file is part of FET.
00009 
00010 FET is free software; you can redistribute it and/or modify
00011 it under the terms of the GNU General Public License as published by
00012 the Free Software Foundation; either version 2 of the License, or
00013 (at your option) any later version.
00014 
00015 FET is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with FET; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 */
00024 
00025 #ifndef SPACECONSTRAINT_H
00026 #define SPACECONSTRAINT_H
00027 
00028 #include <QCoreApplication>
00029 
00030 #include "timetable_defs.h"
00031 
00032 #include <QString>
00033 #include <QList>
00034 #include <QStringList>
00035 
00036 class Rules;
00037 class SpaceConstraint;
00038 class Activity;
00039 class Teacher;
00040 class Subject;
00041 class ActivityTag;
00042 class StudentsSet;
00043 class Equipment;
00044 class Building;
00045 class Room;
00046 class Solution;
00047 
00048 class QWidget;
00049 
00050 typedef QList<SpaceConstraint*> SpaceConstraintsList;
00051 
00052 const int CONSTRAINT_GENERIC_SPACE                                                                =1000; //time constraints are beginning from 1
00053 
00054 const int CONSTRAINT_BASIC_COMPULSORY_SPACE                                                       =1001; //space constraints from 1001
00055 const int CONSTRAINT_ROOM_NOT_AVAILABLE_TIMES                                              =1002;
00056 
00057 const int CONSTRAINT_ACTIVITY_PREFERRED_ROOM                                               =1003;
00058 const int CONSTRAINT_ACTIVITY_PREFERRED_ROOMS                                              =1004;
00059 
00060 const int CONSTRAINT_STUDENTS_SET_HOME_ROOM                                                       =1005;
00061 const int CONSTRAINT_STUDENTS_SET_HOME_ROOMS                                               =1006;
00062 
00063 const int CONSTRAINT_TEACHER_HOME_ROOM                                                            =1007;
00064 const int CONSTRAINT_TEACHER_HOME_ROOMS                                                           =1008;
00065 
00066 const int CONSTRAINT_SUBJECT_PREFERRED_ROOM                                                       =1009;
00067 const int CONSTRAINT_SUBJECT_PREFERRED_ROOMS                                               =1010;
00068 const int CONSTRAINT_SUBJECT_ACTIVITY_TAG_PREFERRED_ROOM                            =1011;
00069 const int CONSTRAINT_SUBJECT_ACTIVITY_TAG_PREFERRED_ROOMS                           =1012;
00070 
00071 const int CONSTRAINT_STUDENTS_MAX_BUILDING_CHANGES_PER_DAY                          =1013;
00072 const int CONSTRAINT_STUDENTS_SET_MAX_BUILDING_CHANGES_PER_DAY               =1014;
00073 const int CONSTRAINT_STUDENTS_MAX_BUILDING_CHANGES_PER_WEEK                         =1015;
00074 const int CONSTRAINT_STUDENTS_SET_MAX_BUILDING_CHANGES_PER_WEEK                     =1016;
00075 const int CONSTRAINT_STUDENTS_MIN_GAPS_BETWEEN_BUILDING_CHANGES                     =1017;
00076 const int CONSTRAINT_STUDENTS_SET_MIN_GAPS_BETWEEN_BUILDING_CHANGES          =1018;
00077 
00078 const int CONSTRAINT_TEACHERS_MAX_BUILDING_CHANGES_PER_DAY                          =1019;
00079 const int CONSTRAINT_TEACHER_MAX_BUILDING_CHANGES_PER_DAY                           =1020;
00080 const int CONSTRAINT_TEACHERS_MAX_BUILDING_CHANGES_PER_WEEK                         =1021;
00081 const int CONSTRAINT_TEACHER_MAX_BUILDING_CHANGES_PER_WEEK                          =1022;
00082 const int CONSTRAINT_TEACHERS_MIN_GAPS_BETWEEN_BUILDING_CHANGES                     =1023;
00083 const int CONSTRAINT_TEACHER_MIN_GAPS_BETWEEN_BUILDING_CHANGES               =1024;
00084 
00085 const int CONSTRAINT_ACTIVITY_TAG_PREFERRED_ROOM                                    =1025;
00086 const int CONSTRAINT_ACTIVITY_TAG_PREFERRED_ROOMS                                          =1026;
00087 
00088 const int CONSTRAINT_ACTIVITIES_OCCUPY_MAX_DIFFERENT_ROOMS                          =1027;
00089 
00093 class SpaceConstraint{
00094        Q_DECLARE_TR_FUNCTIONS(SpaceConstraint)
00095        
00096 public:
00100        double weightPercentage;
00101        
00102        bool active;
00103        
00104        QString comments;
00105 
00109        int type;
00110 
00115        SpaceConstraint();
00116        
00117        virtual ~SpaceConstraint()=0;
00118 
00125        SpaceConstraint(double wp);
00126 
00134        virtual double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL)=0;
00135 
00139        virtual QString getXmlDescription(Rules& r)=0;
00140 
00144        virtual bool computeInternalStructure(QWidget* parent, Rules& r)=0;
00145        
00146        virtual bool hasInactiveActivities(Rules& r)=0;
00147 
00151        virtual QString getDescription(Rules& r)=0;
00152 
00156        virtual QString getDetailedDescription(Rules& r)=0;
00157        
00161        virtual bool isRelatedToActivity(Activity* a)=0;
00162 
00166        virtual bool isRelatedToTeacher(Teacher* t)=0;
00167 
00171        virtual bool isRelatedToSubject(Subject* s)=0;
00172 
00176        virtual bool isRelatedToActivityTag(ActivityTag* s)=0;
00177 
00181        virtual bool isRelatedToStudentsSet(Rules& r, StudentsSet* s)=0;
00182 
00186        virtual bool isRelatedToRoom(Room* r)=0;
00187 
00188        virtual bool hasWrongDayOrHour(Rules& r)=0;
00189        virtual bool canRepairWrongDayOrHour(Rules& r)=0;
00190        virtual bool repairWrongDayOrHour(Rules& r)=0;
00191 };
00192 
00197 class ConstraintBasicCompulsorySpace: public SpaceConstraint{
00198        Q_DECLARE_TR_FUNCTIONS(ConstraintBasicCompulsorySpace)
00199        
00200 public:
00201        ConstraintBasicCompulsorySpace();
00202 
00203        ConstraintBasicCompulsorySpace(double wp);
00204 
00205        bool computeInternalStructure(QWidget* parent, Rules& r);
00206 
00207        bool hasInactiveActivities(Rules& r);
00208        
00209        QString getXmlDescription(Rules& r);
00210 
00211        QString getDescription(Rules& r);
00212 
00213        QString getDetailedDescription(Rules& r);
00214 
00215        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00216        
00217        bool isRelatedToActivity(Activity* a);
00218        
00219        bool isRelatedToTeacher(Teacher* t);
00220 
00221        bool isRelatedToSubject(Subject* s);
00222 
00223        bool isRelatedToActivityTag(ActivityTag* s);
00224        
00225        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00226 
00227        bool isRelatedToRoom(Room* r);
00228 
00229        bool hasWrongDayOrHour(Rules& r);
00230        bool canRepairWrongDayOrHour(Rules& r);
00231        bool repairWrongDayOrHour(Rules& r);
00232 };
00233 
00234 class ConstraintRoomNotAvailableTimes: public SpaceConstraint{
00235        Q_DECLARE_TR_FUNCTIONS(ConstraintRoomNotAvailableTimes)
00236        
00237 public:
00238 
00239        QList<int> days;
00240        QList<int> hours;
00241 
00245        QString room;
00246 
00250        int room_ID;
00251 
00252        ConstraintRoomNotAvailableTimes();
00253 
00254        ConstraintRoomNotAvailableTimes(double wp, const QString& rn, QList<int> d, QList<int> h);
00255 
00256        bool computeInternalStructure(QWidget* parent, Rules& r);
00257 
00258        bool hasInactiveActivities(Rules& r);
00259        
00260        QString getXmlDescription(Rules& r);
00261 
00262        QString getDescription(Rules& r);
00263 
00264        QString getDetailedDescription(Rules& r);
00265 
00266        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00267        
00268        bool isRelatedToActivity(Activity* a);
00269        
00270        bool isRelatedToTeacher(Teacher* t);
00271 
00272        bool isRelatedToSubject(Subject* s);
00273 
00274        bool isRelatedToActivityTag(ActivityTag* s);
00275        
00276        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00277 
00278        bool isRelatedToRoom(Room* r);
00279 
00280        bool hasWrongDayOrHour(Rules& r);
00281        bool canRepairWrongDayOrHour(Rules& r);
00282        bool repairWrongDayOrHour(Rules& r);
00283 };
00284 
00289 class ConstraintActivityPreferredRoom: public SpaceConstraint{
00290        Q_DECLARE_TR_FUNCTIONS(ConstraintActivityPreferredRoom)
00291        
00292 public:
00293        
00294        //The activity referred to by this constraint.
00295        //This is an index in the rules internal activities list.
00296        int _activity;
00297        
00298        //The index of the room
00299        int _room; 
00300 
00301        //----------------------------------------------------------
00302 
00303        int activityId;
00304 
00305        QString roomName;
00306        
00307        bool permanentlyLocked;
00308 
00309        ConstraintActivityPreferredRoom();
00310 
00311        ConstraintActivityPreferredRoom(double wp, int aid, const QString& room, bool perm);
00312        
00316        bool operator==(ConstraintActivityPreferredRoom& c);
00317 
00318        bool computeInternalStructure(QWidget* parent, Rules& r);
00319 
00320        bool hasInactiveActivities(Rules& r);
00321        
00322        QString getXmlDescription(Rules& r);
00323 
00324        QString getDescription(Rules& r);
00325 
00326        QString getDetailedDescription(Rules& r);
00327 
00328        //int fitness(Solution& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], QString* conflictsString=NULL);
00329        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00330        
00331        bool isRelatedToActivity(Activity* a);
00332        
00333        bool isRelatedToTeacher(Teacher* t);
00334 
00335        bool isRelatedToSubject(Subject* s);
00336 
00337        bool isRelatedToActivityTag(ActivityTag* s);
00338        
00339        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00340 
00341        bool isRelatedToRoom(Room* r);
00342 
00343        bool hasWrongDayOrHour(Rules& r);
00344        bool canRepairWrongDayOrHour(Rules& r);
00345        bool repairWrongDayOrHour(Rules& r);
00346 };
00347 
00352 class ConstraintActivityPreferredRooms: public SpaceConstraint{
00353        Q_DECLARE_TR_FUNCTIONS(ConstraintActivityPreferredRooms)
00354 
00355 public:
00356        
00357        //The activity referred to by this constraint.
00358        //This is an index in the rules internal activities list.
00359        int _activity;
00360        
00361        //The indexes of the rooms
00362        QList<int> _rooms;
00363 
00364        //----------------------------------------------------------
00365 
00366        int activityId;
00367 
00368        QStringList roomsNames;
00369 
00370        ConstraintActivityPreferredRooms();
00371 
00372        ConstraintActivityPreferredRooms(double wp, int aid, const QStringList& roomsList);
00373 
00374        bool computeInternalStructure(QWidget* parent, Rules& r);
00375 
00376        bool hasInactiveActivities(Rules& r);
00377        
00378        QString getXmlDescription(Rules& r);
00379 
00380        QString getDescription(Rules& r);
00381 
00382        QString getDetailedDescription(Rules& r);
00383 
00384        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00385        
00386        bool isRelatedToActivity(Activity* a);
00387        
00388        bool isRelatedToTeacher(Teacher* t);
00389 
00390        bool isRelatedToSubject(Subject* s);
00391 
00392        bool isRelatedToActivityTag(ActivityTag* s);
00393        
00394        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00395 
00396        bool isRelatedToRoom(Room* r);
00397 
00398        bool hasWrongDayOrHour(Rules& r);
00399        bool canRepairWrongDayOrHour(Rules& r);
00400        bool repairWrongDayOrHour(Rules& r);
00401 };
00402 
00403 class ConstraintStudentsSetHomeRoom: public SpaceConstraint{
00404        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsSetHomeRoom)
00405 
00406 public:
00407 
00408        QList<int> _activities;
00409        
00410        // The index of the room
00411        int _room;
00412        
00413 public:
00414 
00415        QString studentsName;
00416 
00417        QString roomName;
00418 
00419        ConstraintStudentsSetHomeRoom();
00420 
00421        ConstraintStudentsSetHomeRoom(double wp, QString st, QString rm);
00422 
00423        bool computeInternalStructure(QWidget* parent, Rules& r);
00424 
00425        bool hasInactiveActivities(Rules& r);
00426        
00427        QString getXmlDescription(Rules& r);
00428 
00429        QString getDescription(Rules& r);
00430 
00431        QString getDetailedDescription(Rules& r);
00432 
00433        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00434        
00435        bool isRelatedToActivity(Activity* a);
00436        
00437        bool isRelatedToTeacher(Teacher* t);
00438 
00439        bool isRelatedToSubject(Subject* s);
00440 
00441        bool isRelatedToActivityTag(ActivityTag* s);
00442        
00443        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00444 
00445        bool isRelatedToRoom(Room* r);
00446 
00447        bool hasWrongDayOrHour(Rules& r);
00448        bool canRepairWrongDayOrHour(Rules& r);
00449        bool repairWrongDayOrHour(Rules& r);
00450 };
00451 
00452 class ConstraintStudentsSetHomeRooms: public SpaceConstraint{
00453        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsSetHomeRooms)
00454 
00455 public:
00456        
00457        //The list of activities referred to by this constraint.
00458        //This is a list of indices in the rules internal activities list.
00459        QList<int> _activities;
00460        
00461        //The indexes of the rooms
00462        QList<int> _rooms;
00463        
00464 public:
00465 
00466        QString studentsName;
00467 
00468        QStringList roomsNames;
00469 
00470        ConstraintStudentsSetHomeRooms();
00471 
00472        ConstraintStudentsSetHomeRooms(double wp, QString st, const QStringList& rms);
00473 
00474        bool computeInternalStructure(QWidget* parent, Rules& r);
00475 
00476        bool hasInactiveActivities(Rules& r);
00477        
00478        QString getXmlDescription(Rules& r);
00479 
00480        QString getDescription(Rules& r);
00481 
00482        QString getDetailedDescription(Rules& r);
00483 
00484        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00485        
00486        bool isRelatedToActivity(Activity* a);
00487        
00488        bool isRelatedToTeacher(Teacher* t);
00489 
00490        bool isRelatedToSubject(Subject* s);
00491 
00492        bool isRelatedToActivityTag(ActivityTag* s);
00493        
00494        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00495 
00496        bool isRelatedToRoom(Room* r);
00497 
00498        bool hasWrongDayOrHour(Rules& r);
00499        bool canRepairWrongDayOrHour(Rules& r);
00500        bool repairWrongDayOrHour(Rules& r);
00501 };
00502 
00503 class ConstraintTeacherHomeRoom: public SpaceConstraint{
00504        Q_DECLARE_TR_FUNCTIONS(ConstraintTeacherHomeRoom)
00505 
00506 public:
00507 
00508        QList<int> _activities;
00509        
00510        // The index of the room
00511        int _room;
00512        
00513 public:
00514 
00515        QString teacherName;
00516 
00517        QString roomName;
00518 
00519        ConstraintTeacherHomeRoom();
00520 
00521        ConstraintTeacherHomeRoom(double wp, QString tc, QString rm);
00522 
00523        bool computeInternalStructure(QWidget* parent, Rules& r);
00524 
00525        bool hasInactiveActivities(Rules& r);
00526        
00527        QString getXmlDescription(Rules& r);
00528 
00529        QString getDescription(Rules& r);
00530 
00531        QString getDetailedDescription(Rules& r);
00532 
00533        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00534        
00535        bool isRelatedToActivity(Activity* a);
00536        
00537        bool isRelatedToTeacher(Teacher* t);
00538 
00539        bool isRelatedToSubject(Subject* s);
00540 
00541        bool isRelatedToActivityTag(ActivityTag* s);
00542        
00543        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00544 
00545        bool isRelatedToRoom(Room* r);
00546 
00547        bool hasWrongDayOrHour(Rules& r);
00548        bool canRepairWrongDayOrHour(Rules& r);
00549        bool repairWrongDayOrHour(Rules& r);
00550 };
00551 
00552 class ConstraintTeacherHomeRooms: public SpaceConstraint{
00553        Q_DECLARE_TR_FUNCTIONS(ConstraintTeacherHomeRooms)
00554 
00555 public:
00556        
00557        //The list of activities referred to by this constraint.
00558        //This is a list of indices in the rules internal activities list.
00559        QList<int> _activities;
00560        
00561        //The indexes of the rooms
00562        QList<int> _rooms;
00563        
00564 public:
00565 
00566        QString teacherName;
00567 
00568        QStringList roomsNames;
00569 
00570        ConstraintTeacherHomeRooms();
00571 
00572        ConstraintTeacherHomeRooms(double wp, QString st, const QStringList& rms);
00573 
00574        bool computeInternalStructure(QWidget* parent, Rules& r);
00575 
00576        bool hasInactiveActivities(Rules& r);
00577        
00578        QString getXmlDescription(Rules& r);
00579 
00580        QString getDescription(Rules& r);
00581 
00582        QString getDetailedDescription(Rules& r);
00583 
00584        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00585        
00586        bool isRelatedToActivity(Activity* a);
00587        
00588        bool isRelatedToTeacher(Teacher* t);
00589 
00590        bool isRelatedToSubject(Subject* s);
00591 
00592        bool isRelatedToActivityTag(ActivityTag* s);
00593        
00594        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00595 
00596        bool isRelatedToRoom(Room* r);
00597 
00598        bool hasWrongDayOrHour(Rules& r);
00599        bool canRepairWrongDayOrHour(Rules& r);
00600        bool repairWrongDayOrHour(Rules& r);
00601 };
00602 
00607 class ConstraintSubjectPreferredRoom: public SpaceConstraint{
00608        Q_DECLARE_TR_FUNCTIONS(ConstraintSubjectPreferredRoom)
00609 
00610 public:
00611 
00612        QList<int> _activities;
00613        
00614        // The index of the room
00615        int _room;
00616        
00617 public:
00618 
00619        QString subjectName;
00620 
00621        QString roomName;
00622 
00623        ConstraintSubjectPreferredRoom();
00624 
00625        ConstraintSubjectPreferredRoom(double wp, const QString& subj, const QString& rm);
00626 
00627        bool computeInternalStructure(QWidget* parent, Rules& r);
00628 
00629        bool hasInactiveActivities(Rules& r);
00630        
00631        QString getXmlDescription(Rules& r);
00632 
00633        QString getDescription(Rules& r);
00634 
00635        QString getDetailedDescription(Rules& r);
00636 
00637        //int fitness(Solution& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], QString* conflictsString=NULL);
00638        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00639        
00640        bool isRelatedToActivity(Activity* a);
00641        
00642        bool isRelatedToTeacher(Teacher* t);
00643 
00644        bool isRelatedToSubject(Subject* s);
00645 
00646        bool isRelatedToActivityTag(ActivityTag* s);
00647        
00648        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00649 
00650        bool isRelatedToRoom(Room* r);
00651 
00652        bool hasWrongDayOrHour(Rules& r);
00653        bool canRepairWrongDayOrHour(Rules& r);
00654        bool repairWrongDayOrHour(Rules& r);
00655 };
00656 
00661 class ConstraintSubjectPreferredRooms: public SpaceConstraint{
00662        Q_DECLARE_TR_FUNCTIONS(ConstraintSubjectPreferredRooms)
00663 
00664 public:
00665 
00666        QList<int> _activities;
00667        
00668        QList<int> _rooms;
00669        
00670 public:
00671 
00672        QString subjectName;
00673 
00674        QStringList roomsNames;
00675 
00676        ConstraintSubjectPreferredRooms();
00677 
00678        ConstraintSubjectPreferredRooms(double wp, const QString& subj, const QStringList& rms);
00679 
00680        bool computeInternalStructure(QWidget* parent, Rules& r);
00681 
00682        bool hasInactiveActivities(Rules& r);
00683        
00684        QString getXmlDescription(Rules& r);
00685 
00686        QString getDescription(Rules& r);
00687 
00688        QString getDetailedDescription(Rules& r);
00689 
00690        //int fitness(Solution& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], QString* conflictsString=NULL);
00691        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00692        
00693        bool isRelatedToActivity(Activity* a);
00694        
00695        bool isRelatedToTeacher(Teacher* t);
00696 
00697        bool isRelatedToSubject(Subject* s);
00698 
00699        bool isRelatedToActivityTag(ActivityTag* s);
00700        
00701        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00702 
00703        bool isRelatedToRoom(Room* r);
00704 
00705        bool hasWrongDayOrHour(Rules& r);
00706        bool canRepairWrongDayOrHour(Rules& r);
00707        bool repairWrongDayOrHour(Rules& r);
00708 };
00709 
00714 class ConstraintSubjectActivityTagPreferredRoom: public SpaceConstraint{
00715        Q_DECLARE_TR_FUNCTIONS(ConstraintSubjectActivityTagPreferredRoom)
00716 
00717 public:
00718 
00719        QList<int> _activities;
00720        
00721        // The index of the room
00722        int _room;
00723        
00724 public:
00725 
00726        QString subjectName;
00727 
00728        QString activityTagName;
00729 
00730        QString roomName;
00731 
00732        ConstraintSubjectActivityTagPreferredRoom();
00733 
00734        ConstraintSubjectActivityTagPreferredRoom(double wp, const QString& subj, const QString& actTag, const QString& rm);
00735 
00736        bool computeInternalStructure(QWidget* parent, Rules& r);
00737 
00738        bool hasInactiveActivities(Rules& r);
00739        
00740        QString getXmlDescription(Rules& r);
00741 
00742        QString getDescription(Rules& r);
00743 
00744        QString getDetailedDescription(Rules& r);
00745 
00746        //int fitness(Solution& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], QString* conflictsString=NULL);
00747        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00748        
00749        bool isRelatedToActivity(Activity* a);
00750        
00751        bool isRelatedToTeacher(Teacher* t);
00752 
00753        bool isRelatedToSubject(Subject* s);
00754 
00755        bool isRelatedToActivityTag(ActivityTag* s);
00756        
00757        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00758 
00759        bool isRelatedToRoom(Room* r);
00760 
00761        bool hasWrongDayOrHour(Rules& r);
00762        bool canRepairWrongDayOrHour(Rules& r);
00763        bool repairWrongDayOrHour(Rules& r);
00764 };
00765 
00770 class ConstraintSubjectActivityTagPreferredRooms: public SpaceConstraint{
00771        Q_DECLARE_TR_FUNCTIONS(ConstraintSubjectActivityTagPreferredRooms)
00772 
00773 public:
00774        
00775        QList<int> _activities;
00776        
00777        QList<int> _rooms;
00778 
00779 public:
00780 
00781        QString subjectName;
00782 
00783        QString activityTagName;
00784 
00785        QStringList roomsNames;
00786 
00787        ConstraintSubjectActivityTagPreferredRooms();
00788 
00789        ConstraintSubjectActivityTagPreferredRooms(double wp, const QString& subj, const QString& actTag, const QStringList& rms);
00790 
00791        bool computeInternalStructure(QWidget* parent, Rules& r);
00792 
00793        bool hasInactiveActivities(Rules& r);
00794        
00795        QString getXmlDescription(Rules& r);
00796 
00797        QString getDescription(Rules& r);
00798 
00799        QString getDetailedDescription(Rules& r);
00800 
00801        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00802        
00803        bool isRelatedToActivity(Activity* a);
00804        
00805        bool isRelatedToTeacher(Teacher* t);
00806 
00807        bool isRelatedToSubject(Subject* s);
00808 
00809        bool isRelatedToActivityTag(ActivityTag* s);
00810        
00811        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00812 
00813        bool isRelatedToRoom(Room* r);
00814 
00815        bool hasWrongDayOrHour(Rules& r);
00816        bool canRepairWrongDayOrHour(Rules& r);
00817        bool repairWrongDayOrHour(Rules& r);
00818 };
00819 
00820 //addded on 6 apr 2009
00821 class ConstraintActivityTagPreferredRoom: public SpaceConstraint{
00822        Q_DECLARE_TR_FUNCTIONS(ConstraintActivityTagPreferredRoom)
00823        
00824 public:
00825 
00826        QList<int> _activities;
00827        
00828        // The index of the room
00829        int _room;
00830        
00831 public:
00832 
00833        QString activityTagName;
00834 
00835        QString roomName;
00836 
00837        ConstraintActivityTagPreferredRoom();
00838 
00839        ConstraintActivityTagPreferredRoom(double wp, const QString& actTag, const QString& rm);
00840 
00841        bool computeInternalStructure(QWidget* parent, Rules& r);
00842 
00843        bool hasInactiveActivities(Rules& r);
00844        
00845        QString getXmlDescription(Rules& r);
00846 
00847        QString getDescription(Rules& r);
00848 
00849        QString getDetailedDescription(Rules& r);
00850 
00851        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00852        
00853        bool isRelatedToActivity(Activity* a);
00854        
00855        bool isRelatedToTeacher(Teacher* t);
00856 
00857        bool isRelatedToSubject(Subject* s);
00858 
00859        bool isRelatedToActivityTag(ActivityTag* s);
00860        
00861        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00862 
00863        bool isRelatedToRoom(Room* r);
00864 
00865        bool hasWrongDayOrHour(Rules& r);
00866        bool canRepairWrongDayOrHour(Rules& r);
00867        bool repairWrongDayOrHour(Rules& r);
00868 };
00869 
00870 class ConstraintActivityTagPreferredRooms: public SpaceConstraint{
00871        Q_DECLARE_TR_FUNCTIONS(ConstraintActivityTagPreferredRooms)
00872 
00873 public:
00874        
00875        QList<int> _activities;
00876        
00877        QList<int> _rooms;
00878 
00879 public:
00880 
00881        QString activityTagName;
00882 
00883        QStringList roomsNames;
00884 
00885        ConstraintActivityTagPreferredRooms();
00886 
00887        ConstraintActivityTagPreferredRooms(double wp, const QString& actTag, const QStringList& rms);
00888 
00889        bool computeInternalStructure(QWidget* parent, Rules& r);
00890 
00891        bool hasInactiveActivities(Rules& r);
00892        
00893        QString getXmlDescription(Rules& r);
00894 
00895        QString getDescription(Rules& r);
00896 
00897        QString getDetailedDescription(Rules& r);
00898 
00899        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00900        
00901        bool isRelatedToActivity(Activity* a);
00902        
00903        bool isRelatedToTeacher(Teacher* t);
00904 
00905        bool isRelatedToSubject(Subject* s);
00906 
00907        bool isRelatedToActivityTag(ActivityTag* s);
00908        
00909        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00910 
00911        bool isRelatedToRoom(Room* r);
00912 
00913        bool hasWrongDayOrHour(Rules& r);
00914        bool canRepairWrongDayOrHour(Rules& r);
00915        bool repairWrongDayOrHour(Rules& r);
00916 };
00918 
00919 class ConstraintStudentsSetMaxBuildingChangesPerDay: public SpaceConstraint{
00920        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsSetMaxBuildingChangesPerDay)
00921 
00922 public:
00923        //internal variables
00924        QList<int> iSubgroupsList;
00925 
00926 public:
00927 
00928        int maxBuildingChangesPerDay;
00929 
00930        QString studentsName;
00931 
00932        ConstraintStudentsSetMaxBuildingChangesPerDay();
00933 
00934        ConstraintStudentsSetMaxBuildingChangesPerDay(double wp, QString st, int mc);
00935 
00936        bool computeInternalStructure(QWidget* parent, Rules& r);
00937 
00938        QString getXmlDescription(Rules& r);
00939 
00940        bool hasInactiveActivities(Rules& r);
00941        
00942        QString getDescription(Rules& r);
00943 
00944        QString getDetailedDescription(Rules& r);
00945 
00946        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00947        
00948        bool isRelatedToActivity(Activity* a);
00949        
00950        bool isRelatedToTeacher(Teacher* t);
00951 
00952        bool isRelatedToSubject(Subject* s);
00953 
00954        bool isRelatedToActivityTag(ActivityTag* s);
00955        
00956        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00957 
00958        bool isRelatedToRoom(Room* r);
00959 
00960        bool hasWrongDayOrHour(Rules& r);
00961        bool canRepairWrongDayOrHour(Rules& r);
00962        bool repairWrongDayOrHour(Rules& r);
00963 };
00964 
00965 class ConstraintStudentsMaxBuildingChangesPerDay: public SpaceConstraint{
00966        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsMaxBuildingChangesPerDay)
00967 
00968 public:
00969 
00970        int maxBuildingChangesPerDay;
00971 
00972        ConstraintStudentsMaxBuildingChangesPerDay();
00973 
00974        ConstraintStudentsMaxBuildingChangesPerDay(double wp, int mc);
00975 
00976        bool computeInternalStructure(QWidget* parent, Rules& r);
00977 
00978        QString getXmlDescription(Rules& r);
00979 
00980        bool hasInactiveActivities(Rules& r);
00981        
00982        QString getDescription(Rules& r);
00983 
00984        QString getDetailedDescription(Rules& r);
00985 
00986        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
00987        
00988        bool isRelatedToActivity(Activity* a);
00989        
00990        bool isRelatedToTeacher(Teacher* t);
00991 
00992        bool isRelatedToSubject(Subject* s);
00993 
00994        bool isRelatedToActivityTag(ActivityTag* s);
00995        
00996        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
00997 
00998        bool isRelatedToRoom(Room* r);
00999 
01000        bool hasWrongDayOrHour(Rules& r);
01001        bool canRepairWrongDayOrHour(Rules& r);
01002        bool repairWrongDayOrHour(Rules& r);
01003 };
01004 
01005 class ConstraintStudentsSetMaxBuildingChangesPerWeek: public SpaceConstraint{
01006        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsSetMaxBuildingChangesPerWeek)
01007 
01008 public:
01009        //internal variables
01010        QList<int> iSubgroupsList;
01011 
01012 public:
01013 
01014        int maxBuildingChangesPerWeek;
01015 
01016        QString studentsName;
01017 
01018        ConstraintStudentsSetMaxBuildingChangesPerWeek();
01019 
01020        ConstraintStudentsSetMaxBuildingChangesPerWeek(double wp, QString st, int mc);
01021 
01022        bool computeInternalStructure(QWidget* parent, Rules& r);
01023 
01024        QString getXmlDescription(Rules& r);
01025 
01026        bool hasInactiveActivities(Rules& r);
01027        
01028        QString getDescription(Rules& r);
01029 
01030        QString getDetailedDescription(Rules& r);
01031 
01032        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01033        
01034        bool isRelatedToActivity(Activity* a);
01035        
01036        bool isRelatedToTeacher(Teacher* t);
01037 
01038        bool isRelatedToSubject(Subject* s);
01039 
01040        bool isRelatedToActivityTag(ActivityTag* s);
01041        
01042        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01043 
01044        bool isRelatedToRoom(Room* r);
01045 
01046        bool hasWrongDayOrHour(Rules& r);
01047        bool canRepairWrongDayOrHour(Rules& r);
01048        bool repairWrongDayOrHour(Rules& r);
01049 };
01050 
01051 class ConstraintStudentsMaxBuildingChangesPerWeek: public SpaceConstraint{
01052        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsMaxBuildingChangesPerWeek)
01053 
01054 public:
01055 
01056        int maxBuildingChangesPerWeek;
01057 
01058        ConstraintStudentsMaxBuildingChangesPerWeek();
01059 
01060        ConstraintStudentsMaxBuildingChangesPerWeek(double wp, int mc);
01061 
01062        bool computeInternalStructure(QWidget* parent, Rules& r);
01063 
01064        QString getXmlDescription(Rules& r);
01065 
01066        bool hasInactiveActivities(Rules& r);
01067        
01068        QString getDescription(Rules& r);
01069 
01070        QString getDetailedDescription(Rules& r);
01071 
01072        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01073        
01074        bool isRelatedToActivity(Activity* a);
01075        
01076        bool isRelatedToTeacher(Teacher* t);
01077 
01078        bool isRelatedToSubject(Subject* s);
01079 
01080        bool isRelatedToActivityTag(ActivityTag* s);
01081        
01082        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01083 
01084        bool isRelatedToRoom(Room* r);
01085 
01086        bool hasWrongDayOrHour(Rules& r);
01087        bool canRepairWrongDayOrHour(Rules& r);
01088        bool repairWrongDayOrHour(Rules& r);
01089 };
01090 
01091 class ConstraintStudentsSetMinGapsBetweenBuildingChanges: public SpaceConstraint{
01092        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsSetMinGapsBetweenBuildingChanges)
01093 
01094 public:
01095        //internal variables
01096        QList<int> iSubgroupsList;
01097 
01098 public:
01099 
01100        int minGapsBetweenBuildingChanges;
01101 
01102        QString studentsName;
01103 
01104        ConstraintStudentsSetMinGapsBetweenBuildingChanges();
01105 
01106        ConstraintStudentsSetMinGapsBetweenBuildingChanges(double wp, QString st, int mg);
01107 
01108        bool computeInternalStructure(QWidget* parent, Rules& r);
01109 
01110        QString getXmlDescription(Rules& r);
01111 
01112        bool hasInactiveActivities(Rules& r);
01113        
01114        QString getDescription(Rules& r);
01115 
01116        QString getDetailedDescription(Rules& r);
01117 
01118        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01119        
01120        bool isRelatedToActivity(Activity* a);
01121        
01122        bool isRelatedToTeacher(Teacher* t);
01123 
01124        bool isRelatedToSubject(Subject* s);
01125 
01126        bool isRelatedToActivityTag(ActivityTag* s);
01127        
01128        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01129 
01130        bool isRelatedToRoom(Room* r);
01131 
01132        bool hasWrongDayOrHour(Rules& r);
01133        bool canRepairWrongDayOrHour(Rules& r);
01134        bool repairWrongDayOrHour(Rules& r);
01135 };
01136 
01137 class ConstraintStudentsMinGapsBetweenBuildingChanges: public SpaceConstraint{
01138        Q_DECLARE_TR_FUNCTIONS(ConstraintStudentsMinGapsBetweenBuildingChanges)
01139 
01140 public:
01141 
01142        int minGapsBetweenBuildingChanges;
01143 
01144        ConstraintStudentsMinGapsBetweenBuildingChanges();
01145 
01146        ConstraintStudentsMinGapsBetweenBuildingChanges(double wp, int mg);
01147 
01148        bool computeInternalStructure(QWidget* parent, Rules& r);
01149 
01150        QString getXmlDescription(Rules& r);
01151 
01152        bool hasInactiveActivities(Rules& r);
01153        
01154        QString getDescription(Rules& r);
01155 
01156        QString getDetailedDescription(Rules& r);
01157 
01158        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01159        
01160        bool isRelatedToActivity(Activity* a);
01161        
01162        bool isRelatedToTeacher(Teacher* t);
01163 
01164        bool isRelatedToSubject(Subject* s);
01165 
01166        bool isRelatedToActivityTag(ActivityTag* s);
01167        
01168        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01169 
01170        bool isRelatedToRoom(Room* r);
01171 
01172        bool hasWrongDayOrHour(Rules& r);
01173        bool canRepairWrongDayOrHour(Rules& r);
01174        bool repairWrongDayOrHour(Rules& r);
01175 };
01176 
01177 class ConstraintTeacherMaxBuildingChangesPerDay: public SpaceConstraint{
01178        Q_DECLARE_TR_FUNCTIONS(ConstraintTeacherMaxBuildingChangesPerDay)
01179 
01180 public:
01181        //internal variables
01182        int teacher_ID;
01183 
01184 public:
01185 
01186        int maxBuildingChangesPerDay;
01187 
01188        QString teacherName;
01189 
01190        ConstraintTeacherMaxBuildingChangesPerDay();
01191 
01192        ConstraintTeacherMaxBuildingChangesPerDay(double wp, QString tc, int mc);
01193 
01194        bool computeInternalStructure(QWidget* parent, Rules& r);
01195 
01196        QString getXmlDescription(Rules& r);
01197 
01198        bool hasInactiveActivities(Rules& r);
01199        
01200        QString getDescription(Rules& r);
01201 
01202        QString getDetailedDescription(Rules& r);
01203 
01204        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01205        
01206        bool isRelatedToActivity(Activity* a);
01207        
01208        bool isRelatedToTeacher(Teacher* t);
01209 
01210        bool isRelatedToSubject(Subject* s);
01211 
01212        bool isRelatedToActivityTag(ActivityTag* s);
01213        
01214        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01215 
01216        bool isRelatedToRoom(Room* r);
01217 
01218        bool hasWrongDayOrHour(Rules& r);
01219        bool canRepairWrongDayOrHour(Rules& r);
01220        bool repairWrongDayOrHour(Rules& r);
01221 };
01222 
01223 class ConstraintTeachersMaxBuildingChangesPerDay: public SpaceConstraint{
01224        Q_DECLARE_TR_FUNCTIONS(ConstraintTeachersMaxBuildingChangesPerDay)
01225 
01226 public:
01227 
01228        int maxBuildingChangesPerDay;
01229 
01230        ConstraintTeachersMaxBuildingChangesPerDay();
01231 
01232        ConstraintTeachersMaxBuildingChangesPerDay(double wp, int mc);
01233 
01234        bool computeInternalStructure(QWidget* parent, Rules& r);
01235 
01236        bool hasInactiveActivities(Rules& r);
01237        
01238        QString getXmlDescription(Rules& r);
01239 
01240        QString getDescription(Rules& r);
01241 
01242        QString getDetailedDescription(Rules& r);
01243 
01244        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01245        
01246        bool isRelatedToActivity(Activity* a);
01247        
01248        bool isRelatedToTeacher(Teacher* t);
01249 
01250        bool isRelatedToSubject(Subject* s);
01251 
01252        bool isRelatedToActivityTag(ActivityTag* s);
01253        
01254        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01255 
01256        bool isRelatedToRoom(Room* r);
01257 
01258        bool hasWrongDayOrHour(Rules& r);
01259        bool canRepairWrongDayOrHour(Rules& r);
01260        bool repairWrongDayOrHour(Rules& r);
01261 };
01262 
01263 class ConstraintTeacherMaxBuildingChangesPerWeek: public SpaceConstraint{
01264        Q_DECLARE_TR_FUNCTIONS(ConstraintTeacherMaxBuildingChangesPerWeek)
01265 
01266 public:
01267        //internal variables
01268        int teacher_ID;
01269 
01270 public:
01271 
01272        int maxBuildingChangesPerWeek;
01273 
01274        QString teacherName;
01275 
01276        ConstraintTeacherMaxBuildingChangesPerWeek();
01277 
01278        ConstraintTeacherMaxBuildingChangesPerWeek(double wp, QString tc, int mc);
01279 
01280        bool computeInternalStructure(QWidget* parent, Rules& r);
01281 
01282        bool hasInactiveActivities(Rules& r);
01283        
01284        QString getXmlDescription(Rules& r);
01285 
01286        QString getDescription(Rules& r);
01287 
01288        QString getDetailedDescription(Rules& r);
01289 
01290        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01291        
01292        bool isRelatedToActivity(Activity* a);
01293        
01294        bool isRelatedToTeacher(Teacher* t);
01295 
01296        bool isRelatedToSubject(Subject* s);
01297 
01298        bool isRelatedToActivityTag(ActivityTag* s);
01299        
01300        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01301 
01302        bool isRelatedToRoom(Room* r);
01303 
01304        bool hasWrongDayOrHour(Rules& r);
01305        bool canRepairWrongDayOrHour(Rules& r);
01306        bool repairWrongDayOrHour(Rules& r);
01307 };
01308 
01309 class ConstraintTeachersMaxBuildingChangesPerWeek: public SpaceConstraint{
01310        Q_DECLARE_TR_FUNCTIONS(ConstraintTeachersMaxBuildingChangesPerWeek)
01311 
01312 public:
01313 
01314        int maxBuildingChangesPerWeek;
01315 
01316        ConstraintTeachersMaxBuildingChangesPerWeek();
01317 
01318        ConstraintTeachersMaxBuildingChangesPerWeek(double wp, int mc);
01319 
01320        bool computeInternalStructure(QWidget* parent, Rules& r);
01321 
01322        bool hasInactiveActivities(Rules& r);
01323        
01324        QString getXmlDescription(Rules& r);
01325 
01326        QString getDescription(Rules& r);
01327 
01328        QString getDetailedDescription(Rules& r);
01329 
01330        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01331        
01332        bool isRelatedToActivity(Activity* a);
01333        
01334        bool isRelatedToTeacher(Teacher* t);
01335 
01336        bool isRelatedToSubject(Subject* s);
01337 
01338        bool isRelatedToActivityTag(ActivityTag* s);
01339        
01340        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01341 
01342        bool isRelatedToRoom(Room* r);
01343 
01344        bool hasWrongDayOrHour(Rules& r);
01345        bool canRepairWrongDayOrHour(Rules& r);
01346        bool repairWrongDayOrHour(Rules& r);
01347 };
01348 
01349 class ConstraintTeacherMinGapsBetweenBuildingChanges: public SpaceConstraint{
01350        Q_DECLARE_TR_FUNCTIONS(ConstraintTeacherMinGapsBetweenBuildingChanges)
01351 
01352 public:
01353        //internal variables
01354        int teacher_ID;
01355 
01356 public:
01357 
01358        int minGapsBetweenBuildingChanges;
01359 
01360        QString teacherName;
01361 
01362        ConstraintTeacherMinGapsBetweenBuildingChanges();
01363 
01364        ConstraintTeacherMinGapsBetweenBuildingChanges(double wp, QString tc, int mg);
01365 
01366        bool computeInternalStructure(QWidget* parent, Rules& r);
01367 
01368        bool hasInactiveActivities(Rules& r);
01369        
01370        QString getXmlDescription(Rules& r);
01371 
01372        QString getDescription(Rules& r);
01373 
01374        QString getDetailedDescription(Rules& r);
01375 
01376        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01377        
01378        bool isRelatedToActivity(Activity* a);
01379        
01380        bool isRelatedToTeacher(Teacher* t);
01381 
01382        bool isRelatedToSubject(Subject* s);
01383 
01384        bool isRelatedToActivityTag(ActivityTag* s);
01385        
01386        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01387 
01388        bool isRelatedToRoom(Room* r);
01389 
01390        bool hasWrongDayOrHour(Rules& r);
01391        bool canRepairWrongDayOrHour(Rules& r);
01392        bool repairWrongDayOrHour(Rules& r);
01393 };
01394 
01395 class ConstraintTeachersMinGapsBetweenBuildingChanges: public SpaceConstraint{
01396        Q_DECLARE_TR_FUNCTIONS(ConstraintTeachersMinGapsBetweenBuildingChanges)
01397 
01398 public:
01399 
01400        int minGapsBetweenBuildingChanges;
01401 
01402        ConstraintTeachersMinGapsBetweenBuildingChanges();
01403 
01404        ConstraintTeachersMinGapsBetweenBuildingChanges(double wp, int mg);
01405 
01406        bool computeInternalStructure(QWidget* parent, Rules& r);
01407 
01408        bool hasInactiveActivities(Rules& r);
01409        
01410        QString getXmlDescription(Rules& r);
01411 
01412        QString getDescription(Rules& r);
01413 
01414        QString getDetailedDescription(Rules& r);
01415 
01416        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
01417        
01418        bool isRelatedToActivity(Activity* a);
01419        
01420        bool isRelatedToTeacher(Teacher* t);
01421 
01422        bool isRelatedToSubject(Subject* s);
01423 
01424        bool isRelatedToActivityTag(ActivityTag* s);
01425        
01426        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01427 
01428        bool isRelatedToRoom(Room* r);
01429 
01430        bool hasWrongDayOrHour(Rules& r);
01431        bool canRepairWrongDayOrHour(Rules& r);
01432        bool repairWrongDayOrHour(Rules& r);
01433 };
01434 
01435 class ConstraintActivitiesOccupyMaxDifferentRooms: public SpaceConstraint{
01436        Q_DECLARE_TR_FUNCTIONS(ConstraintActivitiesOccupyMaxDifferentRooms)
01437 
01438 public:
01439        QList<int> activitiesIds;
01440        
01441        int maxDifferentRooms;
01442 
01443        //internal variables
01444        QList<int> _activitiesIndices;
01445 
01446        ConstraintActivitiesOccupyMaxDifferentRooms();
01447 
01448        ConstraintActivitiesOccupyMaxDifferentRooms(double wp, QList<int> a_L, int max_rooms);
01449 
01450        bool computeInternalStructure(QWidget* parent, Rules& r);
01451 
01452        bool hasInactiveActivities(Rules& r);
01453 
01454        QString getXmlDescription(Rules& r);
01455 
01456        QString getDescription(Rules& r);
01457 
01458        QString getDetailedDescription(Rules& r);
01459 
01460        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>&dl, QString* conflictsString=NULL);
01461 
01462        void removeUseless(Rules& r);
01463 
01464        bool isRelatedToActivity(Activity* a);
01465        
01466        bool isRelatedToTeacher(Teacher* t);
01467 
01468        bool isRelatedToSubject(Subject* s);
01469 
01470        bool isRelatedToActivityTag(ActivityTag* s);
01471        
01472        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
01473 
01474        bool isRelatedToRoom(Room* r);
01475 
01476        bool hasWrongDayOrHour(Rules& r);
01477        bool canRepairWrongDayOrHour(Rules& r);
01478        bool repairWrongDayOrHour(Rules& r);
01479 };
01480 
01481 #endif