12.6.3 Linking Networks Together with a Bridge

Most TrialProcess objects are implemented to work with a particular set of network objects that are part of a given algorithm. Thus, the BpTrial process expects to operate on BpUnits and BpCons, etc., and crashes otherwise. This makes processing faster than if it had to check the type of every object operated on every time it did a computation.

This situation makes it difficult to implement hybrid networks which combine components that operate under two different algorithms. For example, a self-organizing network can be used to pre-process inputs to a backprop network.

The way to do solve this problem in PDP++ is to use a BridgeProcess, in conjunction with a SyncEpochProc as described in the previous section. Thus, there are two trial processes that each operate synchronously within an epoch on the same events. The bridge process copies activations or any other unit state variable from one network to the other, allowing them to act as if they were a single composite network.

An example of a bridge process can be found in the `demo/bridge' directory. This example just connects two backprop networks, but the principles are the same when you use two different kinds of algorithms.

The parameters of the bridge process are as follows:

Network* second_network
This is the other network that is being bridged (the first network is the one pointed to by the process network pointer).
BridgeDirection direction
This is the direction to copy--network one is the network pointer and network two is the second_network pointer. Note that the network pointer is set by the process hierarchy that this process is in, which means that it can't be set arbitrarily. This is why one might need to switch the direction with this field.
String src_layer_nm
This is the name of the layer in the source network. Only entire layers can be copied with this process.
String trg_layer_nm
This is the name of the layer in the target network.
String src_variable
This is the variable name (e.g. "act") to copy from the unit.
String trg_variable
This is the variable to copy the value into. Typically, this is "ext" so that the input appears like external input to the unit, which will then be treated appropriately by the processing algorithm.
Unit::ExtType trg_ext_flag
This sets the unit flag on the target units to indicate that external input was received, if desired. Note that the flag on the layer is not set, which allows this external input to avoid being erased by the InitExterns call which usually precedes application of environmental patterns.