void TestObjectiveFunctional::test_calculate_independent_parameters_gradient_central_differences(void) { message += "test_calculate_independent_parameters_gradient_central_differences\n"; MultilayerPerceptron mlp; MockObjectiveFunctional mof(&mlp); int independent_parameters_number; Vector<double> independent_parameters_gradient; // Test mlp.set(); independent_parameters_number = mlp.get_independent_parameters_number(); independent_parameters_gradient = mof.calculate_independent_parameters_gradient_central_differences(); assert_true(independent_parameters_gradient.get_size() == independent_parameters_number, LOG); // Test mlp.set(1,1,1); independent_parameters_number = mlp.get_independent_parameters_number(); independent_parameters_gradient = mof.calculate_independent_parameters_gradient_central_differences(); assert_true(independent_parameters_gradient.get_size() == independent_parameters_number, LOG); // Test mlp.set(1); independent_parameters_number = mlp.get_independent_parameters_number(); independent_parameters_gradient = mof.calculate_independent_parameters_gradient_central_differences(); assert_true(independent_parameters_gradient.get_size() == independent_parameters_number, LOG); }
void TestEvolutionaryAlgorithm::test_set_default(void) { message += "test_set_default\n"; MultilayerPerceptron mlp; MockObjectiveFunctional mof(&mlp); EvolutionaryAlgorithm ea(&mof); // Test ea.set_default(); assert_true(ea.get_population_size() == 0, LOG); // Test mlp.set(1); ea.set_default(); assert_true(ea.get_population_size() == 10, LOG); }