public solusi init_solusi(solusi x) { x.Solusi.Add(new jadwal() { Limit = 9, Hari = "senin"}); x.Solusi.Add(new jadwal() { Limit = 10, Hari = "selasa"}); x.Solusi.Add(new jadwal() { Limit = 10, Hari = "rabu"}); x.Solusi.Add(new jadwal() { Limit = 10, Hari = "kamis"}); x.Solusi.Add(new jadwal() { Limit = 9, Hari = "Jumat"}); x.Solusi.Add(new jadwal() { Limit = 10, Hari = "sabtu"}); return x; }
public void regenerate_jam_mengajar(solusi jadwal) { for (int i = 0; i < jadwal.Solusi.Count; i++) { int start_jam = atur_jam_mengajar(i); int lim = limit(i); for (int j = 0; j < jadwal.Solusi[i].Mengajar.Count; j++) { jadwal.Solusi[i].Mengajar[j].StartMengajar = start_jam; jadwal.Solusi[i].Mengajar[j].EndMengajar = start_jam + jadwal.Solusi[i].Mengajar[j].Sks - 1; start_jam += jadwal.Solusi[i].Mengajar[j].Sks; lim -= jadwal.Solusi[i].Mengajar[j].Sks; } jadwal.Solusi[i].Limit = lim; } }
public solusi proses_movns(solusi Solusi, GLobalSolusi global) { return Solusi; }
public int Lokal_penalti_intensifikasi(mengajar job, solusi jadwal, int pos, int hari) { int penalti = 0; int limit_jadwal= limit(hari); for (int i = 0; i < jadwal.Solusi[hari].Mengajar.Count;i++) { limit_jadwal -= jadwal.Solusi[hari].Mengajar[i].Sks; } limit_jadwal -= job.Sks; if(limit_jadwal < 0){ penalti ++; int ran = rr.Next(0, jadwal.Solusi[hari].Mengajar.Count); jadwal.Solusi[hari].Mengajar[ran].Problem = true; form.Row = form.Log.NewRow(); form.Row["Status"] = "Intensifikasi Penalti"; form.Row["Keterangan"] = "Lokal Intensifikasi penalti :"+penalti; form.Log.Rows.Add(form.Row); } return penalti; }
public int local_pinalti(solusi jadwal) { int pinalti = 0; for (int i = 0; i < jadwal.Solusi.Count; i++) { //cek limit hari yang minus if (jadwal.Solusi[i].Limit < 0) { form.Row = form.Log.NewRow(); form.Row["Status"] = "Lokal Penalti"; form.Row["Keterangan"] = "Over limit hari"; form.Log.Rows.Add(form.Row); pinalti++; } //cek limit yang kurang dari 5 if (jadwal.Solusi[i].Limit > 4) { form.Row = form.Log.NewRow(); form.Row["Status"] = "Lokal Penalti"; form.Row["Keterangan"] = "sisa Limit masih banyak"; form.Log.Rows.Add(form.Row); pinalti++; } // cek hari mata pelajaran lebih dari 4 if (jadwal.Solusi[i].Mengajar.Count > 4) { form.Row = form.Log.NewRow(); form.Row["Status"] = "Lokal Penalti"; form.Row["Keterangan"] = "Jadwal Mengajar terlalu padat"; form.Log.Rows.Add(form.Row); pinalti++; } } return pinalti; }
public solusi insertion(solusi jadwal) { // flag tanda buat intesification int random = 0; for (int i = 0; i < jadwal.Solusi.Count;i++) { int prob = -1; for(int j = 0; j < jadwal.Solusi[i].Mengajar.Count;j++){ if (jadwal.Solusi[i].Mengajar[j].Problem) { prob = j; break; } } if (jadwal.Solusi[i].Mengajar.Count > 1) { random = rr.Next(0, jadwal.Solusi[i].Mengajar.Count); jadwal.Solusi[i].Mengajar.ElementAt(random).Problem = true; } } return jadwal; }