334
332
QString getDetailedDescription(Rules& r);
336
//int fitness(Solution& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], QString* conflictsString=NULL);
337
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
339
bool isRelatedToActivity(Activity* a);
341
bool isRelatedToTeacher(Teacher* t);
343
bool isRelatedToSubject(Subject* s);
345
bool isRelatedToSubjectTag(SubjectTag* s);
334
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
336
bool isRelatedToActivity(Activity* a);
338
bool isRelatedToTeacher(Teacher* t);
340
bool isRelatedToSubject(Subject* s);
342
bool isRelatedToActivityTag(ActivityTag* s);
344
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
346
bool isRelatedToRoom(Room* r);
349
class ConstraintStudentsSetHomeRoom: public SpaceConstraint{
352
QList<int> _activities;
354
// The index of the room
359
QString studentsName;
363
ConstraintStudentsSetHomeRoom();
365
ConstraintStudentsSetHomeRoom(double wp, QString st, QString rm);
367
bool computeInternalStructure(Rules& r);
369
QString getXmlDescription(Rules& r);
371
QString getDescription(Rules& r);
373
QString getDetailedDescription(Rules& r);
375
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
377
bool isRelatedToActivity(Activity* a);
379
bool isRelatedToTeacher(Teacher* t);
381
bool isRelatedToSubject(Subject* s);
383
bool isRelatedToActivityTag(ActivityTag* s);
385
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
387
bool isRelatedToRoom(Room* r);
390
class ConstraintStudentsSetHomeRooms: public SpaceConstraint{
393
//The list of activities referred to by this constraint.
394
//This is a list of indices in the rules internal activities list.
395
QList<int> _activities;
397
//The indexes of the rooms
402
QString studentsName;
404
QStringList roomsNames;
406
ConstraintStudentsSetHomeRooms();
408
ConstraintStudentsSetHomeRooms(double wp, QString st, const QStringList& rms);
410
bool computeInternalStructure(Rules& r);
412
QString getXmlDescription(Rules& r);
414
QString getDescription(Rules& r);
416
QString getDetailedDescription(Rules& r);
418
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
420
bool isRelatedToActivity(Activity* a);
422
bool isRelatedToTeacher(Teacher* t);
424
bool isRelatedToSubject(Subject* s);
426
bool isRelatedToActivityTag(ActivityTag* s);
428
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
430
bool isRelatedToRoom(Room* r);
433
class ConstraintTeacherHomeRoom: public SpaceConstraint{
436
QList<int> _activities;
438
// The index of the room
447
ConstraintTeacherHomeRoom();
449
ConstraintTeacherHomeRoom(double wp, QString tc, QString rm);
451
bool computeInternalStructure(Rules& r);
453
QString getXmlDescription(Rules& r);
455
QString getDescription(Rules& r);
457
QString getDetailedDescription(Rules& r);
459
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
461
bool isRelatedToActivity(Activity* a);
463
bool isRelatedToTeacher(Teacher* t);
465
bool isRelatedToSubject(Subject* s);
467
bool isRelatedToActivityTag(ActivityTag* s);
469
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
471
bool isRelatedToRoom(Room* r);
474
class ConstraintTeacherHomeRooms: public SpaceConstraint{
477
//The list of activities referred to by this constraint.
478
//This is a list of indices in the rules internal activities list.
479
QList<int> _activities;
481
//The indexes of the rooms
488
QStringList roomsNames;
490
ConstraintTeacherHomeRooms();
492
ConstraintTeacherHomeRooms(double wp, QString st, const QStringList& rms);
494
bool computeInternalStructure(Rules& r);
496
QString getXmlDescription(Rules& r);
498
QString getDescription(Rules& r);
500
QString getDetailedDescription(Rules& r);
502
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
504
bool isRelatedToActivity(Activity* a);
506
bool isRelatedToTeacher(Teacher* t);
508
bool isRelatedToSubject(Subject* s);
510
bool isRelatedToActivityTag(ActivityTag* s);
347
512
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
511
657
This is a constraint. Its purpose: a subject+subject tag must be taught in
514
class ConstraintSubjectSubjectTagPreferredRooms: public SpaceConstraint{
660
class ConstraintSubjectActivityTagPreferredRooms: public SpaceConstraint{
517
//The number of activities referred to by this constraint
663
QList<int> _activities;
520
//The list of activities referred to by this constraint.
521
//This is a list of indices in the rules internal activities list.
522
int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT_SUBJECT_TAG];
524
//The number of preferred rooms
525
int _n_preferred_rooms;
527
//The indexes of the rooms
528
int _rooms[MAX_CONSTRAINT_SUBJECT_SUBJECT_TAG_PREFERRED_ROOMS];
532
669
QString subjectName;
534
QString subjectTagName;
671
QString activityTagName;
536
673
QStringList roomsNames;
538
ConstraintSubjectSubjectTagPreferredRooms();
540
ConstraintSubjectSubjectTagPreferredRooms(double wp, const QString& subj, const QString& subjTag, const QStringList& rms);
542
bool computeInternalStructure(Rules& r);
544
QString getXmlDescription(Rules& r);
546
QString getDescription(Rules& r);
548
QString getDetailedDescription(Rules& r);
550
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
552
bool isRelatedToActivity(Activity* a);
554
bool isRelatedToTeacher(Teacher* t);
556
bool isRelatedToSubject(Subject* s);
558
bool isRelatedToSubjectTag(SubjectTag* s);
560
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
562
bool isRelatedToRoom(Room* r);
675
ConstraintSubjectActivityTagPreferredRooms();
677
ConstraintSubjectActivityTagPreferredRooms(double wp, const QString& subj, const QString& actTag, const QStringList& rms);
679
bool computeInternalStructure(Rules& r);
681
QString getXmlDescription(Rules& r);
683
QString getDescription(Rules& r);
685
QString getDetailedDescription(Rules& r);
687
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
689
bool isRelatedToActivity(Activity* a);
691
bool isRelatedToTeacher(Teacher* t);
693
bool isRelatedToSubject(Subject* s);
695
bool isRelatedToActivityTag(ActivityTag* s);
697
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
699
bool isRelatedToRoom(Room* r);
702
class ConstraintStudentsSetMaxBuildingChangesPerDay: public SpaceConstraint{
705
QList<int> iSubgroupsList;
709
int maxBuildingChangesPerDay;
711
QString studentsName;
713
ConstraintStudentsSetMaxBuildingChangesPerDay();
715
ConstraintStudentsSetMaxBuildingChangesPerDay(double wp, QString st, int mc);
717
bool computeInternalStructure(Rules& r);
719
QString getXmlDescription(Rules& r);
721
QString getDescription(Rules& r);
723
QString getDetailedDescription(Rules& r);
725
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
727
bool isRelatedToActivity(Activity* a);
729
bool isRelatedToTeacher(Teacher* t);
731
bool isRelatedToSubject(Subject* s);
733
bool isRelatedToActivityTag(ActivityTag* s);
735
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
737
bool isRelatedToRoom(Room* r);
740
class ConstraintStudentsMaxBuildingChangesPerDay: public SpaceConstraint{
743
int maxBuildingChangesPerDay;
745
ConstraintStudentsMaxBuildingChangesPerDay();
747
ConstraintStudentsMaxBuildingChangesPerDay(double wp, int mc);
749
bool computeInternalStructure(Rules& r);
751
QString getXmlDescription(Rules& r);
753
QString getDescription(Rules& r);
755
QString getDetailedDescription(Rules& r);
757
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
759
bool isRelatedToActivity(Activity* a);
761
bool isRelatedToTeacher(Teacher* t);
763
bool isRelatedToSubject(Subject* s);
765
bool isRelatedToActivityTag(ActivityTag* s);
767
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
769
bool isRelatedToRoom(Room* r);
772
class ConstraintStudentsSetMaxBuildingChangesPerWeek: public SpaceConstraint{
775
QList<int> iSubgroupsList;
779
int maxBuildingChangesPerWeek;
781
QString studentsName;
783
ConstraintStudentsSetMaxBuildingChangesPerWeek();
785
ConstraintStudentsSetMaxBuildingChangesPerWeek(double wp, QString st, int mc);
787
bool computeInternalStructure(Rules& r);
789
QString getXmlDescription(Rules& r);
791
QString getDescription(Rules& r);
793
QString getDetailedDescription(Rules& r);
795
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
797
bool isRelatedToActivity(Activity* a);
799
bool isRelatedToTeacher(Teacher* t);
801
bool isRelatedToSubject(Subject* s);
803
bool isRelatedToActivityTag(ActivityTag* s);
805
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
807
bool isRelatedToRoom(Room* r);
810
class ConstraintStudentsMaxBuildingChangesPerWeek: public SpaceConstraint{
813
int maxBuildingChangesPerWeek;
815
ConstraintStudentsMaxBuildingChangesPerWeek();
817
ConstraintStudentsMaxBuildingChangesPerWeek(double wp, int mc);
819
bool computeInternalStructure(Rules& r);
821
QString getXmlDescription(Rules& r);
823
QString getDescription(Rules& r);
825
QString getDetailedDescription(Rules& r);
827
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
829
bool isRelatedToActivity(Activity* a);
831
bool isRelatedToTeacher(Teacher* t);
833
bool isRelatedToSubject(Subject* s);
835
bool isRelatedToActivityTag(ActivityTag* s);
837
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
839
bool isRelatedToRoom(Room* r);
842
class ConstraintStudentsSetMinGapsBetweenBuildingChanges: public SpaceConstraint{
845
QList<int> iSubgroupsList;
849
int minGapsBetweenBuildingChanges;
851
QString studentsName;
853
ConstraintStudentsSetMinGapsBetweenBuildingChanges();
855
ConstraintStudentsSetMinGapsBetweenBuildingChanges(double wp, QString st, int mg);
857
bool computeInternalStructure(Rules& r);
859
QString getXmlDescription(Rules& r);
861
QString getDescription(Rules& r);
863
QString getDetailedDescription(Rules& r);
865
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
867
bool isRelatedToActivity(Activity* a);
869
bool isRelatedToTeacher(Teacher* t);
871
bool isRelatedToSubject(Subject* s);
873
bool isRelatedToActivityTag(ActivityTag* s);
875
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
877
bool isRelatedToRoom(Room* r);
880
class ConstraintStudentsMinGapsBetweenBuildingChanges: public SpaceConstraint{
883
int minGapsBetweenBuildingChanges;
885
ConstraintStudentsMinGapsBetweenBuildingChanges();
887
ConstraintStudentsMinGapsBetweenBuildingChanges(double wp, int mg);
889
bool computeInternalStructure(Rules& r);
891
QString getXmlDescription(Rules& r);
893
QString getDescription(Rules& r);
895
QString getDetailedDescription(Rules& r);
897
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
899
bool isRelatedToActivity(Activity* a);
901
bool isRelatedToTeacher(Teacher* t);
903
bool isRelatedToSubject(Subject* s);
905
bool isRelatedToActivityTag(ActivityTag* s);
907
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
909
bool isRelatedToRoom(Room* r);
912
class ConstraintTeacherMaxBuildingChangesPerDay: public SpaceConstraint{
919
int maxBuildingChangesPerDay;
923
ConstraintTeacherMaxBuildingChangesPerDay();
925
ConstraintTeacherMaxBuildingChangesPerDay(double wp, QString tc, int mc);
927
bool computeInternalStructure(Rules& r);
929
QString getXmlDescription(Rules& r);
931
QString getDescription(Rules& r);
933
QString getDetailedDescription(Rules& r);
935
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
937
bool isRelatedToActivity(Activity* a);
939
bool isRelatedToTeacher(Teacher* t);
941
bool isRelatedToSubject(Subject* s);
943
bool isRelatedToActivityTag(ActivityTag* s);
945
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
947
bool isRelatedToRoom(Room* r);
950
class ConstraintTeachersMaxBuildingChangesPerDay: public SpaceConstraint{
953
int maxBuildingChangesPerDay;
955
ConstraintTeachersMaxBuildingChangesPerDay();
957
ConstraintTeachersMaxBuildingChangesPerDay(double wp, int mc);
959
bool computeInternalStructure(Rules& r);
961
QString getXmlDescription(Rules& r);
963
QString getDescription(Rules& r);
965
QString getDetailedDescription(Rules& r);
967
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
969
bool isRelatedToActivity(Activity* a);
971
bool isRelatedToTeacher(Teacher* t);
973
bool isRelatedToSubject(Subject* s);
975
bool isRelatedToActivityTag(ActivityTag* s);
977
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
979
bool isRelatedToRoom(Room* r);
982
class ConstraintTeacherMaxBuildingChangesPerWeek: public SpaceConstraint{
989
int maxBuildingChangesPerWeek;
993
ConstraintTeacherMaxBuildingChangesPerWeek();
995
ConstraintTeacherMaxBuildingChangesPerWeek(double wp, QString tc, int mc);
997
bool computeInternalStructure(Rules& r);
999
QString getXmlDescription(Rules& r);
1001
QString getDescription(Rules& r);
1003
QString getDetailedDescription(Rules& r);
1005
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
1007
bool isRelatedToActivity(Activity* a);
1009
bool isRelatedToTeacher(Teacher* t);
1011
bool isRelatedToSubject(Subject* s);
1013
bool isRelatedToActivityTag(ActivityTag* s);
1015
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
1017
bool isRelatedToRoom(Room* r);
1020
class ConstraintTeachersMaxBuildingChangesPerWeek: public SpaceConstraint{
1023
int maxBuildingChangesPerWeek;
1025
ConstraintTeachersMaxBuildingChangesPerWeek();
1027
ConstraintTeachersMaxBuildingChangesPerWeek(double wp, int mc);
1029
bool computeInternalStructure(Rules& r);
1031
QString getXmlDescription(Rules& r);
1033
QString getDescription(Rules& r);
1035
QString getDetailedDescription(Rules& r);
1037
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
1039
bool isRelatedToActivity(Activity* a);
1041
bool isRelatedToTeacher(Teacher* t);
1043
bool isRelatedToSubject(Subject* s);
1045
bool isRelatedToActivityTag(ActivityTag* s);
1047
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
1049
bool isRelatedToRoom(Room* r);
1052
class ConstraintTeacherMinGapsBetweenBuildingChanges: public SpaceConstraint{
1054
//internal variables
1059
int minGapsBetweenBuildingChanges;
1061
QString teacherName;
1063
ConstraintTeacherMinGapsBetweenBuildingChanges();
1065
ConstraintTeacherMinGapsBetweenBuildingChanges(double wp, QString tc, int mg);
1067
bool computeInternalStructure(Rules& r);
1069
QString getXmlDescription(Rules& r);
1071
QString getDescription(Rules& r);
1073
QString getDetailedDescription(Rules& r);
1075
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
1077
bool isRelatedToActivity(Activity* a);
1079
bool isRelatedToTeacher(Teacher* t);
1081
bool isRelatedToSubject(Subject* s);
1083
bool isRelatedToActivityTag(ActivityTag* s);
1085
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
1087
bool isRelatedToRoom(Room* r);
1090
class ConstraintTeachersMinGapsBetweenBuildingChanges: public SpaceConstraint{
1093
int minGapsBetweenBuildingChanges;
1095
ConstraintTeachersMinGapsBetweenBuildingChanges();
1097
ConstraintTeachersMinGapsBetweenBuildingChanges(double wp, int mg);
1099
bool computeInternalStructure(Rules& r);
1101
QString getXmlDescription(Rules& r);
1103
QString getDescription(Rules& r);
1105
QString getDetailedDescription(Rules& r);
1107
double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
1109
bool isRelatedToActivity(Activity* a);
1111
bool isRelatedToTeacher(Teacher* t);
1113
bool isRelatedToSubject(Subject* s);
1115
bool isRelatedToActivityTag(ActivityTag* s);
1117
bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
1119
bool isRelatedToRoom(Room* r);