Assert.assertEquals(imageLength, strImages[1].length());
Assert.assertEquals(imageLength, strImages[2].length());
int n = imageLength;
NetworkBuilder builder = new NetworkBuilder();
builder.setActivationFunctionClass(MyThresholdFunction.class);
BufferedImage target = readImageFromFile(new File(TARGET_PATH + "target.bmp"));
String strTarget = toBitString(target);
HopfieldAlgorithm alg = new HopfieldAlgorithm(builder, strTarget, imageWidth);
builder.setController(alg);
builder.setDataSource(alg);
// �������� 1-�� ����
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
double w = 0;
if (i != j)
{
for (int k = 0; k < strImages.length; ++k)
{
w += toInt(strImages[k].charAt(i)) * toInt(strImages[k].charAt(j));
}
}
//System.out.println(w);
builder.addSynapseGenerative(0, i, w, 1, j);
}
}
// �������� �������� ������
for (int i = 0; i < n; ++i)
{
builder.addSynapseGenerative(1, i, 1, 0, i);
}
network = builder.getNetwork();
}