~ubuntu-branches/ubuntu/quantal/fet/quantal

« back to all changes in this revision

Viewing changes to src/engine/spaceconstraint.h

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2008-05-05 22:28:46 UTC
  • mfrom: (1.1.6 upstream) (3.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20080505222846-l34al11t2vivuh3h
Tags: 5.5.5-1ubuntu1
* Merge from debian unstable (LP: #227080), remaining changes:
  - Include .desktop file and logo

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
class Activity;
38
38
class Teacher;
39
39
class Subject;
40
 
class SubjectTag;
 
40
class ActivityTag;
41
41
class StudentsSet;
42
42
class Equipment;
43
43
class Building;
46
46
 
47
47
typedef QList<SpaceConstraint*> SpaceConstraintsList;
48
48
 
49
 
const int CONSTRAINT_GENERIC_SPACE                                                              =1000; //time constraints are beginning from 1
50
 
const int CONSTRAINT_BASIC_COMPULSORY_SPACE                                             =1001; //space constraints from 1001
51
 
const int CONSTRAINT_ROOM_NOT_AVAILABLE                                                 =1002;
52
 
const int CONSTRAINT_ACTIVITY_PREFERRED_ROOM                                    =1003;
53
 
const int CONSTRAINT_ACTIVITY_PREFERRED_ROOMS                                   =1004;
54
 
const int CONSTRAINT_SUBJECT_PREFERRED_ROOM                                             =1005;
55
 
const int CONSTRAINT_SUBJECT_PREFERRED_ROOMS                                    =1006;
56
 
 
57
 
const int CONSTRAINT_SUBJECT_SUBJECT_TAG_PREFERRED_ROOM                 =1007;
58
 
const int CONSTRAINT_SUBJECT_SUBJECT_TAG_PREFERRED_ROOMS                =1008;
 
49
const int CONSTRAINT_GENERIC_SPACE                                                                              =1000; //time constraints are beginning from 1
 
50
 
 
51
const int CONSTRAINT_BASIC_COMPULSORY_SPACE                                                             =1001; //space constraints from 1001
 
52
const int CONSTRAINT_ROOM_NOT_AVAILABLE_TIMES                                                   =1002;
 
53
 
 
54
const int CONSTRAINT_ACTIVITY_PREFERRED_ROOM                                                    =1003;
 
55
const int CONSTRAINT_ACTIVITY_PREFERRED_ROOMS                                                   =1004;
 
56
 
 
57
const int CONSTRAINT_STUDENTS_SET_HOME_ROOM                                                             =1005;
 
58
const int CONSTRAINT_STUDENTS_SET_HOME_ROOMS                                                    =1006;
 
59
 
 
60
const int CONSTRAINT_TEACHER_HOME_ROOM                                                                  =1007;
 
61
const int CONSTRAINT_TEACHER_HOME_ROOMS                                                                 =1008;
 
62
 
 
63
const int CONSTRAINT_SUBJECT_PREFERRED_ROOM                                                             =1009;
 
64
const int CONSTRAINT_SUBJECT_PREFERRED_ROOMS                                                    =1010;
 
65
const int CONSTRAINT_SUBJECT_ACTIVITY_TAG_PREFERRED_ROOM                                =1011;
 
66
const int CONSTRAINT_SUBJECT_ACTIVITY_TAG_PREFERRED_ROOMS                               =1012;
 
67
 
 
68
const int CONSTRAINT_STUDENTS_MAX_BUILDING_CHANGES_PER_DAY                              =1013;
 
69
const int CONSTRAINT_STUDENTS_SET_MAX_BUILDING_CHANGES_PER_DAY                  =1014;
 
70
const int CONSTRAINT_STUDENTS_MAX_BUILDING_CHANGES_PER_WEEK                             =1015;
 
71
const int CONSTRAINT_STUDENTS_SET_MAX_BUILDING_CHANGES_PER_WEEK                 =1016;
 
72
const int CONSTRAINT_STUDENTS_MIN_GAPS_BETWEEN_BUILDING_CHANGES                 =1017;
 
73
const int CONSTRAINT_STUDENTS_SET_MIN_GAPS_BETWEEN_BUILDING_CHANGES             =1018;
 
74
 
 
75
const int CONSTRAINT_TEACHERS_MAX_BUILDING_CHANGES_PER_DAY                              =1019;
 
76
const int CONSTRAINT_TEACHER_MAX_BUILDING_CHANGES_PER_DAY                               =1020;
 
77
const int CONSTRAINT_TEACHERS_MAX_BUILDING_CHANGES_PER_WEEK                             =1021;
 
78
const int CONSTRAINT_TEACHER_MAX_BUILDING_CHANGES_PER_WEEK                              =1022;
 
79
const int CONSTRAINT_TEACHERS_MIN_GAPS_BETWEEN_BUILDING_CHANGES                 =1023;
 
80
const int CONSTRAINT_TEACHER_MIN_GAPS_BETWEEN_BUILDING_CHANGES                  =1024;
59
81
 
60
82
/**
61
83
This class represents a space constraint
133
155
        virtual bool isRelatedToSubject(Subject* s)=0;
134
156
 
135
157
        /**
136
 
        Returns true if this constraint is related to this subject tag
 
158
        Returns true if this constraint is related to this activity tag
137
159
        */
138
 
        virtual bool isRelatedToSubjectTag(SubjectTag* s)=0;
 
160
        virtual bool isRelatedToActivityTag(ActivityTag* s)=0;
139
161
 
140
162
        /**
141
163
        Returns true if this constraint is related to this students set
174
196
 
175
197
        bool isRelatedToSubject(Subject* s);
176
198
 
177
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
199
        bool isRelatedToActivityTag(ActivityTag* s);
178
200
        
179
201
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
180
202
 
181
203
        bool isRelatedToRoom(Room* r);
182
204
};
183
205
 
184
 
/**
185
 
This is a custom constraint.
186
 
It returns a fitness factor a number equal
187
 
to the product of this restriction's weight and
188
 
the number of conflicting hours for each room
189
 
(hours when it is not available, but an activity is scheduled at that time).
190
 
For the moment, this is done for a certain day and an hour interval.
191
 
(For room "roomName", on day "d", between hours "h1" and "h2").
192
 
*/
193
 
class ConstraintRoomNotAvailable: public SpaceConstraint{
 
206
class ConstraintRoomNotAvailableTimes: public SpaceConstraint{
194
207
public:
195
208
 
196
 
        /**
197
 
        The day
198
 
        */
199
 
        int d;
200
 
 
201
 
        /**
202
 
        The start hour
203
 
        */
204
 
        int h1;
205
 
 
206
 
        /**
207
 
        The end hour
208
 
        */
209
 
        int h2;
 
209
        QList<int> days;
 
210
        QList<int> hours;
210
211
 
211
212
        /**
212
213
        The room's name
213
214
        */
214
 
        QString roomName;
 
215
        QString room;
215
216
 
216
217
        /**
217
218
        The room's id, or index in the rules
218
219
        */
219
220
        int room_ID;
220
221
 
221
 
        ConstraintRoomNotAvailable();
 
222
        ConstraintRoomNotAvailableTimes();
222
223
 
223
 
        ConstraintRoomNotAvailable(double wp, const QString& rn, int day, int start_hour, int end_hour);
 
224
        ConstraintRoomNotAvailableTimes(double wp, const QString& rn, QList<int> d, QList<int> h);
224
225
 
225
226
        bool computeInternalStructure(Rules& r);
226
227
 
238
239
 
239
240
        bool isRelatedToSubject(Subject* s);
240
241
 
241
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
242
        bool isRelatedToActivityTag(ActivityTag* s);
242
243
        
243
244
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
244
245
 
291
292
 
292
293
        bool isRelatedToSubject(Subject* s);
293
294
 
294
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
295
        bool isRelatedToActivityTag(ActivityTag* s);
295
296
        
296
297
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
297
298
 
309
310
        //This is an index in the rules internal activities list.
310
311
        int _activity;
311
312
        
312
 
        //The number of preferred rooms
313
 
        int _n_preferred_rooms;
314
 
        
315
313
        //The indexes of the rooms
316
 
        int _rooms[MAX_CONSTRAINT_ACTIVITY_PREFERRED_ROOMS];
 
314
        QList<int> _rooms;
317
315
 
318
316
        //----------------------------------------------------------
319
317
 
333
331
 
334
332
        QString getDetailedDescription(Rules& r);
335
333
 
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);
338
 
        
339
 
        bool isRelatedToActivity(Activity* a);
340
 
        
341
 
        bool isRelatedToTeacher(Teacher* t);
342
 
 
343
 
        bool isRelatedToSubject(Subject* s);
344
 
 
345
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
334
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
335
        
 
336
        bool isRelatedToActivity(Activity* a);
 
337
        
 
338
        bool isRelatedToTeacher(Teacher* t);
 
339
 
 
340
        bool isRelatedToSubject(Subject* s);
 
341
 
 
342
        bool isRelatedToActivityTag(ActivityTag* s);
 
343
        
 
344
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
345
 
 
346
        bool isRelatedToRoom(Room* r);
 
347
};
 
348
 
 
349
class ConstraintStudentsSetHomeRoom: public SpaceConstraint{
 
350
public:
 
351
 
 
352
        QList<int> _activities;
 
353
        
 
354
        // The index of the room
 
355
        int _room;
 
356
        
 
357
public:
 
358
 
 
359
        QString studentsName;
 
360
 
 
361
        QString roomName;
 
362
 
 
363
        ConstraintStudentsSetHomeRoom();
 
364
 
 
365
        ConstraintStudentsSetHomeRoom(double wp, QString st, QString rm);
 
366
 
 
367
        bool computeInternalStructure(Rules& r);
 
368
 
 
369
        QString getXmlDescription(Rules& r);
 
370
 
 
371
        QString getDescription(Rules& r);
 
372
 
 
373
        QString getDetailedDescription(Rules& r);
 
374
 
 
375
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
376
        
 
377
        bool isRelatedToActivity(Activity* a);
 
378
        
 
379
        bool isRelatedToTeacher(Teacher* t);
 
380
 
 
381
        bool isRelatedToSubject(Subject* s);
 
382
 
 
383
        bool isRelatedToActivityTag(ActivityTag* s);
 
384
        
 
385
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
386
 
 
387
        bool isRelatedToRoom(Room* r);
 
388
};
 
389
 
 
390
class ConstraintStudentsSetHomeRooms: public SpaceConstraint{
 
391
public:
 
392
        
 
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;
 
396
        
 
397
        //The indexes of the rooms
 
398
        QList<int> _rooms;
 
399
        
 
400
public:
 
401
 
 
402
        QString studentsName;
 
403
 
 
404
        QStringList roomsNames;
 
405
 
 
406
        ConstraintStudentsSetHomeRooms();
 
407
 
 
408
        ConstraintStudentsSetHomeRooms(double wp, QString st, const QStringList& rms);
 
409
 
 
410
        bool computeInternalStructure(Rules& r);
 
411
 
 
412
        QString getXmlDescription(Rules& r);
 
413
 
 
414
        QString getDescription(Rules& r);
 
415
 
 
416
        QString getDetailedDescription(Rules& r);
 
417
 
 
418
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
419
        
 
420
        bool isRelatedToActivity(Activity* a);
 
421
        
 
422
        bool isRelatedToTeacher(Teacher* t);
 
423
 
 
424
        bool isRelatedToSubject(Subject* s);
 
425
 
 
426
        bool isRelatedToActivityTag(ActivityTag* s);
 
427
        
 
428
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
429
 
 
430
        bool isRelatedToRoom(Room* r);
 
431
};
 
432
 
 
433
class ConstraintTeacherHomeRoom: public SpaceConstraint{
 
434
public:
 
435
 
 
436
        QList<int> _activities;
 
437
        
 
438
        // The index of the room
 
439
        int _room;
 
440
        
 
441
public:
 
442
 
 
443
        QString teacherName;
 
444
 
 
445
        QString roomName;
 
446
 
 
447
        ConstraintTeacherHomeRoom();
 
448
 
 
449
        ConstraintTeacherHomeRoom(double wp, QString tc, QString rm);
 
450
 
 
451
        bool computeInternalStructure(Rules& r);
 
452
 
 
453
        QString getXmlDescription(Rules& r);
 
454
 
 
455
        QString getDescription(Rules& r);
 
456
 
 
457
        QString getDetailedDescription(Rules& r);
 
458
 
 
459
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
460
        
 
461
        bool isRelatedToActivity(Activity* a);
 
462
        
 
463
        bool isRelatedToTeacher(Teacher* t);
 
464
 
 
465
        bool isRelatedToSubject(Subject* s);
 
466
 
 
467
        bool isRelatedToActivityTag(ActivityTag* s);
 
468
        
 
469
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
470
 
 
471
        bool isRelatedToRoom(Room* r);
 
472
};
 
473
 
 
474
class ConstraintTeacherHomeRooms: public SpaceConstraint{
 
475
public:
 
476
        
 
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;
 
480
        
 
481
        //The indexes of the rooms
 
482
        QList<int> _rooms;
 
483
        
 
484
public:
 
485
 
 
486
        QString teacherName;
 
487
 
 
488
        QStringList roomsNames;
 
489
 
 
490
        ConstraintTeacherHomeRooms();
 
491
 
 
492
        ConstraintTeacherHomeRooms(double wp, QString st, const QStringList& rms);
 
493
 
 
494
        bool computeInternalStructure(Rules& r);
 
495
 
 
496
        QString getXmlDescription(Rules& r);
 
497
 
 
498
        QString getDescription(Rules& r);
 
499
 
 
500
        QString getDetailedDescription(Rules& r);
 
501
 
 
502
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
503
        
 
504
        bool isRelatedToActivity(Activity* a);
 
505
        
 
506
        bool isRelatedToTeacher(Teacher* t);
 
507
 
 
508
        bool isRelatedToSubject(Subject* s);
 
509
 
 
510
        bool isRelatedToActivityTag(ActivityTag* s);
346
511
        
347
512
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
348
513
 
355
520
*/
356
521
class ConstraintSubjectPreferredRoom: public SpaceConstraint{
357
522
public:
358
 
        
359
 
        //The number of activities referred to by this constraint
360
 
        int _nActivities;
361
523
 
362
 
        //The list of activities referred to by this constraint.
363
 
        //This is a list of indices in the rules internal activities list.
364
 
        int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT];
 
524
        QList<int> _activities;
365
525
        
366
526
        // The index of the room
367
527
        int _room;
393
553
 
394
554
        bool isRelatedToSubject(Subject* s);
395
555
 
396
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
556
        bool isRelatedToActivityTag(ActivityTag* s);
397
557
        
398
558
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
399
559
 
406
566
*/
407
567
class ConstraintSubjectPreferredRooms: public SpaceConstraint{
408
568
public:
409
 
        
410
 
        //The number of activities referred to by this constraint
411
 
        int _nActivities;
412
569
 
413
 
        //The list of activities referred to by this constraint.
414
 
        //This is a list of indices in the rules internal activities list.
415
 
        int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT];
416
 
        
417
 
        //The number of preferred rooms
418
 
        int _n_preferred_rooms;
419
 
        
420
 
        //The indexes of the rooms
421
 
        int _rooms[MAX_CONSTRAINT_SUBJECT_PREFERRED_ROOMS];
 
570
        QList<int> _activities;
 
571
        
 
572
        QList<int> _rooms;
422
573
        
423
574
public:
424
575
 
447
598
 
448
599
        bool isRelatedToSubject(Subject* s);
449
600
 
450
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
601
        bool isRelatedToActivityTag(ActivityTag* s);
451
602
        
452
603
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
453
604
 
458
609
This is a constraint. Its purpose: a subject+subject tag must be taught in
459
610
a certain room.
460
611
*/
461
 
class ConstraintSubjectSubjectTagPreferredRoom: public SpaceConstraint{
 
612
class ConstraintSubjectActivityTagPreferredRoom: public SpaceConstraint{
462
613
public:
463
 
        
464
 
        //The number of activities referred to by this constraint
465
 
        int _nActivities;
466
614
 
467
 
        //The list of activities referred to by this constraint.
468
 
        //This is a list of indices in the rules internal activities list.
469
 
        int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT_SUBJECT_TAG];
 
615
        QList<int> _activities;
470
616
        
471
617
        // The index of the room
472
618
        int _room;
475
621
 
476
622
        QString subjectName;
477
623
 
478
 
        QString subjectTagName;
 
624
        QString activityTagName;
479
625
 
480
626
        QString roomName;
481
627
 
482
 
        ConstraintSubjectSubjectTagPreferredRoom();
 
628
        ConstraintSubjectActivityTagPreferredRoom();
483
629
 
484
 
        ConstraintSubjectSubjectTagPreferredRoom(double wp, const QString& subj, const QString& subjTag, const QString& rm);
 
630
        ConstraintSubjectActivityTagPreferredRoom(double wp, const QString& subj, const QString& actTag, const QString& rm);
485
631
 
486
632
        bool computeInternalStructure(Rules& r);
487
633
 
500
646
 
501
647
        bool isRelatedToSubject(Subject* s);
502
648
 
503
 
        bool isRelatedToSubjectTag(SubjectTag* s);
 
649
        bool isRelatedToActivityTag(ActivityTag* s);
504
650
        
505
651
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
506
652
 
511
657
This is a constraint. Its purpose: a subject+subject tag must be taught in
512
658
certain rooms.
513
659
*/
514
 
class ConstraintSubjectSubjectTagPreferredRooms: public SpaceConstraint{
 
660
class ConstraintSubjectActivityTagPreferredRooms: public SpaceConstraint{
515
661
public:
516
662
        
517
 
        //The number of activities referred to by this constraint
518
 
        int _nActivities;
 
663
        QList<int> _activities;
 
664
        
 
665
        QList<int> _rooms;
519
666
 
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];
523
 
        
524
 
        //The number of preferred rooms
525
 
        int _n_preferred_rooms;
526
 
        
527
 
        //The indexes of the rooms
528
 
        int _rooms[MAX_CONSTRAINT_SUBJECT_SUBJECT_TAG_PREFERRED_ROOMS];
529
 
        
530
667
public:
531
668
 
532
669
        QString subjectName;
533
670
 
534
 
        QString subjectTagName;
 
671
        QString activityTagName;
535
672
 
536
673
        QStringList roomsNames;
537
674
 
538
 
        ConstraintSubjectSubjectTagPreferredRooms();
539
 
 
540
 
        ConstraintSubjectSubjectTagPreferredRooms(double wp, const QString& subj, const QString& subjTag, const QStringList& rms);
541
 
 
542
 
        bool computeInternalStructure(Rules& r);
543
 
 
544
 
        QString getXmlDescription(Rules& r);
545
 
 
546
 
        QString getDescription(Rules& r);
547
 
 
548
 
        QString getDetailedDescription(Rules& r);
549
 
 
550
 
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
551
 
        
552
 
        bool isRelatedToActivity(Activity* a);
553
 
        
554
 
        bool isRelatedToTeacher(Teacher* t);
555
 
 
556
 
        bool isRelatedToSubject(Subject* s);
557
 
 
558
 
        bool isRelatedToSubjectTag(SubjectTag* s);
559
 
        
560
 
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
561
 
 
562
 
        bool isRelatedToRoom(Room* r);
563
 
};
 
675
        ConstraintSubjectActivityTagPreferredRooms();
 
676
 
 
677
        ConstraintSubjectActivityTagPreferredRooms(double wp, const QString& subj, const QString& actTag, const QStringList& rms);
 
678
 
 
679
        bool computeInternalStructure(Rules& r);
 
680
 
 
681
        QString getXmlDescription(Rules& r);
 
682
 
 
683
        QString getDescription(Rules& r);
 
684
 
 
685
        QString getDetailedDescription(Rules& r);
 
686
 
 
687
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
688
        
 
689
        bool isRelatedToActivity(Activity* a);
 
690
        
 
691
        bool isRelatedToTeacher(Teacher* t);
 
692
 
 
693
        bool isRelatedToSubject(Subject* s);
 
694
 
 
695
        bool isRelatedToActivityTag(ActivityTag* s);
 
696
        
 
697
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
698
 
 
699
        bool isRelatedToRoom(Room* r);
 
700
};
 
701
 
 
702
class ConstraintStudentsSetMaxBuildingChangesPerDay: public SpaceConstraint{
 
703
public:
 
704
        //internal variables
 
705
        QList<int> iSubgroupsList;
 
706
 
 
707
public:
 
708
 
 
709
        int maxBuildingChangesPerDay;
 
710
 
 
711
        QString studentsName;
 
712
 
 
713
        ConstraintStudentsSetMaxBuildingChangesPerDay();
 
714
 
 
715
        ConstraintStudentsSetMaxBuildingChangesPerDay(double wp, QString st, int mc);
 
716
 
 
717
        bool computeInternalStructure(Rules& r);
 
718
 
 
719
        QString getXmlDescription(Rules& r);
 
720
 
 
721
        QString getDescription(Rules& r);
 
722
 
 
723
        QString getDetailedDescription(Rules& r);
 
724
 
 
725
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
726
        
 
727
        bool isRelatedToActivity(Activity* a);
 
728
        
 
729
        bool isRelatedToTeacher(Teacher* t);
 
730
 
 
731
        bool isRelatedToSubject(Subject* s);
 
732
 
 
733
        bool isRelatedToActivityTag(ActivityTag* s);
 
734
        
 
735
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
736
 
 
737
        bool isRelatedToRoom(Room* r);
 
738
};
 
739
 
 
740
class ConstraintStudentsMaxBuildingChangesPerDay: public SpaceConstraint{
 
741
public:
 
742
 
 
743
        int maxBuildingChangesPerDay;
 
744
 
 
745
        ConstraintStudentsMaxBuildingChangesPerDay();
 
746
 
 
747
        ConstraintStudentsMaxBuildingChangesPerDay(double wp, int mc);
 
748
 
 
749
        bool computeInternalStructure(Rules& r);
 
750
 
 
751
        QString getXmlDescription(Rules& r);
 
752
 
 
753
        QString getDescription(Rules& r);
 
754
 
 
755
        QString getDetailedDescription(Rules& r);
 
756
 
 
757
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
758
        
 
759
        bool isRelatedToActivity(Activity* a);
 
760
        
 
761
        bool isRelatedToTeacher(Teacher* t);
 
762
 
 
763
        bool isRelatedToSubject(Subject* s);
 
764
 
 
765
        bool isRelatedToActivityTag(ActivityTag* s);
 
766
        
 
767
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
768
 
 
769
        bool isRelatedToRoom(Room* r);
 
770
};
 
771
 
 
772
class ConstraintStudentsSetMaxBuildingChangesPerWeek: public SpaceConstraint{
 
773
public:
 
774
        //internal variables
 
775
        QList<int> iSubgroupsList;
 
776
 
 
777
public:
 
778
 
 
779
        int maxBuildingChangesPerWeek;
 
780
 
 
781
        QString studentsName;
 
782
 
 
783
        ConstraintStudentsSetMaxBuildingChangesPerWeek();
 
784
 
 
785
        ConstraintStudentsSetMaxBuildingChangesPerWeek(double wp, QString st, int mc);
 
786
 
 
787
        bool computeInternalStructure(Rules& r);
 
788
 
 
789
        QString getXmlDescription(Rules& r);
 
790
 
 
791
        QString getDescription(Rules& r);
 
792
 
 
793
        QString getDetailedDescription(Rules& r);
 
794
 
 
795
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
796
        
 
797
        bool isRelatedToActivity(Activity* a);
 
798
        
 
799
        bool isRelatedToTeacher(Teacher* t);
 
800
 
 
801
        bool isRelatedToSubject(Subject* s);
 
802
 
 
803
        bool isRelatedToActivityTag(ActivityTag* s);
 
804
        
 
805
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
806
 
 
807
        bool isRelatedToRoom(Room* r);
 
808
};
 
809
 
 
810
class ConstraintStudentsMaxBuildingChangesPerWeek: public SpaceConstraint{
 
811
public:
 
812
 
 
813
        int maxBuildingChangesPerWeek;
 
814
 
 
815
        ConstraintStudentsMaxBuildingChangesPerWeek();
 
816
 
 
817
        ConstraintStudentsMaxBuildingChangesPerWeek(double wp, int mc);
 
818
 
 
819
        bool computeInternalStructure(Rules& r);
 
820
 
 
821
        QString getXmlDescription(Rules& r);
 
822
 
 
823
        QString getDescription(Rules& r);
 
824
 
 
825
        QString getDetailedDescription(Rules& r);
 
826
 
 
827
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
828
        
 
829
        bool isRelatedToActivity(Activity* a);
 
830
        
 
831
        bool isRelatedToTeacher(Teacher* t);
 
832
 
 
833
        bool isRelatedToSubject(Subject* s);
 
834
 
 
835
        bool isRelatedToActivityTag(ActivityTag* s);
 
836
        
 
837
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
838
 
 
839
        bool isRelatedToRoom(Room* r);
 
840
};
 
841
 
 
842
class ConstraintStudentsSetMinGapsBetweenBuildingChanges: public SpaceConstraint{
 
843
public:
 
844
        //internal variables
 
845
        QList<int> iSubgroupsList;
 
846
 
 
847
public:
 
848
 
 
849
        int minGapsBetweenBuildingChanges;
 
850
 
 
851
        QString studentsName;
 
852
 
 
853
        ConstraintStudentsSetMinGapsBetweenBuildingChanges();
 
854
 
 
855
        ConstraintStudentsSetMinGapsBetweenBuildingChanges(double wp, QString st, int mg);
 
856
 
 
857
        bool computeInternalStructure(Rules& r);
 
858
 
 
859
        QString getXmlDescription(Rules& r);
 
860
 
 
861
        QString getDescription(Rules& r);
 
862
 
 
863
        QString getDetailedDescription(Rules& r);
 
864
 
 
865
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
866
        
 
867
        bool isRelatedToActivity(Activity* a);
 
868
        
 
869
        bool isRelatedToTeacher(Teacher* t);
 
870
 
 
871
        bool isRelatedToSubject(Subject* s);
 
872
 
 
873
        bool isRelatedToActivityTag(ActivityTag* s);
 
874
        
 
875
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
876
 
 
877
        bool isRelatedToRoom(Room* r);
 
878
};
 
879
 
 
880
class ConstraintStudentsMinGapsBetweenBuildingChanges: public SpaceConstraint{
 
881
public:
 
882
 
 
883
        int minGapsBetweenBuildingChanges;
 
884
 
 
885
        ConstraintStudentsMinGapsBetweenBuildingChanges();
 
886
 
 
887
        ConstraintStudentsMinGapsBetweenBuildingChanges(double wp, int mg);
 
888
 
 
889
        bool computeInternalStructure(Rules& r);
 
890
 
 
891
        QString getXmlDescription(Rules& r);
 
892
 
 
893
        QString getDescription(Rules& r);
 
894
 
 
895
        QString getDetailedDescription(Rules& r);
 
896
 
 
897
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
898
        
 
899
        bool isRelatedToActivity(Activity* a);
 
900
        
 
901
        bool isRelatedToTeacher(Teacher* t);
 
902
 
 
903
        bool isRelatedToSubject(Subject* s);
 
904
 
 
905
        bool isRelatedToActivityTag(ActivityTag* s);
 
906
        
 
907
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
908
 
 
909
        bool isRelatedToRoom(Room* r);
 
910
};
 
911
 
 
912
class ConstraintTeacherMaxBuildingChangesPerDay: public SpaceConstraint{
 
913
public:
 
914
        //internal variables
 
915
        int teacher_ID;
 
916
 
 
917
public:
 
918
 
 
919
        int maxBuildingChangesPerDay;
 
920
 
 
921
        QString teacherName;
 
922
 
 
923
        ConstraintTeacherMaxBuildingChangesPerDay();
 
924
 
 
925
        ConstraintTeacherMaxBuildingChangesPerDay(double wp, QString tc, int mc);
 
926
 
 
927
        bool computeInternalStructure(Rules& r);
 
928
 
 
929
        QString getXmlDescription(Rules& r);
 
930
 
 
931
        QString getDescription(Rules& r);
 
932
 
 
933
        QString getDetailedDescription(Rules& r);
 
934
 
 
935
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
936
        
 
937
        bool isRelatedToActivity(Activity* a);
 
938
        
 
939
        bool isRelatedToTeacher(Teacher* t);
 
940
 
 
941
        bool isRelatedToSubject(Subject* s);
 
942
 
 
943
        bool isRelatedToActivityTag(ActivityTag* s);
 
944
        
 
945
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
946
 
 
947
        bool isRelatedToRoom(Room* r);
 
948
};
 
949
 
 
950
class ConstraintTeachersMaxBuildingChangesPerDay: public SpaceConstraint{
 
951
public:
 
952
 
 
953
        int maxBuildingChangesPerDay;
 
954
 
 
955
        ConstraintTeachersMaxBuildingChangesPerDay();
 
956
 
 
957
        ConstraintTeachersMaxBuildingChangesPerDay(double wp, int mc);
 
958
 
 
959
        bool computeInternalStructure(Rules& r);
 
960
 
 
961
        QString getXmlDescription(Rules& r);
 
962
 
 
963
        QString getDescription(Rules& r);
 
964
 
 
965
        QString getDetailedDescription(Rules& r);
 
966
 
 
967
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
968
        
 
969
        bool isRelatedToActivity(Activity* a);
 
970
        
 
971
        bool isRelatedToTeacher(Teacher* t);
 
972
 
 
973
        bool isRelatedToSubject(Subject* s);
 
974
 
 
975
        bool isRelatedToActivityTag(ActivityTag* s);
 
976
        
 
977
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
978
 
 
979
        bool isRelatedToRoom(Room* r);
 
980
};
 
981
 
 
982
class ConstraintTeacherMaxBuildingChangesPerWeek: public SpaceConstraint{
 
983
public:
 
984
        //internal variables
 
985
        int teacher_ID;
 
986
 
 
987
public:
 
988
 
 
989
        int maxBuildingChangesPerWeek;
 
990
 
 
991
        QString teacherName;
 
992
 
 
993
        ConstraintTeacherMaxBuildingChangesPerWeek();
 
994
 
 
995
        ConstraintTeacherMaxBuildingChangesPerWeek(double wp, QString tc, int mc);
 
996
 
 
997
        bool computeInternalStructure(Rules& r);
 
998
 
 
999
        QString getXmlDescription(Rules& r);
 
1000
 
 
1001
        QString getDescription(Rules& r);
 
1002
 
 
1003
        QString getDetailedDescription(Rules& r);
 
1004
 
 
1005
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
1006
        
 
1007
        bool isRelatedToActivity(Activity* a);
 
1008
        
 
1009
        bool isRelatedToTeacher(Teacher* t);
 
1010
 
 
1011
        bool isRelatedToSubject(Subject* s);
 
1012
 
 
1013
        bool isRelatedToActivityTag(ActivityTag* s);
 
1014
        
 
1015
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
1016
 
 
1017
        bool isRelatedToRoom(Room* r);
 
1018
};
 
1019
 
 
1020
class ConstraintTeachersMaxBuildingChangesPerWeek: public SpaceConstraint{
 
1021
public:
 
1022
 
 
1023
        int maxBuildingChangesPerWeek;
 
1024
 
 
1025
        ConstraintTeachersMaxBuildingChangesPerWeek();
 
1026
 
 
1027
        ConstraintTeachersMaxBuildingChangesPerWeek(double wp, int mc);
 
1028
 
 
1029
        bool computeInternalStructure(Rules& r);
 
1030
 
 
1031
        QString getXmlDescription(Rules& r);
 
1032
 
 
1033
        QString getDescription(Rules& r);
 
1034
 
 
1035
        QString getDetailedDescription(Rules& r);
 
1036
 
 
1037
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
1038
        
 
1039
        bool isRelatedToActivity(Activity* a);
 
1040
        
 
1041
        bool isRelatedToTeacher(Teacher* t);
 
1042
 
 
1043
        bool isRelatedToSubject(Subject* s);
 
1044
 
 
1045
        bool isRelatedToActivityTag(ActivityTag* s);
 
1046
        
 
1047
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
1048
 
 
1049
        bool isRelatedToRoom(Room* r);
 
1050
};
 
1051
 
 
1052
class ConstraintTeacherMinGapsBetweenBuildingChanges: public SpaceConstraint{
 
1053
public:
 
1054
        //internal variables
 
1055
        int teacher_ID;
 
1056
 
 
1057
public:
 
1058
 
 
1059
        int minGapsBetweenBuildingChanges;
 
1060
 
 
1061
        QString teacherName;
 
1062
 
 
1063
        ConstraintTeacherMinGapsBetweenBuildingChanges();
 
1064
 
 
1065
        ConstraintTeacherMinGapsBetweenBuildingChanges(double wp, QString tc, int mg);
 
1066
 
 
1067
        bool computeInternalStructure(Rules& r);
 
1068
 
 
1069
        QString getXmlDescription(Rules& r);
 
1070
 
 
1071
        QString getDescription(Rules& r);
 
1072
 
 
1073
        QString getDetailedDescription(Rules& r);
 
1074
 
 
1075
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
1076
        
 
1077
        bool isRelatedToActivity(Activity* a);
 
1078
        
 
1079
        bool isRelatedToTeacher(Teacher* t);
 
1080
 
 
1081
        bool isRelatedToSubject(Subject* s);
 
1082
 
 
1083
        bool isRelatedToActivityTag(ActivityTag* s);
 
1084
        
 
1085
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
1086
 
 
1087
        bool isRelatedToRoom(Room* r);
 
1088
};
 
1089
 
 
1090
class ConstraintTeachersMinGapsBetweenBuildingChanges: public SpaceConstraint{
 
1091
public:
 
1092
 
 
1093
        int minGapsBetweenBuildingChanges;
 
1094
 
 
1095
        ConstraintTeachersMinGapsBetweenBuildingChanges();
 
1096
 
 
1097
        ConstraintTeachersMinGapsBetweenBuildingChanges(double wp, int mg);
 
1098
 
 
1099
        bool computeInternalStructure(Rules& r);
 
1100
 
 
1101
        QString getXmlDescription(Rules& r);
 
1102
 
 
1103
        QString getDescription(Rules& r);
 
1104
 
 
1105
        QString getDetailedDescription(Rules& r);
 
1106
 
 
1107
        double fitness(Solution& c, Rules& r, QList<double>& cl, QList<QString>& dl, QString* conflictsString=NULL);
 
1108
        
 
1109
        bool isRelatedToActivity(Activity* a);
 
1110
        
 
1111
        bool isRelatedToTeacher(Teacher* t);
 
1112
 
 
1113
        bool isRelatedToSubject(Subject* s);
 
1114
 
 
1115
        bool isRelatedToActivityTag(ActivityTag* s);
 
1116
        
 
1117
        bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);
 
1118
 
 
1119
        bool isRelatedToRoom(Room* r);
 
1120
};
 
1121
 
564
1122
 
565
1123
 
566
1124
#endif