Ejemplo n.º 1
0
        private int GetFitnessForSolutionPair(ISolutionPair pair, List <ISolutionPair> solutionPairs)
        {
            WorkerMan workerMan = pair.WorkerMan;
            WorkToDo  workToDo  = pair.WorkToDo;

            //int maxWork = workerMan.WorkingMinutes;
            //var thisMenAllWorkTime =
            //    solutionPairs
            //    .Where(x => x.WorkerMan == workerMan)
            //    .Select(x => x.WorkerMan.WorkingTimeByComplexity(x.WorkToDo.Complexity)).Sum();
            //if (thisMenAllWorkTime > maxWork)
            //{
            //    return ((workerMan.WorkingTimeByComplexity(workToDo.Complexity) / workerMan.Quality)+1) * 1000; //ha nem fér bele a munka idejébe, akkor durván lehúzzuk
            //}
            //else
            //{
            return(workerMan.WorkingTimeByComplexity(workToDo.Complexity) / workerMan.Quality);      // idő/minőség = fitnessz
            //  }
        }
Ejemplo n.º 2
0
        private int GetOverWorkAllTimeForWorker(WorkerMan worker, List <ISolutionPair> solutionPairs)
        {
            int all = 0;

            foreach (var item in solutionPairs)
            {
                if (item.WorkerMan == worker)
                {
                    all += worker.WorkingTimeByComplexity(item.WorkToDo.Complexity);
                }
            }

            if (worker.WorkingMinutes < all)
            {
                return(all - worker.WorkingMinutes);
            }

            return(0);
        }