📄 timeconstraint.h
字号:
int maxHoursContinuously; ConstraintTeachersMaxHoursContinuously(); ConstraintTeachersMaxHoursContinuously(double w, bool c, int maxhours); QString getXmlDescription(Rules& r); bool computeInternalStructure(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint, aimed at obtaining timetableswhich do not allow more than X hours in a day for any teacher*/class ConstraintTeachersMaxHoursDaily: public TimeConstraint{public: /** The maximum hours daily */ int maxHoursDaily; ConstraintTeachersMaxHoursDaily(); ConstraintTeachersMaxHoursDaily(double w, bool c, int maxhours); QString getXmlDescription(Rules& r); bool computeInternalStructure(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**A constraint aimed at obtaining timetableswhich do not allow for a certain teacher and a certainsubgroup more than X hours per day*/class ConstraintTeachersSubgroupsMaxHoursDaily: public TimeConstraint{public: /** The maximum allowed hours daily */ int maxHoursDaily; ConstraintTeachersSubgroupsMaxHoursDaily(); ConstraintTeachersSubgroupsMaxHoursDaily(double w, bool c, int maxhours); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint.The resulting timetable must respect the requirementthat this teacher must not have too much workingdays per week.*/class ConstraintTeacherMaxDaysPerWeek: public TimeConstraint{public: /** The number of maximum allowed working days per week (-1 for don't care) */ int maxDaysPerWeek; /** The teacher's name */ QString teacher; /** The teacher's id, or index in the rules */ int teacher_ID; ConstraintTeacherMaxDaysPerWeek(); ConstraintTeacherMaxDaysPerWeek(double w, bool c, int maxnd, QString t); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint.It constrains the timetable to not schedule any activityin the specified day, during the start hour and end hour.*/class ConstraintBreak: public TimeConstraint{public: /** The day */ int d; /** The start hour */ int h1; /** The end hour */ int h2; ConstraintBreak(); ConstraintBreak(double w, bool c, int day, int start_hour, int end_hour); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint. It adds, to the fitness ofthe chromosome, a conflicts factor computed from the gapsexisting in the timetable (regarding the students).The overall result is a timetable having less gaps for the students.*/class ConstraintStudentsNoGaps: public TimeConstraint{public: ConstraintStudentsNoGaps(); ConstraintStudentsNoGaps(double w, bool c); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint. It adds, to the fitness ofthe chromosome, a conflicts factor computed from the gapsexisting in the timetable (regarding the specified students set).*/class ConstraintStudentsSetNoGaps: public TimeConstraint{public: /** The name of the students set for this constraint */ QString students; //internal redundant data /** The number of subgroups */ int nSubgroups; /** The subgroups */ int subgroups[MAX_SUBGROUPS_PER_CONSTRAINT]; ConstraintStudentsSetNoGaps(); ConstraintStudentsSetNoGaps(double w, bool c, const QString& st ); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint. It adds, to the fitness of the chromosome, aconflicts factor computed from the gaps existing in the timetable(regarding the teachers). The overall result is a timetable havingless gaps for the teachers.*/class ConstraintTeachersNoGaps: public TimeConstraint{public: ConstraintTeachersNoGaps(); ConstraintTeachersNoGaps(double w, bool c); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint. It adds, to the fitness ofthe chromosome, a fitness factor that is related to how earlythe students begin their courses. The result is a timetablehaving more activities scheduled at the beginning of the day.IMPORTANT: biweekly activities are treated as weekly ones,for speed and because in normal situations this does not matter.*/class ConstraintStudentsEarly: public TimeConstraint{public: ConstraintStudentsEarly(); ConstraintStudentsEarly(double w, bool compulsory); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint. The result is a timetable respecting the condition that the studentsmust not have too little or too much hours in a day.*/class ConstraintStudentsNHoursDaily: public TimeConstraint{public: /** The number of maximum allowed hours per day (-1 for don't care) */ int maxHoursDaily; /** The number of minimum allowed hours per day (-1 for don't care) */ int minHoursDaily; ConstraintStudentsNHoursDaily(); ConstraintStudentsNHoursDaily(double w, bool c, int maxnh, int minnh); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint. The result is a timetable respecting the condition that this students setmust not have too little or too much hours in a day.*/class ConstraintStudentsSetNHoursDaily: public TimeConstraint{public: /** The number of maximum allowed hours per day (-1 for don't care) */ int maxHoursDaily; /** The number of minimum allowed hours per day (-1 for don't care) */ int minHoursDaily; /** The students set name */ QString students; //internal variables /** The number of subgroups */ int nSubgroups; /** The subgroups */ int subgroups[MAX_SUBGROUPS_PER_CONSTRAINT]; ConstraintStudentsSetNHoursDaily(); ConstraintStudentsSetNHoursDaily(double w, bool c, int maxnh, int minnh, QString s); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a custom constraint.For a certain students set:The purpose is that a certain interval not be scheduled more than n times in a week(for example, there must be only 2 occupied intervals between hours 3 and 6,which might be on Monday and on Tuesday.*/class ConstraintStudentsSetIntervalMaxDaysPerWeek: public TimeConstraint{public: /** The start hour */ int h1; /** The end hour */ int h2; /** The name of the students */ QString students; /** The max. number of intervals */ int n; //internal variables /** The number of subgroups involved in this restriction */ int nSubgroups; /** The subgroups involved in this restriction */ int subgroups[MAX_SUBGROUPS_PER_CONSTRAINT]; ConstraintStudentsSetIntervalMaxDaysPerWeek(); ConstraintStudentsSetIntervalMaxDaysPerWeek(double w, bool c, const QString& sn, int start_hour, int end_hour, int n_intervals); bool computeInternalStructure(Rules& r); QString getXmlDescription(Rules& r); QString getDescription(Rules& r); QString getDetailedDescription(Rules& r); int fitness(TimeChromosome& c, Rules& r, QString* conflictsString=NULL); bool isRelatedToActivity(Activity* a); bool isRelatedToTeacher(Teacher* t); bool isRelatedToSubject(Subject* s); bool isRelatedToSubjectTag(SubjectTag* s); bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);};/**This is a constraint.It adds, to the fitness of the chromosome, a fitness factor thatgrows as the activity is scheduled farther from the wanted timeFor the moment, fitness factor increases with one unit for every hourand one unit for every day.*/class ConstraintActivityPreferredTime: public TimeConstraint{public: /** Activity id */ int activityId; /** The preferred day. If -1, then the user does not care about the day. */ int day; /** The preferred hour. If -1, then the user does not care about the hour. */ int hour; //internal variables /** The index of the activity in the rules (from 0 to rules.nActivities-1) - it is not the id of the activity */ int activityIndex;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -