public void Visit(Compiled.Or elem)
 {
     if (ArgumentIndex == 0)
     {
         if (ValueOf(elem.Right) > 0.75)
         {
             LocalDerivative = 0;
         }
         else
         {
             LocalDerivative = elem.Adjoint;
         }
     }
     else
     {
         if (ValueOf(elem.Left) > 0.75)
         {
             LocalDerivative = 0;
         }
         else
         {
             LocalDerivative = elem.Adjoint;
         }
     }
 }
Пример #2
0
            public void Visit(Compiled.Or elem)
            {
                double left  = ValueOf(elem.Left);
                double right = ValueOf(elem.Right);

                if (left > 0.75 || right > 0.75)
                {
                    elem.Value            = 1;
                    elem.Inputs[0].Weight = 0;
                    elem.Inputs[1].Weight = 0;
                    return;
                }
                elem.Value = 0;
                if (left <= 0)
                {
                    elem.Value           += left;
                    elem.Inputs[0].Weight = 1;
                }
                else
                {
                    elem.Inputs[0].Weight = 0;
                }
                if (right <= 0)
                {
                    elem.Value           += right;
                    elem.Inputs[1].Weight = 1;
                }
                else
                {
                    elem.Inputs[1].Weight = 0;
                }
            }
 public void Visit(Compiled.Or elem)
 {
     if (ValueOf(elem.Left) > 0.75)
     {
         elem.Value = ValueOf(elem.Left);
     }
     else if (ValueOf(elem.Right) > 0.75)
     {
         elem.Value = ValueOf(elem.Right);
     }
     else
     {
         elem.Value = ValueOf(elem.Left) + ValueOf(elem.Right);
     }
 }
 public int Visit(Or or)
 {
     return(Compile(or, () =>
     {
         var leftIndex = or.Left.Accept(this);
         var rightIndex = or.Right.Accept(this);
         var element = new Compiled.Or
         {
             Left = leftIndex,
             Right = rightIndex,
             Inputs = new Compiled.InputEdge[]
             {
                 new Compiled.InputEdge {
                     Index = leftIndex
                 },
                 new Compiled.InputEdge {
                     Index = rightIndex
                 },
             }
         };
         return element;
     }));
 }