public SolverDataManager(ProjectDataSet model, ConstraintSolverResult data)
        {
            _model = model;
            _solverResult = data;

            var jobFactory = new JobFactory();
            var skillFactory = new SkillFactory();
            var workerFactory = new WorkerFactory();
            var toolFactory = new ToolFactory();
            var zoneFactory = new ZoneFactory();
            var shiftFactory = new ShiftFactory();
            
            var shiftConverter = new ShiftConverter(shiftFactory);
            var skillConverter = new SkillConverter(skillFactory);
            var toolConverter = new ToolConverter(toolFactory, shiftConverter);
            var zoneConverter = new ZoneConverter(zoneFactory);
            var laborConverter = new LaborConverter(workerFactory, shiftConverter, skillConverter);
            var jobConverter = new JobConverter(jobFactory, skillConverter, toolConverter, zoneConverter);

            _shiftManager = new ShiftManager(shiftConverter, skillConverter, laborConverter, toolConverter);
            _jobManager = new JobManager(jobConverter);
            _zoneManager = new ZoneManager(zoneConverter);
        }
示例#2
0
        private const int MaxIterationCount = 24*60*365*4; // 4 years of minutes
        protected IEnumerable<IScheduledJob> Solve(
            List<IShift> shifts, 
            List<IWorker> workers, 
            List<ITool> tools, 
            IEnumerable<IZone> zones, 
            IEnumerable<IJob> jobs, 
            GreedyActivityStrategy strategy,
            ShiftManager shiftManager)
        {
            _shiftManager = shiftManager;
            _strategy = strategy;
            _jobPriorityFunction = new SlackTimeRemainingJobPriorityFunction();

            if (shifts.Count > 0)
            {
                _shifts = shifts.ToArray();
                SetupWorkers(shifts, workers);
                SetupTools(shifts, tools);
            }

            SetupZones(zones);

            SetupJobs(jobs);

            _timepoints = new Dictionary<int, List<InWorkEvent>>();
            _inWorkEvents = new List<InWorkEvent>();

            int iteration = InitializeNextIteration(_shifts[0]);

            while (_jobs.Any() && iteration < MaxIterationCount)
            {
                // check to see if we have any events expiring
                ProcessCompletingJobs(iteration);
                
                // check to see if we have any new jobs we can work on
                ProcessJobs(iteration);

                // increment iteration counter
                iteration++;
            }

            // we're done!
            return BuildSchedule();
        }