GetIntValue() публичный Метод

Returns the integer value of the given variable in the solution.
public GetIntValue ( Variable v ) : int
v Variable the variable ///
Результат int
Пример #1
0
 //UPGRADE_NOTE: Synchronized keyword was removed from method 'solved'. Lock expression was added. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1027'"
 public virtual void Solved(Solver solver, Solution solution)
 {
     lock (this)
     {
         if (solution != null)
         {
             int xv = solution.GetIntValue(x);
             int yv = solution.GetIntValue(y);
             Console.Out.WriteLine("x = " + xv + ", y = " + yv);
         }
     }
 }
Пример #2
0
 internal static void printSolution(Solution solution)
 {
     for (int i = 0; i < m; i++)
     {
         for (int j = 0; j < n; j++)
         {
             String s;
             if (v[i][j] == null)
             {
                 s = puzzle[i][j];
             }
             else
             {
                 int x = solution.GetIntValue(v[i][j]);
                 s = (x == 0) ? "-" : "*";
             }
             Console.Out.Write(s + " ");
         }
         Console.Out.WriteLine();
     }
     Console.Out.WriteLine();
 }
Пример #3
0
 private void doItOnce()
 {
     Session.Clear();
     net = new Network();
     John = new AllenVariable(net, 0, 40, 30, "John");
     Mary = new AllenVariable(net, 35, 60, 20, "Mary");
     Wendy = new AllenVariable(net, 0, 60, 50, "Wendy");
     Soccer = new AllenVariable(net, 30, 135, 105, "Soccer");
     John.Equals(Mary);
     John.Starts(Mary);
     John.StartedBy(Mary);
     John.Meets(Mary);
     John.Equals(Wendy);
     John.Starts(Wendy);
     John.StartedBy(Wendy);
     John.Meets(Wendy);
     John.Overlaps(Soccer);
     Mary.Finishes(Wendy);
     Mary.FinishedBy(Wendy);
     Mary.During(Soccer);
     Mary.Contains(Soccer);
     AllenDomain ad0 = (AllenDomain)(John.Domain);
     AllenDomain ad1 = (AllenDomain)(Mary.Domain);
     AllenDomain ad2 = (AllenDomain)(Wendy.Domain);
     AllenDomain ad3 = (AllenDomain)(Soccer.Domain);
     solver = new AllenSolver(net);
     for (solver.Start(); solver.WaitNext(); solver.Resume())
     {
         solution = solver.Solution;
         Session["jd"] = ad0.Duration;
         Session["md"] = ad1.Duration;
         Session["wd"] = ad2.Duration;
         Session["sd"] = ad3.Duration;
         Session["js" + Convert.ToInt16(counter)] = solution.GetIntValue(John);
         Session["ms" + Convert.ToInt16(counter)] = solution.GetIntValue(Mary);
         Session["ws" + Convert.ToInt16(counter)] = solution.GetIntValue(Wendy);
         Session["ss" + Convert.ToInt16(counter)] = solution.GetIntValue(Soccer);
         Session["jp" + Convert.ToInt16(counter)] = ad0.Duration;
         Session["mp" + Convert.ToInt16(counter)] = ad1.Duration;
         Session["wp" + Convert.ToInt16(counter)] = ad2.Duration;
         Session["sp" + Convert.ToInt16(counter)] = ad3.Duration;
         Session["jn" + Convert.ToInt16(counter)] = solution.GetIntValue(John).ToString();
         Session["mn" + Convert.ToInt16(counter)] = solution.GetIntValue(Mary).ToString();
         Session["wn" + Convert.ToInt16(counter)] = solution.GetIntValue(Wendy).ToString();
         Session["sn" + Convert.ToInt16(counter)] = solution.GetIntValue(Soccer).ToString();
         counter += 1;
     }
     Session["done"] = true;
     Session["total"] = counter;
     Session["counter"] = 0;
     total.Text = "There are " + counter + " solutions";
     counter = 0;
     Display();
     Button1.Enabled = true;
     Button2.Enabled = true;
     Button3.Enabled = true;
     Button4.Enabled = true;
     if (Convert.ToInt16(Session["counter"]) == 0)
     {
         Button1.Enabled = false;
         Button2.Enabled = false;
     }
     if (Convert.ToInt16(Session["counter"]) == Convert.ToInt16(Session["total"]) - 1)
     {
         Button3.Enabled = false;
         Button4.Enabled = false;
     }
 }