コード例 #1
0
 public Solver(string target)
 {
     Target = target;
     try
     {
         tree = new SolverLanguageTree(target);
     }
     catch (FormatException e)
     {
         Console.WriteLine($"Format error:{e.Message}\n");
     }
 }
コード例 #2
0
        internal Binding FindFixPoint(SolverLanguageTree tree, Binding binding)
        {
            int          count = 0;
            const double win   = 0.0000001;

            while (Math.Abs(tree.Eval(binding) - binding.GetBind(binding.GetMagic())) > win)
            {
                binding.SetBind(binding.GetMagic(), tree.Eval(binding));
                count++;
                if (count > MaxIteration)
                {
                    return(null);
                }
            }
            return(binding);
        }