Пример #1
0
 public Raspored(Schedule podaci)
 {
     sobe = new int[podaci.ClassroomList.Count,5,12];
     profesori = new int[podaci.LecturerList.Count, 5, 12];
     kolegiji = new int[podaci.CourseList.Count, 5, 12];
     grupe = new int[podaci.GroupList.Count, 5, 12];
     eventi = new int[podaci.EventList.Count + 1, 4];
     score = 0;
     view = 0;
 }
Пример #2
0
        public string drawClassroomSchedule(int g, Schedule p)
        {
            Classroom G = p.getRoomByNo(g);
            string s = "<html><head><style type='text/css'>" +
                       "body{margin:50px 0px; padding:0px;	text-align:center;}" +
                       "table, td, th{	border: 1px solid black;	border-collapse:collapse;}" +
                       "td{font-size:10pt; text-align:center;}" +
                       " td.full{background-color=#CCCCFF}</style></head><body><h3>";
            s += (G.getID() + "</h3><table border='2'>");
            s += "<tr><th WIDTH='70'>SAT</th><th WIDTH='150'>PONEDJELJAK</th>" +
                 "<th WIDTH='150'>UTORAK</th><th WIDTH='150'>SRIJEDA</th>" +
                 "<th WIDTH='150'>CETVRTAK</th><th WIDTH='150'>PETAK</th></tr>";

            for (int i = 0; i < 12; i++)
            {
                s += ("<tr style='height:40px'><td WIDTH='70'>" +
                     (i + 8).ToString() + "<sup>00</sup> - " +
                     (i + 9).ToString() + "<sup>00</sup></td>");

                for (int j = 0; j < 5; j++)
                {
                    if (sobe[g, j, i] == 0)
                        s += "<td WIDTH='150'>&nbsp;</td>";
                    else
                    {
                        Event t = p.getEventByID(sobe[g, j, i]);
                        if (i == 0 || sobe[g, j, i - 1] != sobe[g, j, i])
                        {
                            s += ("<td  class='full'rowspan='" +
                                 t.Duration.ToString() + "' WIDTH='150'>" +
                                 t.getCourse().getName() + " " + "<br />" +
                                 p.findLecturer(eventi[t.Id, 0]).getName()/*t.getLecturer().getName()*/ +
                                 "</td>");
                        }
                    }
                }
                s += "</tr>";
            }
            s += "</table></body></html>";
            return s;
        }
Пример #3
0
        public void SetEvent(Schedule s, int EventId, int classroomId, int i, int j)
        {
            Event e = s.getEventByID(EventId);
            int t = e.Duration;
            eventi[EventId, 2] = i;
            eventi[EventId, 3] = j;
            eventi[EventId, 1] = classroomId;
            int l = eventi[EventId, 0];

            foreach (string g in s.getEventByID(EventId).getGroups())
            {
                int gId = s.findGroup(g).Id;
                for (int k = 0; k < t; k++)
                {
                    grupe[gId, i, j + k] = EventId;
                }
            }
            for (int k = 0; k < t; k++)
            {
                sobe[classroomId, i, j + k] = EventId;
            }
            for (int k = 0; k < t; k++)
            {
                profesori[l, i, j + k] = EventId;
            }
            //e.getCourse().setEvent(i, j, e);
            for (int k = 0; k < t; k++)
            {
                kolegiji[e.getCourse().getID(), i, j + k]++;
            }
        }
Пример #4
0
        /* Removes an Event from Scedules of all the groups, lecturers
         * and classrooms assosciated with that event */
        public void RemoveEvent(Schedule s, int EventId)
        {
            Event e = s.getEventByID(EventId);
            //e.getClassroom().week[]--;
            int t = e.Duration;
            int i = eventi[EventId, 2];
            int j = eventi[EventId, 3];
            int c = eventi[EventId, 1];
            int l = eventi[EventId, 0];

            foreach (string g in s.getEventByID(EventId).getGroups())
            {
                int gId = s.findGroup(g).Id;
                for (int k = 0; k < t; k++)
                {
                    grupe[gId, i, j + k] = 0;
                }
            }
            for (int k = 0; k < t; k++)
            {
                sobe[c, i, j + k] = 0;
            }
            for (int k = 0; k < t; k++)
            {
                profesori[l, i, j + k] = 0;
            }
            for (int k = 0; k < t; k++)
            {
                kolegiji[e.getCourse().getID(), i, j + k] --;
            }
            //e.getCourse().removeEvent(i, j, t);

            eventi[EventId, 2] = 0;
            eventi[EventId, 3] = 0;
        }
Пример #5
0
        public void generateHtml(string s, Schedule r)
        {
            TextWriter f = new StreamWriter(s);

            // f.open(s, ifstream::out);

            f.WriteLine("<html><head><style type='text/css'>body{margin:50px 0px; padding:0px;	text-align:center;}table, td, th{	border: 1px solid black;	border-collapse:collapse;}td{font-size:10pt; text-align:center;}</style></head>");// << "<html>" << endl;
            f.WriteLine("<body>");// <<  << endl;

            //list<Group>::iterator it;

            // for (it = groupList.begin(); it != groupList.end(); it++) {
            for (int id = 0; id < r.GroupList.Count; id++)
            {
                Group it = r.GetGroupById(id);
                f.WriteLine("<h3>{0}</h3>", it.getName());
                f.WriteLine("<table border='1'>");
                f.WriteLine("<tr><th WIDTH='80'>SAT</th><th WIDTH='150'>PONEDJELJAK</th><th WIDTH='150'>UTORAK</th><th WIDTH='150'>SRIJEDA</th><th WIDTH='150'>CETVRTAK</th><th WIDTH='150'>PETAK</th></tr>");

                for (int i = 0; i < 12; i++)
                {
                    //f << "<tr>"<< "<td WIDTH='70'>" << i + 8 << "<sup>00</sup> - " << i + 9 << "<sup>00</sup>" << "</td>" << endl;
                    f.WriteLine("<tr><th WIDTH='80'>{0}<sup>00</sup> - {1}<sup>00</sup></td>", i + 8, i + 9);
                    for (int j = 0; j < 5; j++)
                    {
                        if (grupe[id, j, i] == 0)
                            //f << "<td WIDTH='150'>&nbsp;</td>" << endl;
                            f.WriteLine("<td WIDTH='150'>&nbsp;</td>");
                        else
                        {
                            string tip;

                            Event t = r.getEventByID(grupe[id, j, i]);
                            if (t.getLType() == 1) tip = "(p)";
                            else tip = "(v)";
                            if (i == 0 || grupe[id, j, i - 1] != grupe[id, j, i])
                            {
                                //f << "<td rowspan='" << t->getDuration() << "' WIDTH='150'>" << t->getCourse()->getName() << "  "  << t->soba  << "  "  << t->getLecturer() << "</td>" << endl;
                                f.WriteLine("<td rowspan='{0}' WIDTH='150'>{1} {2} <br /> {3}  {4}</td>", t.Duration, t.getCourse().getName(), tip, eventi[t.getID(), 1], r.findLecturer(eventi[t.getID(), 0]).getName());
                            }
                        }
                    }
                    f.WriteLine("</tr>");//f << "</tr>" << endl;
                }
                f.WriteLine("</table>");//f << "</table>" << endl;
            }
            f.WriteLine("</body>");//f << "</body>" << endl;
            f.WriteLine("</html>");//f << "</html>" << endl;
            f.Close();
        }
Пример #6
0
        public int[] evaluateSchedule( Schedule r)
        {
            score = 0;
            double suma = 0;
            double[] w = { 2, 1, 1, 7, 10};
            int[] s = { 0, 0, 0, 0, 0};
            //list<Group>::iterator it;
            //for (it = groupList.begin(); it != groupList.end(); it++) {
            //foreach (Group it in GroupList)
            for (int id = 0; id < r.GroupList.Count; id++)
            {
                for (int i = 0; i < 5; i++)
                {
                    int load = GroupDayLoad(id, i);
                    if (load > 6)
                        s[0] += (load - 6);
                   // else if (load < 3)
                    //s[0] += load;
                    s[1] += brojNula(id, i);
                    s[2] += IzaPet(id, i);
                    s[3] += GroupBrojRupa(id, i);
                    //s[5] += it.praznoPrije(i);
                }
            }

            /*            foreach (Lecturer l in LecturerList)
            {
                int brojZauaetihDana = 0;
                for (int i = 0; i < 5; i++)
                {
                    brojZauaetihDana += l.imaNastave(i);
                    s[6] += l.brojRupa(i);
                }
                if (brojZauaetihDana > 1)
                    s[5] += brojZauaetihDana;

            }*/

            /* for (int i = 0; i < 5; i++)
             {
                 for (int j = 0; j < 12; j++)
                 {
                     foreach (Classroom a in ClassroomList)
                     {
                         foreach (Classroom b in ClassroomList)
                         {
                             string x = a.getID();
                             string y = b.getID();
                             if (x != y)
                             {
                                 Event e1 = getEventByID(a.week[i,j]);
                                 Event e2 = getEventByID(b.week[i,j]);
                                 if(e1 != null && e2!=null)
                                 if (matrica[e1.getCourse().getID(), e2.getCourse().getID()] == 0)
                                     s[6]++;
                             }
                         }
                     }
                 }
             }*/
            for(int  c = 0; c < r.CourseList.Count; c++)
            {
                for(int  k = c+1; k < r.CourseList.Count; k++)
                {
                    if (r.matrica[c, k] == 0)
                    {
                        s[4] += brojPreklapanja(c, k);

                    }
                }

            }

            for (int i = 0; i < 5; i++)
                suma += (w[i] * s[i]);
            score = 1 / (1 + suma);
            return s;
        }