コード例 #1
0
        public int HitFitness(int jml_mesin, int no_kromosom, int[][] wkt_proses, int[] ready_time)
        {
            CDecoding Jadwal = new CDecoding(jml_mesin);

            fitness = 0;

            List <string> A = Jadwal.SetHimpunan_A(kromosom[no_kromosom]);

            Jadwal.SortHimpunan_A(A);

            List <int> t = new List <int>();

            for (int i = 0; i < ready_time.Length; i++)
            {
                t.Add(ready_time[i]);
            }

            for (int i = 0; i < kromosom[no_kromosom].Length; i++)
            {
                for (int j = 0; j < kromosom[no_kromosom][i].Count; j++)
                {
                    int           index = Jadwal.CekTime_t(t, kromosom[no_kromosom], A);
                    int           mesin = Jadwal.NoMesin_M(kromosom[no_kromosom], A, index);
                    List <string> B     = Jadwal.SetHimpunan_B(kromosom[no_kromosom], A, index, mesin, t);

                    t = Jadwal.UpdateTime_t(t, A, index, mesin, wkt_proses, kromosom[no_kromosom]);
                    A = Jadwal.UpdateHimpunan_A(A, index, kromosom[no_kromosom]);
                }
            }
            fitness = Jadwal.GetMakespan(ready_time);

            return(fitness);
        }
コード例 #2
0
ファイル: CTabuSearch.cs プロジェクト: andrehalley6/jobshop
        public int HitNilaiEvaluasi(int idx, int jml_mesin, int[][] wkt_proses, int[] ready_time)
        {
            CDecoding Jadwal = new CDecoding(jml_mesin);

            evaluation[idx] = 0;

            List <string> A = Jadwal.SetHimpunan_A(candidate[idx]);

            Jadwal.SortHimpunan_A(A);

            List <int> t = new List <int>();

            for (int i = 0; i < ready_time.Length; i++)
            {
                t.Add(ready_time[i]);
            }

            for (int i = 0; i < candidate[idx].Length; i++)
            {
                for (int j = 0; j < candidate[idx][i].Count; j++)
                {
                    int           index = Jadwal.CekTime_t(t, candidate[idx], A);
                    int           mesin = Jadwal.NoMesin_M(candidate[idx], A, index);
                    List <string> B     = Jadwal.SetHimpunan_B(candidate[idx], A, index, mesin, t);

                    t = Jadwal.UpdateTime_t(t, A, index, mesin, wkt_proses, candidate[idx]);
                    A = Jadwal.UpdateHimpunan_A(A, index, candidate[idx]);
                }
            }

            return(evaluation[idx] = Jadwal.GetMakespan(ready_time));
        }
コード例 #3
0
        public int Makespan(List <string>[] kromosom, int jml_job, int jml_mesin)
        {
            CDecoding     Jadwal = new CDecoding(jml_mesin);
            List <string> A      = Jadwal.SetHimpunan_A(kromosom);

            Jadwal.SortHimpunan_A(A);

            List <int> t = new List <int>();

            for (int i = 0; i < ready_time.Length; i++)
            {
                t.Add(ready_time[i]);
            }

            for (int i = 0; i < kromosom.Length; i++)
            {
                for (int j = 0; j < kromosom[i].Count; j++)
                {
                    int           index   = Jadwal.CekTime_t(t, kromosom, A);
                    int           mesin   = Jadwal.NoMesin_M(kromosom, A, index);
                    List <string> UpdateB = Jadwal.SetHimpunan_B(kromosom, A, index, mesin, t);

                    t = Jadwal.UpdateTime_t(t, A, index, mesin, waktu_proses, kromosom);
                    A = Jadwal.UpdateHimpunan_A(A, index, kromosom);
                }
            }

            return(Jadwal.GetMakespan(ready_time));
        }
コード例 #4
0
        private void BtnGenerateJadwal_Click_1(object sender, EventArgs e)
        {
            CMemetic Memetic = new CMemetic();

            if (CekInputUser())
            {
                TimeSpan left = new TimeSpan(DateTime.Now.Ticks);
                BtnGenerateJadwal.Enabled = false;
                Memetic.Waktu_Proses      = this.GetWktProses();
                Memetic.Ready_Time        = this.GetReadyTime();
                Memetic.Proses            = this.GetProses();

                List <string>[][] kromosom = Memetic.MemeticAlgorithm((int)NUDJmlJob.Value, (int)NUDJmlMesin.Value, (int)NUDGeneticMaxGenerasi.Value, (int)NUDGeneticJmlPopulasi.Value, (int)NUDGeneticPc.Value, (int)NUDGeneticPm.Value, (int)NUDIterasiTS.Value, (int)NUDTabuList.Value);
                int idx_kro = Memetic.getIndex(kromosom, (int)NUDJmlJob.Value, (int)NUDJmlMesin.Value);

                GC = new FormGanttChart((int)NUDJmlMesin.Value);

                CDecoding     Jadwal = new CDecoding((int)NUDJmlMesin.Value);
                List <string> A      = Jadwal.SetHimpunan_A(kromosom[idx_kro]);
                Jadwal.SortHimpunan_A(A);
                List <int> t = new List <int>();
                for (int i = 0; i < Memetic.Ready_Time.Length; i++)
                {
                    t.Add(Memetic.Ready_Time[i]);
                }

                for (int i = 0; i < kromosom[idx_kro].Length; i++)
                {
                    for (int j = 0; j < kromosom[idx_kro][i].Count; j++)
                    {
                        int           index   = Jadwal.CekTime_t(t, kromosom[idx_kro], A);
                        int           mesin   = Jadwal.NoMesin_M(kromosom[idx_kro], A, index);
                        List <string> UpdateB = Jadwal.SetHimpunan_B(kromosom[idx_kro], A, index, mesin, t);

                        string index_proses = A[index].Split('-')[1];
                        string index_job    = A[index].Split('-')[0];

                        GC.addProcess(UpdateB[0], t[index], Memetic.Waktu_Proses[Convert.ToInt32(index_job) - 1][Convert.ToInt32(index_proses) - 1], mesin);

                        t = Jadwal.UpdateTime_t(t, A, index, mesin, Memetic.Waktu_Proses, kromosom[idx_kro]);
                        A = Jadwal.UpdateHimpunan_A(A, index, kromosom[idx_kro]);
                    }
                }


                BtnGenerateJadwal.Enabled = true;
                TimeSpan right = new TimeSpan(DateTime.Now.Ticks);
                MessageBox.Show("Total time : " + right.Subtract(left));
                GC.ShowDialog();
                MessageBox.Show("Makespan : " + Memetic.Makespan(kromosom[idx_kro], (int)NUDJmlJob.Value, (int)NUDJmlMesin.Value));
            }
        }