inst4.0		!13:03 30-May-88  (Madaline.ins)  Madaline Network Builder
!****************************************************************
!*								*
!*	Madaline Network Generator				*
!*								*
!****************************************************************

!	*** check that input / output PE count is non-zero

?&In	1
>bge	CheckOut
@Err	"Madaline MUST have at least one input PE"
:CheckOut
?&Out	1
>bge	OutOK
@Err	"Madaline MUST have at least one output PE"
:OutOK
?&Hd1	1
>bge	HidOK
@Err	"Madaline MUST have at least one Hidden Layer 1 PE"
:HidOK
?&Out	&Hd1
>ble	HOisOK
@Err	"Madaline MUST have at least as many Hidden as Output PEs"
:HOisOK

!	*** Load the Control Strategy and LRS if needed

@LdCS	"adaline"		!control strategy
@LdLR	"adaline"		!L/R schedule

=netn	"InstaNet (tm) Madaline Network version 1.00 20-Jun-88"
=DLnF	0			!learn  re-display off
=DRcF	0			!recall re-display off

!	*** Build the Input Layer ***

@LLdf				!load default layer to mi_layer structure
=LDln	"In"			!layer name
=Lpes	&In			!copy # of input PEs from menu
!=Ltrn	"Signum"		!signum transfer function
=x	100			!place to put layer on screen
=y	 80
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the input layer

!	*** Build the Adaline Layer ***

@LLdf				!start with default layer again
=LDln	"Adaline"		!adaline layer name
=Lpes	&Hd1			!hidden PEs
=Ltrn	"Signum"		!transfer function
=Lcmp	"Adaline"		!adaline competition
=Llrn	"Adaline"		!adaline learning rule
+y	80			!up higher on display
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd

!	*** Connect Adaline Layer to Bias & Input Layers ***

=SPEl	1			!current layer
@SlPE				!select it as destination (sb already)
=NPEl	-1			!near to bias term (source)
@NrPE
=cnwt	1.0			!connection weight
=cnty	WVar			!variable
=cnsc	WAbs			!absolute
@LCFl
=NPEl	0			!input layer
@NrPE
@LCFl

!	*** Build the output layer & connect it to prior layer ***

@LLdf				!load default layer to mi_layer structure
=LDln	"Out"			!layer name
=Lpes	&Out			!copy # of input PEs from menu
=Lsum	"Majority"		!majority function for output layer
=Ltrn	"Signum"		!signum output function
+y	80
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the output layer
=n7	LayN			!save for stdprobe

!	*** Set up for proper output connections ***

=SPEl	2			!output layer
=SPEn	0
=NPEl	1			!adaline layer
=NPEn	0
=cnty	WFix			!fixed weight
=cnsc	WAbs			!absolute connection (wt is still 1.0)

!	*** Connect the Adaline layer to the Output layer

:OutCn
@SlPE				!select next PE in output layer
@NrPE				!select next PE in adaline layer
@PCon				!connect two PEs together
+SPEn	1			!next PE in output layer
?SPEn	&Out			!past the end?
>blt	OutPEOK
=SPEn	0			!back to start of output layer
:OutPEOK
+NPEn	1			!next PE in the adaline layer
?NPEn	&Hd1			!done with layer?
>blt	OutCn			!no, keep going

!	*** Select Control Strategy & L/R Schedule ***

@LLsl				!load super layer
=Lctl	"adaline"		!adaline control strategy
=Llrs	"adaline"		!adaline L/R Schedule
=Llnn	"madaline"		!name of learn input
=Lrcn	"madaline"		!name of recall output
#Incl	"stdioset.iif"		!standard I/O settings
=Lscl	-1			!input  low-value
=Loff	 1			!input  high-value
=Llow	-1			!output low-value
=Lhgh	 1			!output high-value
@SVsl				!save it back
!
=n5	-1.0
=n6	1.0
=n4	&Out
#Incl	"stdprobe.iif"		!Standard probe include file
!
=jogl	-.1			!lower limit for jog
=jogh	+.1			!upper limit for jog
=seed	257			!starting seed number
@seed				!set the seed
@Nini				!Initialize the network
@EOF
