Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     mTasks    = null;
     heuristicCmbBox.Items.Add("ID");
     heuristicCmbBox.Items.Add("EDD");
     heuristicCmbBox.Items.Add("MDD");
     heuristicCmbBox.Items.Add("AU");
     heuristicCmbBox.SelectedItem = "ID";
     mTimer = new Stopwatch();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Ustaw mrowisko do ktorego mrowka nalezy oraz ustawia odpowiednia heurystyke
        /// </summary>
        /// <param name="home">Mrowisko-matka :P</param>
        public void Home(AntHill home)
        {
            mHome = home;
            mSize = home.Tasks.Size;
            mTasks = home.Tasks;

            switch (mTasks.mHeuristic)
            {
                case "EDD":
                    mChooseWay = new DChooseWay(HeuristicWay);
                    heura = new DMiniHeura(heura_edd);
                    break;
                case "MDD":
                    mChooseWay = new DChooseWay(HeuristicWay);
                    heura = new DMiniHeura(heura_mdd);
                    break;
                case "AU":
                    mChooseWay = new DChooseWay(HeuristicWay_AU);
                    break;
                default:
                    mChooseWay = new DChooseWay(RandomWay);
                    break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ustawia odpowiednie parametry
        /// </summary>
        /// <param name="tasks">Zadanie do rozwiazania</param>
        /// <param name="anthillsCount">liczba mrowisk</param>
        /// <param name="iter">liczba przebiegow w mrowisku zanim dojdzie do wymieszania feromonow</param>
        /// <param name="ants">liczba niezaleznych mrowek w mrowisku</param>
        /// <param name="evaporation">wspolczynnik parowania</param>
        public void Setup(TasksInfo tasks, int anthillsCount, int iter, int ants, double evaporation, BackgroundWorker bg)
        {
            mIter = iter;
            mAnts = ants;
            mEvap = evaporation;
            mTasks = tasks;
            mHillsCount = anthillsCount;
            mBG = bg;

            mHills = new AntHill[mHillsCount];
            mBestPath = new List<int>();

            Restart();
        }
Ejemplo n.º 4
0
        private void openFromFile_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // wczytaj dane
                mTasks = new TasksInfo();
                mTasks.LoadFromFile(openFileDialog.FileName);
                mTasks.setCurrentInstance(0);
                for (int i = 0; i < mTasks.InstanceCount; ++i)
                {
                    instanceCmbBox.Items.Add(i);
                }
                instanceCmbBox.SelectedItem = 0;

                bStart.Enabled = true;
            }
        }
Ejemplo n.º 5
0
        private void generate_Click_1(object sender, EventArgs e)
        {
            // wygeneruj losowo dane
            mTasks = new TasksInfo();

            Random rnd = new Random();

            for (int i = 0; i < 10; ++i)
            {
                mTasks.mDeadlines.Add(rnd.Next(10, 100));
                mTasks.mExecutionTime.Add(rnd.Next(5, 25));
                mTasks.mWages.Add(rnd.Next(1, 2));
            }
            mTasks.Size = 10;

            bStart.Enabled = true;
            tbInfo.AppendText("Dane: losowe " + "\n", Color.SeaGreen);
        }