예제 #1
0
        public void Test()
        {
            MoreMoney mm     = new MoreMoney();
            Solver    solver = mm.Solver;

            solver.Solve(new IntGenerate(solver,
                                         solver.IntVarList.ToArray(),
                                         IntVarSelector.CardinalityMin,
                                         new IntSearchInstantiateBest()));

            List <int> list = new List <int>();

            foreach (IntVar var in solver.IntVarList)
            {
                list.Add(var.Value);
            }

            Assert.AreEqual(list.ToArray(), new int[] { 7, 5, 1, 6, 0, 8, 9, 2, 9567, 1085, 10652, 10652 });

            int count = CountSolution(solver);

            Assert.AreEqual(count, 1);
        }
예제 #2
0
        static public void MoreMoney()
        {
            MoreMoney mm     = new MoreMoney();
            Solver    solver = mm.Solver;

            solver.PropagationQueue.Propagate();

            solver.PrintVariables();

            solver.Solve(new IntGenerate(solver,
                                         solver.IntVarList.ToArray(),
                                         IntVarSelector.CardinalityMin,
                                         new IntSearchInstantiateBest()));

            solver.PrintInformation();
            solver.PrintVariables();
            solver.PrintConstraints();

            SearchAll(solver);

            solver.PrintConstraints();
            solver.PrintInformation();
        }