@Test
public void testDBNConstruction() {
Environment.getInstance().setUseWeightsSharedMemory(true);
DBN dbn = NNFactory.dbn(new int[] { 4, 4, 4, 4}, false);
assertEquals(4, dbn.getLayers().size(), 0);
assertEquals(3, dbn.getNeuralNetworks().size(), 0);
assertEquals(2, dbn.getFirstNeuralNetwork().getLayers().size(), 0);
assertEquals(2, dbn.getNeuralNetwork(1).getLayers().size(), 0);
assertEquals(2, dbn.getLastNeuralNetwork().getLayers().size(), 0);
dbn = NNFactory.dbn(new int[] { 4, 4, 4, 4 }, true);
assertEquals(7, dbn.getLayers().size(), 0);
assertEquals(3, dbn.getNeuralNetworks().size(), 0);
assertEquals(4, dbn.getFirstNeuralNetwork().getLayers().size(), 0);
assertEquals(4, dbn.getNeuralNetwork(0).getLayers().size(), 0);
assertEquals(4, dbn.getLastNeuralNetwork().getLayers().size(), 0);
assertEquals(true, dbn.getFirstNeuralNetwork().getHiddenBiasConnections() != null);
assertEquals(true, dbn.getFirstNeuralNetwork().getVisibleBiasConnections() != null);
assertEquals(true, dbn.getNeuralNetwork(1).getHiddenBiasConnections() != null);
assertEquals(true, dbn.getNeuralNetwork(1).getVisibleBiasConnections() != null);
assertEquals(true, dbn.getLastNeuralNetwork().getHiddenBiasConnections() != null);
assertEquals(true, dbn.getLastNeuralNetwork().getVisibleBiasConnections() != null);
assertEquals(false, dbn.getLayers().contains(dbn.getFirstNeuralNetwork().getVisibleBiasConnections().getInputLayer()));
assertEquals(false, dbn.getLayers().contains(dbn.getNeuralNetwork(1).getVisibleBiasConnections().getInputLayer()));
assertEquals(false, dbn.getLayers().contains(dbn.getLastNeuralNetwork().getVisibleBiasConnections().getInputLayer()));
assertEquals(true, dbn.getFirstNeuralNetwork().getHiddenLayer() == dbn.getNeuralNetwork(1).getVisibleLayer());
assertEquals(true, dbn.getNeuralNetwork(1).getHiddenLayer() == dbn.getLastNeuralNetwork().getVisibleLayer());
assertEquals(true, dbn.getOutputLayer().equals(dbn.getLastNeuralNetwork().getHiddenLayer()));
}