inst4.0	! (cntrprp.ins)  Counter-Propagation Network Builder
!****************************************************************
!*								*
!*	Counter-Propagation Network Generator			*
!*								*
!****************************************************************

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

?&In	1
>bge	CheckOut
@Err	"Counter-Propagation MUST have at least one input PE"
:CheckOut
?&Out	1
>bge	OutOK
@Err	"Counter-Propagation MUST have at least one output PE"
:OutOK
?&Hd1	1
>bge	HidOK
@Err	"Counter-Propagation MUST have at least one Hidden 1 PE"
:HidOK

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

@LdCS	"cntrprop"		!control strategy
@LdLR	"ctrpkoh"		!L/R schedule
@LdLR	"ctrpwh"		!L/R schedule

=netn	"InstaNet (tm) Counter-Propagation 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
=x	100			!place to put layer on screen
=y	 60
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the input layer

!	*** Build the normalization Layer ***

@LLdf				!load default layer
=Lpes	&In			!input PEs + 1
+Lpes	1
=LDln	"Norm"			!layer name
=Lsum	"NormScale"		!normalize / scale
=Lscl	Lpes			!value to normalize to
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd

!	*** Connect it up to input layer ***

=SPEl	LayN			!normalization layer
@SlPE
=NPEl	0			!input layer
@NrPE
=cnsc	WRel
=cnty	WFix
=cnwt	1.0
@LCCr				!connect corresponding PEs together
=n0	LayN			!normalization layer

!	*** Build the Kohonen Layer ***

@LLdf				!load default layer
=Lpes	&Hd1			!hidden layer PEs
=LDln	"Kohonen"		!layer name
=Lcmp	"One-Highest"		!competing PEs
=Llrn	"KohonenN"		!post-normalize kohonen
=Llrs	"ctrpkoh"		!L/R schedule
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd

!	*** Connect it to the normalization layer ***

=SPEl	LayN			!current layer
@SlPE
=NPEl	n0			!previous layer
@NrPE
=cnty	WVar			!variable
=cnsc	WAbs			!absolute
@LCFl				!fully connect
=n0	LayN			!kohonen layer

!	*** Build the output (widrow-hoff) layer ***

@LLdf				!load default layer to mi_layer structure
=LDln	"Out"			!layer name
=Lpes	&Out			!copy # of input PEs from menu
=Llrn	"Widrow-Hoff"		!learning rule
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the output layer
=n7	LayN			!save for stdprobe

!	*** Connect the output layer to the kohonen layer ***

=SPEl	LayN			!current layer
@SlPE
=NPEl	n0			!normalization layer
@NrPE
@LCFl

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

@LLsl				!load super layer
=Lctl	"cntrprop"		!control strategy
=Llrs	"ctrpwh"		!L/R Schedule
=Llnn	"cntrprp"		!name of learn input
=Lrcn	"cntrprp"		!name of recall output
#Incl	"stdioset.iif"		!standard I/O settings
=Lscl	-1			!input  low-value
=Loff	 1			!input  high-value
=Llow	 0			!output low-value
=Lhgh	 1			!output high-value
@SVsl				!save it back
!
=n5	0.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



