Class Scheduling to Boolean satisfiability [Polynomial-time reduction] Final Part - c

I'm working since few weeks now on a project really interesting but unfortunately with a very complex background.
I already asked 3 questions :
Class Scheduling to Boolean satisfiability [Polynomial-time reduction] Final Part (here)
Class Scheduling to Boolean satisfiability [Polynomial-time reduction] part 2
Class Scheduling to Boolean satisfiability [Polynomial-time reduction]
in both of them, I get my answer (thank you again #Amit) but now arrived the final part, who will make this project useable :)
I for now can manage :
N time-intervals.
C courses.
T teachers.
S rooms.
My constraints are the follow:
2 teachers cannot be in the same room in the same time.
2 courses cannot be in the same room in the same time.
Teachers can teach only specific courses.
Some courses can happen only on specific time-intervals.
So this is for now, my result :
But here comes the final part that I want to add : I want to manage group of students, with the following constraints :
A group has only some courses to do.
2+ groups can be in the same room in the same time only for specific courses (like Magistral course for example)
Again, I success to isolate the constraint, but I have no idea on how to transform this constraint into a "time-intervals should not overlap" constraint.
Thanks in advance,
Best regards,

Since a student can only be in one place at a time:
Lectures for courses attached to the same student group should not overlap in time.
Edit:
There should be no constraint on different student groups overlapping. If you have such a constraint you should remove it!
The constraints are on courses. If you schdeule a lecture for course A, then it may not overlap a lecture for any other course for the student group(s) that attend course A. It may also not overlap any other course held by the same teacher.
So, you have a many-to-many relationship between students and courses and a many-to-many relationship between teachers and courses.
You want to schedule a number of lectures for each course with the constraint that no teacher and no student has overlapping lectures.
Regarding
2+ groups can be in the same room in the same time only for specific courses (like Magistral course for example)
If the groups may not mix, then it is not the same course (even though the subject may be the same). So if two student groups can not mix for Java, then you need to model it as two separate courses, Java group1 and Java group2.

Related

How Can I Improve Relationships in My Database?

I'm very new in designing professional database system and making a School Management System in Laravel. I have issues setting my database. How to enroll a student. To know the problem, you must have to read requirement once.
Every Classroom can have minimum 1 or maximum many Section.
Every Section has many list of Courses and Students enrolled in.
Every Classroom has Teacher
The database I am thinking for this is
Student (many-to-many forming Registration ) Classroom
Classroom (many-to-many forming Class_Section ) Section
Section (many-to-many forming Section_Courses ) Courses
or
Student (many-to-many forming Registration ) Classroom
Classroom {class_id, section_id(FK)} (one-to-many ) Section
Section {section_id, course_id} (one-to-many ) Course
The thing I need is that when enrolling a student, I want to register him in the ClassRoom and in any section of that classroom.
A Student can see all the courses in that section.
This makes clear that registration should have section id as well. But if I make relation of a section with registration. It will show all sections.
Kindly suggest me a possible way of designing this database. I'm stuck up here and can't find a better option for it.
Mainly there are three types of relations. They are,
1. one to one
2. one to many
3. many to many
Think about every relation from both ways. For example, you have said that,"Every Section has many list of Courses." Now think it in reverse. Can a course be offered in more than one section? If yes, then it should be a many to many relation. Otherwise it should be one to many.
Similarly think about classroom and section relationship. You have said, "Every Classroom can have minimum 1 or maximum many Section". Now think about it in reverse. Can a section have more than one classroom? If it can have more than one classroom then you need many to many. Otherwise, one to many will be ok.
The main point is if it is "one to many" from both sides then you need a many to many relation.
About showing only courses for that section; don't worry about it. First design the database. Laravel handles relations extremely well. In fact, eloquent relationship is very powerful tool. You can also use polymorphic relation and intermediary relation. Try to read about it from documentation.

4th Normal Form of table not met

Below is a graph of a database to be used to manage university student enrolment and grades across multiple years. Below are the listed requirements for the database
Students must be able to be a part of a class
A class must teach a subject
Each class may have 0 or more courseworks
Each class will have one exam
Each class can be taught by more than one lecturer
Coursework can only be set by one lecturer
Coursework and exams can be marked by different staff than who set them, and the staff member marking it must be able to be identified and recorded.
It is necessary to specify whether an exam taken is being taken for the first time or is a resit
I think the database is now in 4th normal form, and is represented in the table below.
The key represents the primary key for that table, and a green arrow means it is a foreign key.
Can anyone spot any errors or suggest ways to improve it?
Not enough information here to tell whether you are satisfying any Normal Form or not. We can only guess at some dependencies.
For example, "Each class will have one exam" seems to be saying that class→exam. Your Exam table on the other hand satisfies the dependency examID→classID, which is not one of your requirements. I can't tell from your diagram if classID is a candidate key in the Exam table. It also looks like examTaken would not be in 4NF if the classID→examID is one of the dependencies to be satisfied.
From a practical data modelling point of view 4NF is not very important. 5NF is more important. Is this homework? If so I'd suggest you write down the attributes and dependencies before you start drawing a diagram. You seem to have created far more attributes than are suggested by the statement of requirements.
Obviously the cardinality between coursework and courseworktaken cannot be 1:1.
(Why are some lines dotted and others not ?)

Correct use of an association class

I am new to using UML and I am not sure if my diagram is correct. I would like some advice from someone more experienced than me.
The statement of my problema says:
Students study courses and each student can take several courses "studies" each. Any course can have more than one student studying it.
Students, who are identified by a numerical code, have a name, date of birth and one or more nationalities.
A student who studies can receive scholarships.
A Student can recieve more than one scholarship per course. And an
individual scholarship can be given to more than one student. The
scholarships have a numeric code, which identifies them, a name, a
base amount and different conditions to be fulfilled at the time of
the assignment.
My proposal is the following:
What I want is to represent students, grants and the courses the student takes, and I am not sure if I should use an associative relation or a ternary relation.
Can anybody confirm if my proposal UML diagram is the right one?
The only statement directly relating students, courses & grants is the unclear "[a s]tudent can receive more than one grant per course".
It only actually says that each student-course pair can have more than one associated grant. (Maybe the author of the assignment thought that that "per" sentence is saying more than that, but it's not.) It doesn't say of a student whether their grants depend on their courses, and if so how. Your design is best when given a triplet you can't tell anything about any other triplet. The design with Takes(student,course) & Receives(student, course, grant) with th FK (foreign key) {student, course} from Receives to Takes is best when if you know a student & course pair then you know its grants. If grants are given to a student independently of courses then a design with Takes(student,course) & Receives(student,grant) is enough.
Clarify with your instructor.
Almost. The lozenge (or diamond) shaped element is itself an association class which associates all connected classes. What you want it a simple association class between Student and Studies like this:
The Scholarship represents the exams passed by the students in specific studies. The association class relation is indicated by the dashed line linked to the association (which has a m-n multiplicity).
Before you get to any attributes, I don't see a correlation between the nouns in the problem statement and your classes. I would expect to see the following classes:
Student
Course
Nationality
Scholarship
I would also expect to see an association class, called CourseEnrollment, that would have the following italicized properties at the ends of the association:
Student studiedCourse [1..*] Course
Course studyingStudent [1..*] Student
That association class would have yet another association with Scholarship, called ScholarshipAward, that would have the following italicized properties at the ends of the association:
CourseEnrollment awardedScholarship [0..*] Scholarship
Scholarship receivingCourseEnrollment [0..*] CourseEnrollment
With this arrangement, a Scholarship can be awarded to a combination of Student and Course.

ER Model (Chen notation)

My assignment is to draw an ER model (by hand) using Chen notation using the specifications below:
http://i57.tinypic.com/73ff2f.png
If you have questions about these specs. I'll play the role of the
client who will resolve them.
The database will serve a university.
Students have id's, names and gpa's. They must have exactly one major,
but they could have minors as well. Each major or minor is a
department which has a unique name and a phone number. For each
student with a minor, we record the date she signed up for it. Faculty
members are associated with a unique department and have id's, names
and office locations. Each internship is held by a particular student
at a particular compain and is supervised by a particular faculty
member. We also keep track of the last term in which that student
registered under that advisor for an internship at that company.
Students may have many internships over time. A given faculty member
may supervise many students at a given company, and she may supervise
a given student at several companies. However, for a given student and
company, there can be only one faculty advisor.
Students, Departments,
Faculty and Companies should be your entity types. Internship should
be a ternary relationship type. The specs should also lead you to some
binary relationship types. Don't add any ingredients to this mix other
than what appear in the specs.
Below is my work:
http://i60.tinypic.com/28rf7tf.jpg
Can anyone please help as I really need a better understanding of this (my professor is AWFUL at explaining this).
You missed (per your assignment's last paragraph) a department entity type. (Box.)
You missed 'Faculty members are associated with a unique department'. That's a relationship between those two entity types. (Diamond with lines to those boxes.)
You could have those major and minor entitie types that are 1:1 with departments. (Your present boxes with each a line to its own diamond each with a line to department.) But (per your assignment's last paragraph not listing them as entities) you could have major being a relationship 'student[s] has a major in department [d]' and similarly for minor. (Lines from student to each of two diamonds each with a line to department.) But the assignment actually says 'each major or minor is a department' so that's major as 'student[s] has major department [d]' and similarly for minor. (Same picture.)
Per your assignment's last paragraph you should make internship a ternary relationship. (Under Chen it's a relationship diamond (possibly with its own properties) formed by 3 lines to entity type rectangles (possibly with their own properties) rather than an entity box.) However, it's not clear exactly when your assignment considers that an internship holds. (It tells us what relationships hold; it's just not clear which one it wants to call interning.) (Although we can look for interpretations consistent with it being ternary.) One is 'student [s] interns at company [c] supervised by faculty member [f]'. But since 'for a given student and company, there can be only one faculty advisor' that notion of internship is more simply characterized by a binary relationship 'student [s] interns at company [c]'. But then you still need a relationship 'faculty member [f] advises student [s] at a company [c]'. So I will suggest that your assignment expects the former. We can add property term. (This is more reasonably called a relationship on student, company, faculty member and date; but E-RM considers relationships to be on entities. Although it all depends on your class's method's particulars.)
(The possibility of multiple reasonable variations is why you should propose a particular design fully handling a particular specification in a SO question.)
A problem with the E-R Model [sic] is that it introduces needless distinctions between entities, reltionships and properties. There is really no distinction between a relationship instance and an entity. Eg: Here we could just as well have an internship be per above an entity in a 4-way relationship plus property. Eg: Your assignment says 'each major or minor is a department'. But a major or minor isn't a department. A major or minor could be considered a subject, which would be the subject after which a department is named or the subject of the degree offered by a department. Or we could just have relationships in which a department participates but the relationship is about that department's subject or name or degree being a major or minor.
(If an internship as relationship participated in its own relationships I don't know how your instructor's particular method would keep the further lines organized. Some methods add internship entities (box) 1:1 with relationships (diamond); then some methods specially associate the entity type with the relationship as a reification while some make the relationship 4-way by including the reified entity type. Eg 'internship [i] is student [s] at company [c] and ...'.)
(Correctly speaking there are entity types vs relationships and entities vs relationship instances. But the assignment talks of relationship "types".)
Re E-RM see this answer and this one. Also the E-RM wiki page section 'Entity–relationship modeling'. (Which correctly mentions misinterpretations of Chen's E-RM & E-RDs by some related modeling and diagramming methods and tools and even some presentations of E-RM itself. But the 'Overview' is nonsense.)
Re E-RM problems see this.

Database design decision translating requirements to relational models

So I've volunteer to create a Registering system for my local church's education ministry. It should be able to register new students and keep track of their progress. Here are the requirements I've managed to gather:
The educational institution offers several courses.
Courses have a name and description.
Courses are organized in levels. There are several courses per level.
Courses also have requirements (i.e. other courses that need to be taken first).
A student graduates from a level when it has passed all courses of that level.
If a student cannot pass a course, he may repeat it as many times as he wants/needs.
Students can only take one course per semester.
An inactive student is one that isn't enrolled in the current semester.
Teachers will teach only one course per semester. Teachers may teach a different course each semester.
There could be semesters a teacher doesn't teach.
Now, this is my relational model.
![https://dl.dropbox.com/u/10900918/rmodels.jpg][1]
My questions are:
Are there any tables missing?
Looking at the semester + semester_code_description: is this the best way to do this? Under the assumption that a year has 2 semesters and that each semester have the same start and end months (i.e. semester 1: Aug - Dec, semester 2: Jan - May), is semester_code_description table really necessary?
How could I improve the design?
Sorry I didn't include any arrows. The program I'm using is a mess.
Thanks so much for your valuable time in advance.
1) Nice job on your design. I don't see any missing tables - it looks like you covered all of your requirements.
2) The semester_description table makes sense to me, whether or not you need it depends on whether you plan to do anything with that data.
3) The requirement "students can only take one course per semester" would imply that the Has_Taken relationship's primary key should be (student_id, semester_id). As it stands now, I could insert two different courses for the same student and semester. Similarly for the Has_Teached relationship.
Some other thoughts:
The "last_whatever" columns in some of your tables will force some extra processing on your actual application. You will need some mechanism to monitor/update those. Another option would be to derive them from your tables. I can get a student's last_semester by finding the semester with the max year/code.
One last consideration, how stable are these courses/descriptions/levels? I worked at a university for several years and our courses would change on a semester basis, forcing us to save an entire copy of course records for each change because we want a student's record to reflect what they actually took at that time.
Here's a little example in your app. Let's say I graduated level 1. Then a year later, the church adds a new course (Course A) to level 1. I will effectively be un-graduated b/c now there are level 1 courses I don't have (Course A).
This may not matter to you if your courses are pretty stable. Good luck!

Resources