This directory contains two example programs for use with XGI.  The
first is a simple demonstration of dynamic linking and custom icons.
The second is a version of the 838 encoder problem, as described in
~/example/838encode/README, with scrollbar controls for the back
propagation parameters.  If you do not have write permission in
this directory, copy the files to your own directory.  You should
have the `makesim' shell script on your search path.

Custom Icons
============

Type `make smiley' and the executable `smilesim' will be created.  Run
this executable, and type `read smiley.demo' to the input prompt.  You
will see a grid of smiley face icons appear.  The icons will change
size and expression as the simulation runs.  Quit the simulator.

Linking Your Widgets Dynamically
================================

There is a variable `optimist' in the file `smiley.c' that controls
the size of the smiley face icons.  To demonstrate dynamic linking of
C code, first make an empty simulator by typing `make empty'.  Run the
resulting executable `emptysim'.  Now compile `smiley.c' by typing the
command `compile smiley' to the simulator input prompt.  Then
dynamically link the code by typing `loadcode smiley'.  You now have a
simulator in almost the same state as the `smilesim' simulator generated
above.  Get the display window and custom icons up by typing the
command `read smiley.demo'.

Now compile the code in scroll.c: `compile scroll'.  Then link it
with: `loadcode scroll'.  This loads in the code in scroll.c.  When
the code is loaded, type `call MakeControl optimist' to the input
prompt.  This associates a scrollbar widget with the variable
`optimist' that controls the smiley face size and then pops up the
scrollbar control widget.  Place it wherever you like with a left
mouse click.  Move the cursor to the `steps:' type-in on the control
panel, and set the value to 1000.  Click the GO button.  You can then
move the slider up or down (with the middle button) to change the size
and expression of the smiley faces.  When the slider is low, the faces
frown.  When high, they smile.  You can write code to dynamically link
in your own widgets in a similar fashion.

*SPARC* [Note: for this code to work, if on a SPARC machine, the file
`smiley.c' must not be compiled with GCC.  If you are running on a
SPARC machine, and the simulator compiles `smiley.c' with GCC, then
recompile it by hand using the regular C compiler and the same -I and
-c switches that the simulator used with GCC.  Do this before
executing the `loadcode smiley' command.  After executing the loadcode
command, you may then check that all is well by typing `value optimist
?  float'.  This should print the value of the variable `optimist'.
If the simulator claims that `optimist' is not a data item, something
is wrong.]

Backpropagation Encoder Problem
===============================

This demonstrates some of the custom XGI features, and contains an
example widget that implements scrollbar controls for the learn rate,
temperature and momentum of the backpropagation function.

First make a simulator by typing make 838.  Run the resulting
simulator executable, 838sim.  The X11 windows should appear.  Place
the control window in the bottom right corner of the screen.  Move the
cursor to the -> input prompt in the control window.  Type the command
`read 838demo'.  A window outline will popup for you to place.  Place
it to the left of the control window.  This window contains scrollbar
controls for the learn rate, temperature and momentum parameters.
This control widget is not an integral part of the simulator, and is
an example of the kind of additions you can easily make.  It is
implemented in file `BPcontrol.c'.  A second display window will
appear, and units will be layed out in the windows.  Finally three
information windows will pop up and place themselves.  These
correspond to the hidden layer of units (the three in the middle), and
will show unit activations and link strengths.  Now move the mouse to
the display window named "LINKS" and right button click over one of
the eight units in the output level of the network.  The unit you
clicked will be highlighted to indicate it is the target, and the
units which send it activation show the strength of the links.  The
information windows also show link strengths.  Move the mouse to the
display window named "UNITS" and left click over the display.  A menu
will pop up, and you should click the first item (call cycle).  This
causes the network to start learning.  It will execute 50 epochs each
time you click on this menu item.  It takes approximately 500 epochs
to learn the mapping.  As the network learns, you may right click in
over units in the "LINKS" window to view the weights into a particular
unit as they change.  Left clicking over a unit in the "LINKS" window
will cause another information window describing the state of the unit
to appear.  The learn rate, temperature and momentum may be varied by
moving the scrollbar thumbs with the middle mouse button.  You may
speed up simulation by freezing the information windows (click on the
FREEZE buttons) and by turning off command echoing (click the NO ECHO
button in the control panel.  You may test how well the network has
learnt by middle clicking over a unit in the input (lowest) level in
the "UNITS" window.  This will popup a menu, and you should click on
the single unused item (call testg).  In the output (uppermost) level,
only the corresponding unit should become active.

