public void Visit(Compiled.Reification elem)
 {
     if (ArgumentIndex == 0)
     {
         if (ValueOf(elem.Condition) > 0)
         {
             LocalDerivative = 0;
         }
         else
         {
             LocalDerivative = elem.Adjoint * (elem.Max - elem.Min);                       //*elem.Max/Math.Abs(ValueOf(elem.Condition));
         }
     }
     else
     {
         if (ValueOf(elem.Condition) <= 0)
         {
             LocalDerivative = 0;
         }
         else
         {
             LocalDerivative = -elem.Adjoint * (elem.Max - elem.Min);
         }
     }
 }
 public int Visit(Reification dis)
 {
     return(Compile(dis, () =>
     {
         var conIndex = dis.Condition.Accept(this);
         var negConIndex = dis.NegatedCondition.Accept(this);
         var element = new Compiled.Reification
         {
             Min = dis.Min,
             Max = dis.Max,
             Condition = conIndex,
             NegatedCondition = negConIndex,
             Inputs = new Compiled.InputEdge[]
             {
                 new Compiled.InputEdge {
                     Index = conIndex
                 },
                 new Compiled.InputEdge {
                     Index = negConIndex
                 },
             }
         };
         return element;
     }));
 }
 public void Visit(Compiled.Reification elem)
 {
     if (ValueOf(elem.Condition) > 0)
     {
         elem.Value = elem.Max;
     }
     else
     {
         elem.Value = elem.Min;
     }
 }
Exemplo n.º 4
0
            public void Visit(Compiled.Reification elem)
            {
                double condition = ValueOf(elem.Condition);
                //double negcondition = ValueOf(elem.NegatedCondition);
                double d = elem.Max - elem.Min;

                if (condition > 0)
                {
                    elem.Value            = elem.Max;
                    elem.Inputs[0].Weight = 0;
                    elem.Inputs[0].Weight = -d;
                }
                else
                {
                    elem.Value            = elem.Min;
                    elem.Inputs[0].Weight = d;
                    elem.Inputs[0].Weight = 0;
                }
            }