Commit 9554bb47 authored by Martin Beseda's avatar Martin Beseda

Merge branch 'dev'

parents c6d023eb a86ff2e6
Summary
**Summary**
(Summarize the bug encountered concisely)
Steps to reproduce
**Steps to reproduce**
(How one can reproduce the issue - this is very important)
What is the current bug behavior?
**What is the current bug behavior?**
(What actually happens)
What is the expected correct behavior?
**What is the expected correct behavior?**
(What you should see instead)
Relevant logs and/or screenshots
**Relevant logs and/or screenshots**
(Paste any relevant logs - please use code blocks (```) to format console output,
logs, and code as it's very hard to read otherwise.)
Possible fixes
**Possible fixes**
(If you can, link to the line of code that might be responsible for the problem)
......
Summary
**Summary**
(Summarize the bug encountered concisely)
Associated classes
**Associated classes**
(Classes, which need to be modified, if any)
......
################################################################################
#
# CMake script for finding ExprTk.
# The default CMake search process is used to locate files.
#
# This script creates the following variables:
# EXPRTK_FOUND: Boolean that indicates if the package was found
# EXPRTK_INCLUDE_DIRS: Paths to the necessary header files
#
################################################################################
# Find headers and libraries
FIND_PATH(
EXPRTK_INCLUDE_DIR
NAMES
exprtk.hpp
HINTS
$ENV{EXPRTK_INCLUDE_DIR}
$ENV{EXPRTK_ROOT}
${EXPRTK_ROOT}
PATHS
/usr/local
/usr
/opt/local
PATH_SUFFIXES
include
)
# Set EXPRTK_FOUND honoring the QUIET and REQUIRED arguments
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ExprTk
"ExprTk was NOT found!"
EXPRTK_INCLUDE_DIR)
# Output variables
IF(EXPRTK_FOUND)
# Include dirs
SET(EXPRTK_INCLUDE_DIRS ${EXPRTK_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "Set, please, the variable EXPRTK_INCLUDE_DIR to the folder, where 'exprtk.hpp' is located..")
ENDIF(EXPRTK_FOUND)
# Advanced options for not cluttering the cmake UIs:
MARK_AS_ADVANCED(EXPRTK_INCLUDE_DIR)
include_directories(${EXPRTK_INCLUDE_DIRS})
################################################################################
#
# CMake script for finding ExprTk.
# The default CMake search process is used to locate files.
#
# This script creates the following variables:
# EXPRTK_FOUND: Boolean that indicates if the package was found
# EXPRTK_INCLUDE_DIRS: Paths to the necessary header files
#
################################################################################
# Find headers and libraries
FIND_PATH(
EXPRTK_INCLUDE_DIR
NAMES
exprtk.hpp
HINTS
$ENV{EXPRTK_INCLUDE_DIR}
$ENV{EXPRTK_ROOT}
${EXPRTK_ROOT}
PATHS
/home
/usr/local
/usr
/opt/local
PATH_SUFFIXES
include
)
# Set EXPRTK_FOUND honoring the QUIET and REQUIRED arguments
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ExprTk
"ExprTk was NOT found!"
EXPRTK_INCLUDE_DIR)
# Output variables
IF(EXPRTK_FOUND)
# Include dirs
SET(EXPRTK_INCLUDE_DIRS ${EXPRTK_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "Set, please, the variable EXPRTK_INCLUDE_DIR to the folder, where 'exprtk.hpp' is located..")
ENDIF(EXPRTK_FOUND)
# Advanced options for not cluttering the cmake UIs:
MARK_AS_ADVANCED(EXPRTK_INCLUDE_DIR)
include_directories(${EXPRTK_INCLUDE_DIRS})
......@@ -41,14 +41,14 @@
and go to the folder with `Boost`
```
cd FOLDER_WITH_BOOST
cd "folder with Boost"
bootstrap.bat
b2.exe --build-type=complete
```
- set `BOOST_ROOT` variable to the path of your folder with `Boost`
- set `BOOST_ROOT` variable to the path of your folder containing `Boost`
```
setx BOOST_ROOT YOUR_PATH
setx BOOST_ROOT "path to your Boost folder"
```
- go to the `lib4neuro` folder and run
......
......@@ -15,4 +15,4 @@ set MAKEFILE_GENERATOR="Visual Studio 15 2017"
call clean.bat
cmake -G %MAKEFILE_GENERATOR% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBoost_DEBUG:BOOL=ON .
cmake --build . --config %BUILD_TYPE% && (echo Build complete.) || (echo "Build finished with errors!")
cmake --build . --config %BUILD_TYPE% && (echo (Build complete.); echo (For examples have a look at the folder build/bin/examples.)) || (echo "Build finished with errors!")
......@@ -13,4 +13,4 @@ CXX_COMPILER="g++-8"
$(pwd)/clean.sh
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} .
cmake --build . --config ${BUILD_TYPE} -- -j${N_CORES} && (tput setaf 2; echo "Build complete."; tput sgr 0; ) || (tput setaf 1; echo "Build finished with errors!"; tput sgr 0; exit 1;)
cmake --build . --config ${BUILD_TYPE} -- -j${N_CORES} && (tput setaf 2; echo "Build complete."; echo "For examples have a look at the folder build/bin/examples."; tput sgr 0; ) || (tput setaf 1; echo "Build finished with errors!"; tput sgr 0; exit 1;)
#TODO uncomment
#add_subdirectory(tests bin/unit-tests)
add_subdirectory(examples bin/examples)
add_library(4neuro SHARED
Neuron/Neuron.cpp
Neuron/NeuronBinary.cpp
Neuron/NeuronConstant.cpp
Neuron/NeuronLinear.cpp
Neuron/NeuronLogistic.cpp
Network/NeuralNetwork.cpp
Network/NeuralNetworkSum.cpp
NetConnection/ConnectionFunctionGeneral.cpp
NetConnection/ConnectionFunctionIdentity.cpp
LearningMethods/ParticleSwarm.cpp
DataSet/DataSet.cpp
ErrorFunction/ErrorFunctions.cpp
Solvers/DESolver.cpp
LearningMethods/ILearningMethods.h)
#list(REMOVE_ITEM Boost_LIBRARIES "optimized" "debug")
#
#set(TMP "")
#set(TMP2 "")
#foreach(e ${Boost_LIBRARIES})
# string(REPLACE "/" "\\" TMP2 ${e})
# list(APPEND TMP ${TMP2})
#endforeach(e)
#
#set(Boost_LIBRARIES ${TMP})
message("Boost_LIBRARIES sadf: ${Boost_LIBRARIES}")
target_link_libraries(4neuro ${Boost_LIBRARIES})
add_library(boost_unit_test SHARED boost_test_lib_dummy.cpp)
add_library(exprtk SHARED exprtk.cpp)
add_subdirectory(tests bin/unit-tests)
add_subdirectory(examples bin/examples)
add_library(4neuro SHARED
Neuron/Neuron.cpp
Neuron/NeuronBinary.cpp
Neuron/NeuronConstant.cpp
Neuron/NeuronLinear.cpp
Neuron/NeuronLogistic.cpp
Network/NeuralNetwork.cpp
Network/NeuralNetworkSum.cpp
NetConnection/ConnectionFunctionGeneral.cpp
NetConnection/ConnectionFunctionIdentity.cpp
LearningMethods/ParticleSwarm.cpp
DataSet/DataSet.cpp
ErrorFunction/ErrorFunctions.cpp
Solvers/DESolver.cpp
LearningMethods/ILearningMethods.h)
add_library(boost_unit_test SHARED boost_test_lib_dummy.cpp)
add_library(exprtk SHARED exprtk.cpp)
target_link_libraries(4neuro ${Boost_LIBRARIES} boost_unit_test exprtk)
......@@ -2,4 +2,6 @@
// Created by David on 11.07.2018.
//
#define BOOST_TEST_MODULE neuron_test
#define BOOST_TEST_MODULE unit_test
#include <boost/test/included/unit_test.hpp>
//#include<unit_test.hpp>
......@@ -3,41 +3,44 @@
##############
add_executable(neuron_test neuron_test.cpp)
target_link_libraries(neuron_test boost_unit_test 4neuro)
target_link_libraries(neuron_test 4neuro)
add_executable(linear_neuron_test NeuronLinear_test.cpp)
target_link_libraries(linear_neuron_test boost_unit_test 4neuro)
target_link_libraries(linear_neuron_test 4neuro)
add_executable(constant_neuron_test NeuronConstant_test.cpp)
target_link_libraries(constant_neuron_test 4neuro)
add_executable(binary_neuron_test NeuronBinary_test.cpp)
target_link_libraries(binary_neuron_test boost_unit_test 4neuro)
target_link_libraries(binary_neuron_test 4neuro)
add_executable(logistic_neuron_test NeuronLogistic_test.cpp)
target_link_libraries(logistic_neuron_test boost_unit_test 4neuro)
add_executable(connection_weight_test ConnectionWeight_test.cpp)
target_link_libraries(connection_weight_test boost_unit_test 4neuro)
target_link_libraries(logistic_neuron_test 4neuro)
add_executable(connection_test Connection_test.cpp)
target_link_libraries(connection_test boost_unit_test 4neuro)
add_executable(connectionFunctionGeneral_test ConnectionFunctionGeneral_test.cpp)
target_link_libraries(connectionFunctionGeneral_test 4neuro)
add_executable(neural_network_test NeuralNetwork_test.cpp)
target_link_libraries(neural_network_test boost_unit_test 4neuro)
target_link_libraries(neural_network_test 4neuro)
add_executable(connection_weight_identity_test ConnectionWeightIdentity_test.cpp)
target_link_libraries(connection_weight_identity_test boost_unit_test 4neuro)
add_executable(connection_Function_identity_test ConnectionFunctionIdentity_test.cpp)
target_link_libraries(connection_Function_identity_test 4neuro)
add_executable(dataset_test DataSet_test.cpp)
target_link_libraries(dataset_test boost_unit_test 4neuro)
target_link_libraries(dataset_test 4neuro)
add_executable(errorfunction_test ErrorFunctions_test.cpp)
target_link_libraries(errorfunction_test boost_unit_test 4neuro)
target_link_libraries(errorfunction_test 4neuro)
add_executable(particle_swarm_test ParticleSwarm_test.cpp)
target_link_libraries(particle_swarm_test boost_unit_test 4neuro)
target_link_libraries(particle_swarm_test 4neuro)
add_executable(particle_test Particle_test.cpp)
target_link_libraries(particle_test boost_unit_test 4neuro)
target_link_libraries(particle_test 4neuro)
add_executable(NeuralNetworkSum_test NeuralNetworkSum_test.cpp)
target_link_libraries(NeuralNetworkSum_test boost_unit_test 4neuro)
target_link_libraries(NeuralNetworkSum_test 4neuro)
add_executable(DESolver_test DESolver_test.cpp)
target_link_libraries(DESolver_test 4neuro)
/**
* DESCRIPTION OF THE CLASS
*
* @author David Vojtek
* @date 2018
*/
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#include "../NetConnection/ConnectionFunctionGeneral.h"
#include "../Neuron/NeuronLinear.h"
#include <iostream>
/**
* Boost testing suite for testing ConnectionFunctionGeneral.h
*/
BOOST_AUTO_TEST_SUITE(Connection_test)
/**
* Test of constructor of Connection
*/
BOOST_AUTO_TEST_CASE(Connection_construction__test) {
BOOST_CHECK_NO_THROW(ConnectionFunctionGeneral *functionGeneral = new ConnectionFunctionGeneral());
std::vector<size_t> param_indices;
param_indices.push_back(0);
std::string paramToFunction = "this do nothing! Why is it here?";
BOOST_CHECK_NO_THROW(ConnectionFunctionGeneral *functionGeneral = new ConnectionFunctionGeneral(param_indices,
paramToFunction));
}
BOOST_AUTO_TEST_CASE(Connection_eval_test) {
ConnectionFunctionGeneral *functionGeneral = new ConnectionFunctionGeneral();
//TODO implementation not finnish yet;
std::vector<double> parameter_space;
BOOST_CHECK_EQUAL(0, functionGeneral->eval(parameter_space));
}
BOOST_AUTO_TEST_CASE(Connection_eval_partial_derivative_test) {
//TODO function not implemented yet
}
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
/**
* DESCRIPTION OF THE CLASS
*
* @author David Vojtek
* @date 2018
*/
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#include "../NetConnection/ConnectionFunctionIdentity.h"
/**
* Boost testing suite for testing ConnectionWeightIdentity.h
*/
BOOST_AUTO_TEST_SUITE(ConnectionWeightIdentity_test)
/**
* Test of correct construction of ConnectionFunctionIdentity
*/
BOOST_AUTO_TEST_CASE(ConnectionWeightIdentity_construction_test) {
std::vector<double> weight_array = {1, 2, 3, 4, 5};
//Test of none exception when creation new instance of ConnectionFunctionIdentity
BOOST_CHECK_NO_THROW(ConnectionFunctionIdentity *CFI = new ConnectionFunctionIdentity() );
BOOST_CHECK_NO_THROW(ConnectionFunctionIdentity *CFI = new ConnectionFunctionIdentity(2) );
}
/**
* Test of eval method
*/
BOOST_AUTO_TEST_CASE(ConnectionWeightIdentity_eval_test) {
ConnectionFunctionIdentity *CFI1 = new ConnectionFunctionIdentity();
ConnectionFunctionIdentity *CFI2 = new ConnectionFunctionIdentity(0);
ConnectionFunctionIdentity *CFI3 = new ConnectionFunctionIdentity(2);
std::vector<double> parameter_space;
parameter_space.push_back(5);
//Test of correct output of eval method
BOOST_CHECK_EQUAL(1, CFI1->eval(parameter_space));
BOOST_CHECK_EQUAL(5, CFI2->eval(parameter_space));
BOOST_CHECK_THROW(CFI3->eval(parameter_space), std::out_of_range);
}
BOOST_AUTO_TEST_SUITE_END()
///**
//* DESCRIPTION OF THE CLASS
//*
//* @author David Vojtek
//* @date 2018
//*/
//
//#define BOOST_TEST_NO_MAIN
//
//#include <boost/test/unit_test.hpp>
//#include "../NetConnection/ConnectionFunctionIdentity.h"
//
///**
// * Boost testing suite for testing ConnectionWeightIdentity.h
// */
//BOOST_AUTO_TEST_SUITE(ConnectionWeightIdentity_test)
//
// /**
// * Test of correct construction of ConnectionWeightIdentity
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeightIdentity_construction_test) {
// std::vector<double> weight_array = {1, 2, 3, 4, 5};
// //Test of none exception when creation new instance of ConnectionFunctionIdentity
// BOOST_CHECK_NO_THROW(ConnectionFunctionIdentity CWI(&weight_array));
// }
//
// /**
// * Test of eval method
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeightIdentity_eval_test) {
// std::vector<double> weight_array = {1, 2, 3, 4, 5};
// ConnectionFunctionIdentity CWI(&weight_array);
// int para[5] = {3, 1, 2, 3, 4};
// CWI.SetParamIndices(para);
//
// //Test of correct output of eval method
// BOOST_CHECK_EQUAL(4, CWI.eval());
// }
//
//BOOST_AUTO_TEST_SUITE_END()
///**
// * DESCRIPTION OF THE CLASS
// *
// * @author David Vojtek
// * @date 2018
// */
//
//#define BOOST_TEST_NO_MAIN
//
//#include <boost/test/unit_test.hpp>
//#include "../NetConnection/ConnectionFunctionGeneral.h"
//
///**
// * Boost testing suite for testing ConnectionWeight.h
// */
//BOOST_AUTO_TEST_SUITE(ConnectionWeight_test)
//
// /**
// * Test of construction of ConnectionWeight
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeight_construction__test) {
// std::vector<double> * w_array = nullptr ;
//
// //Tests of no exception when, create new instance
// BOOST_CHECK_NO_THROW( ConnectionFunctionGeneral conn(2, w_array ));
// BOOST_CHECK_NO_THROW( ConnectionFunctionGeneral conn);
// }
//
// /**
// * Test of setParamIndices and SetParamIndex methods
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeight_param_test){
// std::vector<double> w_array= {0,1,2,3,4} ;
//
// ConnectionFunctionGeneral conn(5, &w_array );
// ConnectionFunctionGeneral connbad(7, &w_array);
// int para[5]={0,1,2,3,4};
//
// //Test of no exception when call SetParamIndices method on instance created with with correct parameters
// BOOST_CHECK_NO_THROW(conn.SetParamIndices(para));
// //Test of no exception when call SetParamIndex method on instance created with with correct parameters
// BOOST_CHECK_NO_THROW(conn.SetParamIndex(2,2));
// // Features not implemented yet
// //Test of expected exception out_of_range when call SetParamIndices method on instance created with with incorrect parameters
// //BOOST_CHECK_THROW(connbad.SetParamIndices(para), std::out_of_range);
// //Test of expected exception out_of_range when call SetParamIndex method on instance created with incorrect parameters
// //BOOST_CHECK_THROW(connbad.SetParamIndex(2,8), std::out_of_range);
// }
//
// /**
// * Test of eval method
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeight_eval__test) {
// std::vector<double> w_array= {1,2,3,4,5} ;
//
// ConnectionFunctionGeneral conn(5, &w_array );
// int para[5]={1,2,3,4,5};
// conn.SetParamIndices(para);
//
// //Test of correct output after calling eval() method
// BOOST_CHECK_EQUAL(120, conn.eval());
// }
//
// /**
// * Test of adjust_weights method
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeight_weight_adjustment_test) {
// std::vector<double> w_array= {1,2,3,4,5} ;
// double w_array2[5] = {5,4,3,2,1};
//
// ConnectionFunctionGeneral conn(5, &w_array);
// int para[5]={0,1,2,3,4};
// conn.SetParamIndices(para);
// conn.adjust_weights(w_array2);
//
// //Test of correct eval output after adjusting weights
// BOOST_CHECK_EQUAL(7776, conn.eval());
// }
//
// /**
// * Test of set_weights method
// */
// BOOST_AUTO_TEST_CASE(ConnectionWeight_weight_set_test) {
// std::vector<double> w_array= {2,3,4,5,6} ;
// double w_array2[5] = {1,2,3,4,5};
// ConnectionFunctionGeneral conn(5, &w_array );
// conn.eval();
// int para[5]={0,1,2,3,4};
// conn.SetParamIndices(para);
// conn.set_weights(w_array2);
//
// //Test of correct eval output after setting new weights
// BOOST_CHECK_EQUAL(120, conn.eval());
// }
//
//
//BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
///**
// * DESCRIPTION OF THE CLASS
// *
// * @author David Vojtek
// * @date 2018
// */
//
//#define BOOST_TEST_NO_MAIN
//
//#include <boost/test/unit_test.hpp>
//
//
//#include "../NetConnection/ConnectionFunctionGeneral.h"
//#include "../Neuron/NeuronLinear.h"
//#include <iostream>
///**
// * Boost testing suite for testing ConnectionFunctionGeneral.h
// */
//
//BOOST_AUTO_TEST_SUITE(Connection_test)
//
///**
// * Test of constructor of Connection
// */
//BOOST_AUTO_TEST_CASE(Connection_construction__test) {
//
// Neuron *neuron1 = new NeuronLinear(2, 3);
// Neuron *neuron2 = new NeuronLinear(4, 5);
// std::vector<double> w_array = {2, 3, 4, 5, 6};
//
// ConnectionWeight *conn = new ConnectionWeight(2, &w_array);
// Connection connection(neuron1, neuron2, conn);
// //Test of correct input neuron
// BOOST_CHECK_EQUAL(neuron1, connection.get_neuron_in());
// //Test of correct output neuron
// BOOST_CHECK_EQUAL(neuron2, connection.get_neuron_out());
//}
//
///**
// * Test of pass_signal method
// */
//BOOST_AUTO_TEST_CASE(Connection_pass_signal_test) {
//
// Neuron *neuron1 = new NeuronLinear(2, 3);
// Neuron *neuron2 = new NeuronLinear(4, 5);
// std::vector<double> w_array = {2, 3, 4, 5, 6};
// std::function<double(double *, int *, int)> f = [](double *weight_array, int *index_array, int n_params) {
// double a = weight_array[0];
// double b = weight_array[1];
// return (a + 1.5 * b);
// };
//
//
// ConnectionWeight *conn = new ConnectionWeight(2, &w_array);
//
// Connection connection(neuron1, neuron2, conn);
//
// neuron1->activate();
// neuron2->activate();
// // test of neuron state before passing signal
// BOOST_CHECK_EQUAL(4, neuron2->get_state());
// connection.pass_signal();
// neuron2->activate();
// // test of neuron state after passing signal
// BOOST_CHECK_EQUAL(7204, neuron2->get_state());
//
//}
//
//
//BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
/**
* DESCRIPTION OF THE CLASS
*
* @author David Vojtek
* @date 2018
*/
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <boost/test/output_test_stream.hpp>
#include "../Solvers/DESolver.h"
/**
* Boost testing suite for testing DESolver.h
*
*/
BOOST_AUTO_TEST_SUITE(DESolver_test)
/**
* Test of MultiIndex construction test
*/
BOOST_AUTO_TEST_CASE(MultiIndex_construction_test) {
BOOST_CHECK_NO_THROW(MultiIndex multiIndex(2));
}
/**
* Test of MultiIndex set_partial_deravitive method
*/
BOOST_AUTO_TEST_CASE(MultiIndex_set_partial_derivative_test) {
MultiIndex multiIndex(2);
BOOST_CHECK_NO_THROW(multiIndex.set_partial_derivative(0, 1));
BOOST_CHECK_NO_THROW(multiIndex.set_partial_derivative(1, 2));
//BOOST_CHECK_THROW(multiIndex.set_partial_derivative(2, 3), std::out_of_range);
}
/**
* Testo of MultiIndex get_partial_derivative_degrees method
*/
BOOST_AUTO_TEST_CASE(MultiIndex_get_partial_derivative_degrees_test) {
MultiIndex multiIndex(2);
multiIndex.set_partial_derivative(0, 1);
multiIndex.set_partial_derivative(1, 2);
BOOST_CHECK_EQUAL(1, multiIndex.get_partial_derivatives_degrees()->at(0));
BOOST_CHECK_EQUAL(2, multiIndex.get_partial_derivatives_degrees()->at(1));
}
/**
* Test of MultiIndex operator< method
*/
BOOST_AUTO_TEST_CASE(MultiIndex_operator_test) {
MultiIndex multiIndex1(1);
multiIndex1.set_partial_derivative(0, 1);
MultiIndex multiIndex2(2);
multiIndex2.set_partial_derivative(0, 1);
multiIndex2.set_partial_derivative(1, 2);
MultiIndex multiIndex3(1);
multiIndex3.set_partial_derivative(0, 2);
BOOST_CHECK(multiIndex1.operator<(multiIndex2));
//BOOST_CHECK_THROW(multiIndex2.operator<(multiIndex1), std::out_of_range);
BOOST_CHECK(!multiIndex1.operator<(multiIndex1));
BOOST_CHECK(multiIndex1.operator<((multiIndex3)));
}
/**
* Test of MultiIndex toString method
*/
BOOST_AUTO_TEST_CASE(MultiIndex_toString_test) {
MultiIndex multiIndex(2);
BOOST_CHECK_EQUAL("0, 0", multiIndex.to_string());
}
/**
* Test of MultiIndex get_degree method
*/
BOOST_AUTO_TEST_CASE(MultiIndex_get_degree_test) {
MultiIndex multiIndex(2);
BOOST_CHECK_EQUAL(0, multiIndex.get_degree());
multiIndex.set_partial_derivative(0, 1);
multiIndex.set_partial_derivative(1, 3);
BOOST_CHECK_EQUAL(4, multiIndex.get_degree());
}
/**
* Test of DESolver construction
*/
BOOST_AUTO_TEST_CASE(DESolver_construction_test) {
BOOST_CHECK_THROW(DESolver(0, 1, 1), std::invalid_argument);
BOOST_CHECK_THROW(DESolver(1, 0, 1), std::invalid_argument);
BOOST_CHECK_THROW(DESolver(1, 1, 0), std::invalid_argument);
BOOST_CHECK_NO_THROW(DESolver deSolver(1, 1, 1));
/*boost::test_tools::output_test_stream output;
{
cout_redirect guard(output.rdbuf());
DESolver deSolver(1,1,1,1);
}
BOOST_CHECK(output.is_equal("Differential Equation Solver with 1 equations\n--------------------------------------------------------------------------\nConstructing NN structure representing the solution [1 input neurons][1 inner neurons][1 output neurons]...\n adding a connection between input neuron 0 and inner neuron 0, weight index 0\n adding a connection between inner neuron 0 and output neuron 0, weight index 1\ndone\n\n"));
*/
}
/**
* Test of DESolver get_solution method
*/
BOOST_AUTO_TEST_CASE(DESolver_get_solution_test) {
DESolver deSolver(1, 1, 1);
MultiIndex *alpha = new MultiIndex(1);
NeuralNetwork *network = deSolver.get_solution(*alpha);
BOOST_CHECK_EQUAL(1, network->get_n_inputs());
BOOST_CHECK_EQUAL(1, network->get_n_outputs());
}
BOOST_AUTO_TEST_SUITE_END()
This diff is collapsed.
This diff is collapsed.
///**
// * DESCRIPTION OF THE CLASS
// *
// * @author David Vojtek
// * @date 2018