@Test
	public void testClassifyICTClassifierOfDoubleStringCTDiscreteNodeITrajectoryOfDoubleString() {
		
		String[] nodeNames = new String[3]; nodeNames[0] = "Class"; nodeNames[1] = "A"; nodeNames[2] = "B";
		NodeIndexing nodeIndexing = NodeIndexing.getNodeIndexing("testClassifyICTClassifierOfDoubleStringCTDiscreteNodeITrajectoryOfDoubleString", nodeNames, nodeNames[0], null);
		int idxClass = nodeIndexing.getIndex("Class");
		int idxA = nodeIndexing.getIndex("A");
		int idxB = nodeIndexing.getIndex("B");
		
		double[][] cim;
		// Model generation
		CTDiscreteNode classNode, aNode, bNode;
		Set<String> states2 = new TreeSet<String>();
		Set<String> states3 = new TreeSet<String>();
		Set<CTDiscreteNode> nodes = new TreeSet<CTDiscreteNode>();
		states2.add("s1");states2.add("s2");
		states3.add("s1");states3.add("s2");states3.add("s3");
		nodes.add(classNode = new CTDiscreteNode(nodeNames[0], states2, true));
		nodes.add(aNode = new CTDiscreteNode(nodeNames[1], states2, false));
		nodes.add(bNode = new CTDiscreteNode(nodeNames[2], states3, false));
		classNode.addChild(aNode);classNode.addChild(bNode);
		// CIM
		cim = new double[1][2]; cim[0][0] = 0.6; cim[0][1] = 1.0-cim[0][0]; classNode.setCIM(0, cim);assertTrue(classNode.checkCIMs() == -1);
		cim = new double[2][2]; cim[0][0] = -0.1; cim[0][1] = 0.1; cim[1][0] = 0.4; cim[1][1] = -0.4; aNode.setCIM(0, cim);
		cim = new double[2][2]; cim[0][0] = -0.3; cim[0][1] = 0.3; cim[1][0] = 0.5; cim[1][1] = -0.5; aNode.setCIM(1, cim);assertTrue(aNode.checkCIMs() == -1);
		cim = new double[3][3]; cim[0][0] = -0.7; cim[0][1] = 0.5; cim[0][2] = 0.2; cim[1][0] = 1.0; cim[1][1] = -1.6; cim[1][2] = 0.6; cim[2][0] = 2; cim[2][1] = 1.3; cim[2][2] = -3.3;
		bNode.setCIM(0, cim);
		cim = new double[3][3]; cim[2][2] = -0.7; cim[2][1] = 0.5; cim[2][0] = 0.2; cim[1][0] = 1.0; cim[1][1] = -1.6; cim[1][2] = 0.6; cim[0][2] = 2; cim[0][1] = 1.3; cim[0][0] = -3.3;
		bNode.setCIM(1, cim);
		assertTrue(bNode.checkCIMs() == -1);
		// Model
		CTBNClassifier clModel = new CTBNClassifier(nodeIndexing, "classificatore", nodes);
		
		// Trajectory Generation
		// Times
		Vector<Double> times = new Vector<Double>();
		times.add(0.0);times.add(5.0);
		// Values (in the CTBN framework can transit only one node, but to test easily more value i relaxed this condition in the tests)
		String[] v;
		Vector<String[]> values = new Vector<String[]>();
		v = new String[3];						// time = 0.0
		v[idxClass] = "s2";v[idxA] = "s2";v[idxB] = "s1";
		values.add(v);
		v = new String[3];						// time = 5.0
		v[idxClass] = "s2";v[idxA] = "s1";v[idxB] = null;
		values.add(v);
		// Trajectory
		ITrajectory<Double> trj = new CTTrajectory<Double>(nodeIndexing, times, values);
		// Inference
		Map<String, Object> params = new TreeMap<String,Object>();
		params.put("probabilities", true);
		CTBNCClassifyAlgorithm clAlgorithm = new CTBNCClassifyAlgorithm();
		clAlgorithm.setParameters(params);
		
		IClassificationResult<Double> result;		
		int nTest = 10000;
		double acc = 0.0;
		for(int i = 0; i < nTest; ++i) {
			trj = clModel.generateTrajectory(10.0);
			result = clAlgorithm.classify(clModel, trj);
			if( trj.getNodeValue(0, nodeIndexing.getClassIndex()).equals( result.getClassification())) {				
				++acc;
				//System.out.println("OK (" + result.getClassification() + ") s1 = " + result.getNotNormalizedValue(result.getTransitionsNumber() - 1, "s1"));
				//System.out.println("OK (" + result.getClassification() + ") s2 = " + result.getNotNormalizedValue(result.getTransitionsNumber() - 1, "s2"));
			} else {
				//System.out.println("NO (" + result.getClassification() + ") s1 = " + result.getNotNormalizedValue(result.getTransitionsNumber() - 1, "s1"));
				//System.out.println("NO (" + result.getClassification() + ") s2 = " + result.getNotNormalizedValue(result.getTransitionsNumber() - 1, "s2"));
			}
			
			// Check the probabilities validity
			double sum;
			for( int jmp = 0; jmp < result.getTransitionsNumber(); ++jmp)
			{
				sum = 0.0;
				for(int j = 0; j < classNode.getStatesNumber(); ++j)
					sum += result.getProbability(jmp, classNode.getStateName(j));
				assertTrue(sum > 0.9999 && sum < 1.0001);
			}
			sum = 0.0;
			for(int j = 0; j < classNode.getStatesNumber(); ++j)
				sum += result.getProbability(classNode.getStateName(j));
			assertTrue(sum > 0.9999 && sum < 1.0001);
		}
		acc /= nTest;
		System.out.println("accuracy = " + acc);
		assertTrue(acc > 0.99);
		
		//printTrajectory(clModel.generateTrajectory(10.0));
		
	}