示例#1
0
void TestObjectiveFunctional::test_set_default(void)
{
   message += "test_set_default\n";

   MockObjectiveFunctional mof;

   mof.set_default();
}
示例#2
0
void TestObjectiveFunctional::test_save(void)
{
   message += "test_save\n";

   MockObjectiveFunctional mof;

   mof.save("../Data/MockObjectiveFunctional.dat");
}
示例#3
0
void TestObjectiveFunctional::test_get_calculate_Hessian_count(void)
{
   message += "test_get_calculate_Hessian_count\n";

   MockObjectiveFunctional mof;

   assert_true(mof.get_calculate_Hessian_count() == 0, LOG);
}
示例#4
0
void TestObjectiveFunctional::test_to_XML(void)
{
   message += "test_to_XML\n";

   MockObjectiveFunctional mof;

   std::string object = mof.to_XML(true);
}
示例#5
0
void TestObjectiveFunctional::test_set_calculate_gradient_count(void)
{
   message += "test_set_calculate_gradient_count\n";

   MockObjectiveFunctional mof;

   mof.set_calculate_gradient_count(1);

   assert_true(mof.get_calculate_gradient_count() == 1, LOG);
}
示例#6
0
void TestObjectiveFunctional::test_set_numerical_epsilon(void)
{
   message += "test_set_numerical_epsilon\n";

   MockObjectiveFunctional mof;

   mof.set_numerical_epsilon(1.0e-3);

   assert_true(mof.get_numerical_epsilon() == 1.0e-3, LOG);
}
示例#7
0
void TestObjectiveFunctional::test_set_regularization_weight(void)
{
   message += "test_set_regularization_weight\n";

   MockObjectiveFunctional mof;

   mof.set_regularization_weight(1.0);
   
   assert_true(mof.get_regularization_weight() == 1.0, LOG);   
}
示例#8
0
void TestObjectiveFunctional::test_get_objective_weight(void)
{
   message += "test_get_objective_weight\n";

   MockObjectiveFunctional mof;

   mof.set_objective_weight(0.0);
   
   assert_true(mof.get_objective_weight() == 0.0, LOG);   
}
示例#9
0
void TestObjectiveFunctional::test_calculate_actual_epsilon(void)
{
   message += "test_calculate_actual_epsilon\n";

   MockObjectiveFunctional mof; 

   double actual_epsilon = mof.calculate_actual_epsilon(1.0);

   assert_true(actual_epsilon == mof.get_numerical_epsilon(), LOG);
}
示例#10
0
void TestObjectiveFunctional::test_calculate_validation_error(void)   
{
   message += "test_calculate_validation_error\n";

   MockObjectiveFunctional mof;

   double validation_error = mof.calculate_validation_error();

   assert_true(validation_error == 0.0, LOG);
}
示例#11
0
void TestObjectiveFunctional::test_get_regularization_method(void)
{
   message += "test_get_regularization_method\n";

   MockObjectiveFunctional mof;

   mof.set_regularization_method(ObjectiveFunctional::None);
   assert_true(mof.get_regularization_method() == ObjectiveFunctional::None,	LOG);

   mof.set_regularization_method(ObjectiveFunctional::NeuralParametersNorm);
   assert_true(mof.get_regularization_method() == ObjectiveFunctional::NeuralParametersNorm,	LOG);   
}
示例#12
0
void TestObjectiveFunctional::test_set_multilayer_perceptron_pointer(void)
{
   message += "test_set_multilayer_perceptron_pointer\n";

   MockObjectiveFunctional mof;

   MultilayerPerceptron mlp;

   mof.set_multilayer_perceptron_pointer(&mlp);

   assert_true(mof.get_multilayer_perceptron_pointer() != NULL, LOG);
}
示例#13
0
void TestObjectiveFunctional::test_get_numerical_differentiation_method(void)
{
   message += "test_get_numerical_differentiation_method\n";

   MockObjectiveFunctional mof;

   mof.set_numerical_differentiation_method(ObjectiveFunctional::ForwardDifferences);
   assert_true(mof.get_numerical_differentiation_method() == ObjectiveFunctional::ForwardDifferences, LOG);

   mof.set_numerical_differentiation_method(ObjectiveFunctional::CentralDifferences);
   assert_true(mof.get_numerical_differentiation_method() == ObjectiveFunctional::CentralDifferences, LOG);
}
示例#14
0
void TestObjectiveFunctional::test_get_numerical_epsilon_method(void)
{
   message += "test_get_numerical_epsilon_method\n";

   MockObjectiveFunctional mof;

   mof.set_numerical_epsilon_method(ObjectiveFunctional::Absolute);
   assert_true(mof.get_numerical_epsilon_method() == ObjectiveFunctional::Absolute, LOG);

   mof.set_numerical_epsilon_method(ObjectiveFunctional::Relative);
   assert_true(mof.get_numerical_epsilon_method() == ObjectiveFunctional::Relative, LOG);
}
示例#15
0
void TestObjectiveFunctional::test_get_display(void)
{
   message += "test_get_display\n";

   MockObjectiveFunctional mof;

   mof.set_display(true);
   assert_true(mof.get_display() == true, LOG);

   mof.set_display(false);
   assert_true(mof.get_display() == false, LOG);
}
示例#16
0
void TestEvolutionaryAlgorithm::test_load(void)
{
   message += "test_load\n";

   EvolutionaryAlgorithm ea;
   ea.save("../Data/EvolutionaryAlgorithm.dat");
   ea.load("../Data/EvolutionaryAlgorithm.dat");

   MockObjectiveFunctional mof;
   ea.set_objective_functional_pointer(&mof);

   ea.save("../Data/EvolutionaryAlgorithm.dat");
   ea.load("../Data/EvolutionaryAlgorithm.dat");

   MultilayerPerceptron mlp(1);
   mof.set_multilayer_perceptron_pointer(&mlp);

   ea.save("../Data/EvolutionaryAlgorithm.dat");
   ea.load("../Data/EvolutionaryAlgorithm.dat");
}