Example #1
0
        //! finisch and clean up after Schedule Calculation

        /*!
         * Save calculated contactwindows to file if enabled
         * Calculate fairness values
         * Display information on Form
         */
        private void finischSchedule(string schedulerName, string logfile, int number = 0, bool bruteForce = false)
        {
            //Draw scheduled data to Main form
            pictureBox2.Image  = Drawer.ContactsDrawer.drawContacts(contactsVector, false);
            pictureBox2.Width  = pictureBox2.Image.Width;
            pictureBox2.Height = pictureBox2.Image.Height;

            //check if auto save of images is enabled
            //if yes then save files
            if (Properties.Settings.Default.global_AutoSave && Properties.Settings.Default.global_SaveSchedule)
            {
                string savePath   = Properties.Settings.Default.global_Save_Path;
                Image  contImages = Drawer.ContactsDrawer.drawContacts(contactsVector, false);
                if (radioEFTGreedy.Checked)
                {
                    contImages.Save(savePath + "\\" + logfile + "-Scheduled-EFT-Greedy-" + number + ".bmp");
                }
                if (radioGreedy.Checked)
                {
                    contImages.Save(savePath + "\\" + logfile + "-Scheduled-Fair-Greedy-" + number + ".bmp");
                }
                if (radioGenetic.Checked)
                {
                    contImages.Save(savePath + "\\" + logfile + "-Scheduled-Genetic-" + number + ".bmp");
                }
                updateLog(logfile, "Saved Calculated Schedule to Image (bmp) " + savePath + "\\" + logfile);
            }

            if (Properties.Settings.Default.log_AutoSave_Results)
            {
                List <string> results = new List <string>();
                results.Add("RunNumber: " + number);
                results.Add("Fitness Value:" + objectivefunct.getObjectiveResults().ToString());
                results.Add("Scheduled Contacts: " + fitnessLabel.Text + " / " + contactsVector.Count().ToString());
                results.Add("Collisions: " + collisionLabel.Text);
                results.Add("Fairnes Stations: " + stationFairLabel.Text);
                results.Add("Fairnes Satellites: " + fairSatLabel.Text);
                results.Add("Duration: " + durationLabel.Text + " sec.");
                results.Add("Calculation Time: " + calcTimeLabel.Text);
                results.Add("Scheduled per priority: " + uweLabel.Text);
                Log.writeResults(logfile, schedulerName, results);
                updateLog(logfile, "Results have been saved to File");
            }
            updateLog(logfile, "Done");
        }
Example #2
0
        //! add ContactWindows

        /*!
         *  \param ContactWindowsVector adds a ContactsWindowsVector
         */
        public void add(ContactWindowsVector contacts)
        {
            if (!contacts.isEmpty())
            {
                for (int i = 0; i < contacts.Count(); i++)
                {
                    contactsList.Add(contacts.getAt(i));
                }
            }
            updateNamesList();
            calcualteTimesOfAllContacst();
        }