Exemple #1
0
 public DuplicateChecker(DBManip db)
 {
     members = new Dictionary <string, int>();
     keys    = new List <string>();
     foreach (var prof in db.Examiners())
     {
         members.Add(prof, 0);
         keys.Add(prof);
     }
 }
Exemple #2
0
 public Excel2DB(string dbfilename)
 {
     try
     {
         DB = new DBManip(dbfilename);
     } catch
     {
         throw new DatabaseException("データベースが開けません:" + dbfilename);
     }
 }
Exemple #3
0
        public string ToCSV(DBManip db)
        {
            var str = new StringBuilder();

            a(str, Id.ToString());
            a(str, Degree);
            a(str, Student_No);
            a(str, Department);
            a(str, Student_Name);
            a(str, Paper_Title);
            for (int i = 0; i < 5; i++)
            {
                if (Referee_id[i] == -1)
                {
                    a(str, "", true);
                    break;
                }
                a(str, db.GetProfessorName(Referee_id[i]), i == 4);
            }
            return(str.ToString());
        }
Exemple #4
0
        public AlignmentOptimizer(DBManip db, int max_slot)
        {
            this.max_slot    = max_slot;
            this.db          = db;
            n_event          = db.EventCount();
            n_prof           = db.ProfessorCount();
            event_availslots = new AvailableSlots(n_event, max_slot);
            prof_availslots  = new bool[n_prof, max_slot];
            // 初期化
            for (int j = 0; j < max_slot; j++)
            {
                for (int i = 0; i < n_prof; i++)
                {
                    prof_availslots[i, j] = true;
                }
            }
            // 不都合日程読み込み
            for (int slot = 0; slot < max_slot; slot++)
            {
                var profs = db.GetProhibitProfs(slot + 1); // slotはoption base 1
                foreach (var p in profs)                   // p はoption base 1
                {
                    prof_availslots[p - 1, slot] = false;
                }
            }
            // イベントごとに可能なスロットを計算
            bool[] avail     = new bool[max_slot];
            var    all_event = new List <DefenseEvent>();

            foreach (DefenseEvent ev in db.EachEvent())
            {
                all_event.Add(ev);
                for (int i = 0; i < max_slot; i++)
                {
                    avail[i] = true;
                }
                foreach (var p in ev.Referee_id) // pはoption base 1
                {
                    if (p == -1)
                    {
                        break;
                    }
                    for (int i = 0; i < max_slot; i++)
                    {
                        avail[i] = (avail[i] && prof_availslots[p - 1, i]);
                    }
                }
                for (int i = 0; i < max_slot; i++)
                {
                    if (!avail[i])
                    {
                        event_availslots.UnAvailable(ev.Id - 1, i);   // ev.Idもoption base 1
                    }
                }
            }
            // 可能なスロットがないイベントがあるかどうかチェック
            event_availslots.CalcSummary();

            // 割り当て不能イベントを書き出す
            if (event_availslots.Impossible)
            {
                writeImpossible();
            }
            // 割り当て可能数が小さい方から処理する
            event_availslots.Sort();
            // 同時に開催できないイベントを調査
            // とりあえず最初に可能なスロットに全イベントを割付
            Slotevent = new SlotEvent(max_slot, n_event, all_event, event_availslots);
        }