public void TestAssignment3()
 {
     EncogProgram expression = new EncogProgram("v1+v2+v3");
     expression.Variables.SetVariable("v1", 1);
     expression.Variables.SetVariable("v2", 2);
     expression.Variables.SetVariable("v3", 3);
     Assert.AreEqual(6, expression.Evaluate().ToFloatValue(), EncogFramework.DefaultDoubleEqual);
 }
 public void TestAssignment2()
 {
     EncogProgram expression = new EncogProgram("cccc*(aa+bbb)");
     expression.Variables.SetVariable("aa", 1);
     expression.Variables.SetVariable("bbb", 2);
     expression.Variables.SetVariable("cccc", 3);
     Assert.AreEqual(9, expression.Evaluate().ToFloatValue(), EncogFramework.DefaultDoubleEqual);
 }
 /// <summary>
 ///     Parse the specified program, or expression, and return the result. No
 ///     variables can be defined for this as a default context is used. The
 ///     result is returned as a string.
 /// </summary>
 /// <param name="str">The program expression value.</param>
 /// <returns>The value the expression was evaluated to.</returns>
 public static String ParseString(String str)
 {
     var holder = new EncogProgram(str);
     return holder.Evaluate().ToStringValue();
 }
 /// <summary>
 ///     Parse the specified program, or expression, and return the result. No
 ///     variables can be defined for this as a default context is used. The
 ///     result is returned as a float.
 /// </summary>
 /// <param name="str">The program expression value.</param>
 /// <returns>The value the expression was evaluated to.</returns>
 public static double ParseFloat(String str)
 {
     var holder = new EncogProgram(str);
     return holder.Evaluate().ToFloatValue();
 }
 /// <summary>
 ///     Parse the specified program, or expression, and return the result. No
 ///     variables can be defined for this as a default context is used. The
 ///     result is returned as a boolean.
 /// </summary>
 /// <param name="str">The program expression.</param>
 /// <returns>The value the expression was evaluated to.</returns>
 public static ExpressionValue ParseExpression(String str)
 {
     var holder = new EncogProgram(str);
     return holder.Evaluate();
 }
 /// <summary>
 ///     Parse the specified program, or expression, and return the result. No
 ///     variables can be defined for this as a default context is used. The
 ///     result is returned as a boolean.
 /// </summary>
 /// <param name="str">The program expression.</param>
 /// <returns>The value the expression was evaluated to.</returns>
 public static bool ParseBoolean(String str)
 {
     var holder = new EncogProgram(str);
     return holder.Evaluate().ToBooleanValue();
 }
 public void testVarComplex()
 {
     EncogProgram expression = new EncogProgram("(x^((1+((x^-8)-(4^x)))^(((-7/2)-(0--5.8))/x)))");
     expression.Variables.SetVariable("x", 10);
     Assert.IsTrue(Double.IsNaN(expression.Evaluate().ToFloatValue()));
 }
 public void TestNegAssignment()
 {
     EncogProgram expression = new EncogProgram("-a");
     expression.Variables.SetVariable("a", 5);
     Assert.AreEqual(-5, expression.Evaluate().ToFloatValue(), EncogFramework.DefaultDoubleEqual);
 }
        /// <summary>
        ///     Parse the specified program, or expression, and return the result. No
        ///     variables can be defined for this as a default context is used. The
        ///     result is returned as a string.
        /// </summary>
        /// <param name="str">The program expression value.</param>
        /// <returns>The value the expression was evaluated to.</returns>
        public static String ParseString(String str)
        {
            var holder = new EncogProgram(str);

            return(holder.Evaluate().ToStringValue());
        }
        /// <summary>
        ///     Parse the specified program, or expression, and return the result. No
        ///     variables can be defined for this as a default context is used. The
        ///     result is returned as a float.
        /// </summary>
        /// <param name="str">The program expression value.</param>
        /// <returns>The value the expression was evaluated to.</returns>
        public static double ParseFloat(String str)
        {
            var holder = new EncogProgram(str);

            return(holder.Evaluate().ToFloatValue());
        }
        /// <summary>
        ///     Parse the specified program, or expression, and return the result. No
        ///     variables can be defined for this as a default context is used. The
        ///     result is returned as a boolean.
        /// </summary>
        /// <param name="str">The program expression.</param>
        /// <returns>The value the expression was evaluated to.</returns>
        public static ExpressionValue ParseExpression(String str)
        {
            var holder = new EncogProgram(str);

            return(holder.Evaluate());
        }
        /// <summary>
        ///     Parse the specified program, or expression, and return the result. No
        ///     variables can be defined for this as a default context is used. The
        ///     result is returned as a boolean.
        /// </summary>
        /// <param name="str">The program expression.</param>
        /// <returns>The value the expression was evaluated to.</returns>
        public static bool ParseBoolean(String str)
        {
            var holder = new EncogProgram(str);

            return(holder.Evaluate().ToBooleanValue());
        }