public void RunAlgo()
        {
            Console.WriteLine(Solver.NumConstraints());


            var resultStatus = Solver.Solve();



            SchedulingResultGraph resultGraph = SchedulingResultGraph.Create(Assignments);

//          resultGraph.WriteToConsole();

            Console.WriteLine(Solver.Objective().Value());
        }
示例#2
0
        public static SchedulingResultGraph Create(List <Assignment> assignments)
        {
            SchedulingResultGraph resultGraph = new SchedulingResultGraph();

            foreach (var assignment in assignments)
            {
                resultGraph.Persons.Add(assignment.Person);
                resultGraph.Shifts.Add(assignment.Shift);
                if (Math.Abs(assignment.assigningGraphEdge.SolutionValue() - 1.0) < double.Epsilon)
                {
                    if (resultGraph.Assignments.ContainsKey(assignment.Person.ID))
                    {
                        resultGraph.Assignments[assignment.Person.ID].Add(assignment);
                    }
                    else
                    {
                        resultGraph.Assignments.Add(assignment.Person.ID, new List <Assignment>());
                        resultGraph.Assignments[assignment.Person.ID].Add(assignment);
                    }
                }
            }
            return(resultGraph);
        }