Пример #1
0
        //! calculate the fitness value of the given contactvectors if a contact is added

        /*!
         * \param ContactWindowsVector contact windows to check
         * \param CotnactWindowsVector contacts of the complete problem
         * \param int max number of Contacts of the Scheduling problem
         * \param ContactWindow to add
         */
        // Call to calculate Objective Values for Fitness
        public void calculateValues(ContactWindowsVector currentSolution, ContactWindowsVector completeContacts, int numberOfAllContacts,
                                    ContactWindow contactToAdd)
        {
            currentSolution.add(contactToAdd);
            calculate(currentSolution, calcualteMaxPrioValue(completeContacts), numberOfAllContacts, null, completeContacts);
            currentSolution.deleteAt(currentSolution.Count() - 1);
        }
        private bool checkCollision(ContactWindow a, ContactWindow b)
        {
            bool res = false;

            res = a.checkConflikt(b) && a.getStationName() == b.getStationName() &&
                  a.getSheduledInfo() && b.getSheduledInfo();
            return(res);
        }
Пример #3
0
        //! Check if this item Conflicts with another

        /*!
         * \param ContactWindow
         * \return bool true if the contacttime of both object collide
         */
        public bool checkConflikt(ContactWindow window)
        {
            bool startyear = startTime.getYear() == window.getStartTime().getYear();
            bool stopyear  = stopTime.getYear() == window.getStopTime().getYear();

            if (startyear || stopyear)
            {
                if (startTime.getEpoch() >= window.getStartTime().getEpoch() &&
                    stopTime.getEpoch() <= window.getStopTime().getEpoch())
                {
                    return(true);
                }
                if (stopTime.getEpoch() >= window.getStopTime().getEpoch() &&
                    startTime.getEpoch() <= window.getStartTime().getEpoch())
                {
                    return(true);
                }
                if (startTime.getEpoch() >= window.getStartTime().getEpoch() &&
                    startTime.getEpoch() <= window.getStopTime().getEpoch() &&
                    stopTime.getEpoch() >= window.getStopTime().getEpoch())
                {
                    return(true);
                }
                if (startTime.getEpoch() <= window.getStartTime().getEpoch() &&
                    stopTime.getEpoch() >= window.getStopTime().getEpoch())
                {
                    return(true);
                }
                if (stopTime.getEpoch() >= window.getStartTime().getEpoch() &&
                    stopTime.getEpoch() <= window.getStopTime().getEpoch())
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
        //! Assign a Request to a Contact

        /*!
         *  \param ContactWindow contact
         *  \param Guid Request-ID
         */
        public void assignRequestToContact(ContactWindow contact, Guid requestID)
        {
            contact.setRequestID(requestID);
            contact.setExclusion(false);
        }