public void GeneticAlgorithmConstructorTest1() { EvaluationIF e = new DoubleEvaluation_Trigonometric(); GeneticAlgorithm target = new GeneticAlgorithm(e); Assert.IsNotNull(target.Operations); Assert.IsNotNull(target.Initialization); Assert.IsNotNull(target.Evaluation); }
public void SetPointValueTest() { DoubleEvaluation_Trigonometric target = new DoubleEvaluation_Trigonometric(); // TODO: Initialize to an appropriate value Point p = new DoublePoint(5); Point actual; actual = target.SetPointValue(p); double x = actual.Value - 1.6093609892947054; Assert.IsTrue(Math.Abs(x) < 0.0001); }
public void GeneticAlgorithmConstructorTest() { List <Operator> operators = new List <Operator>(); SelectionIF S = new Selection_PercentAboveAverage(50); CrossoverIF C2 = new DoubleCrossover_Random(); MutationIF M = new DoubleMutation_ValuePercent(5.0); operators.Add(S); operators.Add(C2); operators.Add(M); double[] p1 = { 0.0, 0.0 }; double[] p2 = { 5.0, 5.0 }; InitializationIF initialization = new DoubleInitialization_RandomBetweenTwoPoints( new DoublePoint(p1), new DoublePoint(p2), 10); EvaluationIF evaluation = new DoubleEvaluation_Trigonometric(); GeneticAlgorithm target = new GeneticAlgorithm(operators, initialization, evaluation); Assert.IsNotNull(target.Operations); Assert.IsNotNull(target.Initialization); Assert.IsNotNull(target.Evaluation); }
public void DoubleEvaluation_TrigonometricConstructorTest() { DoubleEvaluation_Trigonometric target = new DoubleEvaluation_Trigonometric(); Assert.AreEqual(target.Type, OperatorType.Double); }