⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spaceconstraint.h

📁 基于遗传算法的排课软件源码 根据需要安排合理的课程时间等
💻 H
📖 第 1 页 / 共 3 页
字号:
	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], QString* conflictsString=NULL);	/**	Removes useless activities from the _activities and activitiesId array	*/	void removeUseless(Rules& r);		bool isRelatedToActivity(Activity* a);		bool isRelatedToTeacher(Teacher* t);	bool isRelatedToSubject(Subject* s);	bool isRelatedToSubjectTag(SubjectTag* s);		bool isRelatedToStudentsSet(Rules& r, StudentsSet* s);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is a constraint. Its purpose: a subject+subject tag must be taught ina certain room.*/class ConstraintSubjectSubjectTagPreferredRoom: public SpaceConstraint{public:		//The number of activities referred to by this constraint	int _nActivities;	//The list of activities referred to by this constraint.	//This is a list of indices in the rules internal activities list.	int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT];		// The index of the room	int _room;	public:	QString subjectName;	QString subjectTagName;	QString roomName;	ConstraintSubjectSubjectTagPreferredRoom();	ConstraintSubjectSubjectTagPreferredRoom(double w, bool c, const QString& subj, const QString& subt, const QString& rm);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is a constraint. Its purpose: a subject+subject tag must be taught incertain rooms.*/class ConstraintSubjectSubjectTagPreferredRooms: public SpaceConstraint{public:		//The number of activities referred to by this constraint	int _nActivities;	//The list of activities referred to by this constraint.	//This is a list of indices in the rules internal activities list.	int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT];		//The number of preferred rooms	int _n_preferred_rooms;		//The indexes of the rooms	int _rooms[MAX_CONSTRAINT_SUBJECT_SUBJECT_TAG_PREFERRED_ROOMS];	public:	QString subjectName;	QString subjectTagName;	QStringList roomsNames;	ConstraintSubjectSubjectTagPreferredRooms();	ConstraintSubjectSubjectTagPreferredRooms(double w, bool c, const QString& subj, const QString& subt, const QStringList& rms);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is a constraint. Its purpose: a subject must be taught ina certain room.*/class ConstraintSubjectPreferredRoom: public SpaceConstraint{public:		//The number of activities referred to by this constraint	int _nActivities;	//The list of activities referred to by this constraint.	//This is a list of indices in the rules internal activities list.	int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT];		// The index of the room	int _room;	public:	QString subjectName;	QString roomName;	ConstraintSubjectPreferredRoom();	ConstraintSubjectPreferredRoom(double w, bool c, const QString& subj, const QString& rm);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is a constraint. Its purpose: a subject must be taught incertain rooms.*/class ConstraintSubjectPreferredRooms: public SpaceConstraint{public:		//The number of activities referred to by this constraint	int _nActivities;	//The list of activities referred to by this constraint.	//This is a list of indices in the rules internal activities list.	int _activities[MAX_ACTIVITIES_FOR_A_SUBJECT];		//The number of preferred rooms	int _n_preferred_rooms;		//The indexes of the rooms	int _rooms[MAX_CONSTRAINT_SUBJECT_PREFERRED_ROOMS];	public:	QString subjectName;	QStringList roomsNames;	ConstraintSubjectPreferredRooms();	ConstraintSubjectPreferredRooms(double w, bool c, const QString& subj, const QStringList& rms);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is constraint not allowing more than max building changes per dayfor teachers. This constraint may also be used to minimize the numberof building changes in each day, if you put maxBuildingChanges=0.*/class ConstraintMaxBuildingChangesPerDayForTeachers: public SpaceConstraint{public:	int maxBuildingChanges;	ConstraintMaxBuildingChangesPerDayForTeachers();	ConstraintMaxBuildingChangesPerDayForTeachers(double w, bool c, int max_building_changes);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is constraint not allowing more than max building changes per dayfor students. This constraint may also be used to minimize the numberof building changes in each day, if you put maxBuildingChanges=0.*/class ConstraintMaxBuildingChangesPerDayForStudents: public SpaceConstraint{public:	int maxBuildingChanges;	ConstraintMaxBuildingChangesPerDayForStudents();	ConstraintMaxBuildingChangesPerDayForStudents(double w, bool c, int max_building_changes);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is constraint not allowing more than max room changes per dayfor teachers. This constraint may also be used to minimize the numberof room changes in each day, if you put maxRoomChanges=0.*/class ConstraintMaxRoomChangesPerDayForTeachers: public SpaceConstraint{public:	int maxRoomChanges;	ConstraintMaxRoomChangesPerDayForTeachers();	ConstraintMaxRoomChangesPerDayForTeachers(double w, bool c, int max_room_changes);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};/**This is constraint not allowing more than max room changes per dayfor students. This constraint may also be used to minimize the numberof room changes in each day, if you put maxRoomChanges=0.*/class ConstraintMaxRoomChangesPerDayForStudents: public SpaceConstraint{public:	int maxRoomChanges;	ConstraintMaxRoomChangesPerDayForStudents();	ConstraintMaxRoomChangesPerDayForStudents(double w, bool c, int max_room_changes);	bool computeInternalStructure(Rules& r);	QString getXmlDescription(Rules& r);	QString getDescription(Rules& r);	QString getDetailedDescription(Rules& r);	int fitness(SpaceChromosome& c, Rules& r, const int days[/*MAX_ACTIVITIES*/], const int hours[/*MAX_ACTIVITIES*/], 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);	bool isRelatedToEquipment(Equipment* e);	bool isRelatedToBuilding(Building* b);	bool isRelatedToRoom(Room* r);};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -