Programs: Hir2 and Hir2DOS. Download here (51K) - Note: you will need MFC42.DLL to run the Windows version.
The reason I created two versions was because in order to keep the integrity of the Hopfield class without converting it to a Windows class required the program to NOT show how the network actual stabilized given the picture. In my opinion, that is the best part of watching a Hopfield network (yes, I have a lot of free time...)!! Therefore, the Windows version only outputs the start and end results of the network. I wrote it for the GUI - 'images' are always a bit more expressive as images, not as ASCII. The DOS version DOES though, show you the process the network goes through the stabilize the network. A quick note for those of you wanting to modify the program: VC++ for very annoying reasons, does not allow any source file in its Windows projects to NOT include "stdafx.h", so should you want to use the class outside of an MFC application, take that out. Of course, you could use the source with the DOS-version. In an effort to allow the program calling the Hopfield class functions to see what was happening, I tried to create a callback function. This unfortunately really doesn't work very well in Windows programming, since static member functions cannot call non-static member functions, nor modify non-static member variables, and global variables/functions are very uncommon. It works a treat in DOS programming though. Here is how to use it.
Basically, the class will call a function of your choice (as long as it meets the required function signature at compile-time) every time a neuron changes its output. The signature required is: int AlterImage(int x, int y);Your function can, of course, be any name. The class then calls this function with the coordinates of the neuron that changed as the parameters. To set your function, merely call the CHopfield::SetCallback() function with your function name as the parameter. See the DOS version for a demonstration. ![]()
|