Exemplo n.º 1
0
        static void StaticReset()
        {
#if SIMPLESOLVER
            solver    = null;
            goal      = 0;
            numOfRows = -1;
#else  // SIMPLESOLVER
            solution = null;
            Context.ClearModel();
            model = Context.CreateModel();
            Constraints.Clear();
            goalTerm = null;
            solution = null;
            goal     = null;
#endif // SIMPLESOLVER
        }
Exemplo n.º 2
0
 static bool Solve()
 {
     if (null != goal)
     {
         model.RemoveGoal(goal);
     }
     if (null == (object)goalTerm)
     {
         goalTerm = 0;
     }
     goal     = model.AddGoal("goal", SfServ.GoalKind.Minimize, goalTerm);
     solution = Context.Solve();
     if (TestGlobals.VerboseLevel >= 2)
     {
         SfServ.Report report = solution.GetReport();
         System.Diagnostics.Debug.WriteLine(report.ToString());
     }
     return(solution.Quality == SfServ.SolverQuality.Optimal);
 }
        static void StaticReset()
        {
#if SIMPLESOLVER
            solver = null;
            goal = 0;
            numOfRows = -1;
#else  // SIMPLESOLVER
            solution = null;
            Context.ClearModel();
            model = Context.CreateModel();
            Constraints.Clear();
            goalTerm = null;
            solution = null;
            goal = null;
#endif // SIMPLESOLVER
        }
 static bool Solve()
 {
     if (null != goal)
     {
         model.RemoveGoal(goal);
     }
     if (null == (object)goalTerm)
     {
         goalTerm = 0;
     }
     goal = model.AddGoal("goal", SfServ.GoalKind.Minimize, goalTerm);
     solution = Context.Solve();
     if (TestGlobals.VerboseLevel >= 2)
     {
         SfServ.Report report = solution.GetReport();
         Console.WriteLine(report.ToString());
     }
     return solution.Quality == SfServ.SolverQuality.Optimal;
 }