Qnet 2000

A more sophisticated type of integration can be performed using Qnet's dynamic link library (DLL). This integration can be performed by programmers who utilize programming languages that support standard Windows DLL access. QnetTool itself uses Qnetsolv.dll to access Qnet neural networks. This is a 32-bit DLL and may only be accessed by utilities that support Win32 DLL's. If your application programming language supports 32-bit DLL's, you may wish to access Qnetsolv.dll directly. The following routines are available in the DLL:

QnetRecall(FileName, NumberOfCases, InputFloatArray, OutputFloatArray)

The most general access for neural network recall mode. Multiple cases may be analyzed and the input and output arrays are of type float. This is the routine that QnetTool uses to access Qnetsolv.dll.

QnRecF(FileName, InputFloatArray, OutputFloatArray)

Provides the results to a single case. Similar to QnetRecall with the NumberOfCases set to 1.

QnRecD(FileName, InputDoubleArray, OutputDoubleArray)

Similar to QnRecF, but the input and output arrays are of type double (64-bit) instead of float (32-bit).

QnRecS(FileName, InputString, OutputString)

If calling DLL routines with arrays is not supported by your application, Inputs and outputs can be set in strings. Input data should be delimited by commas. A network requiring three inputs may pass a string like "32.4,14.67,44.3" as input. The output string must be large enough to handle the outputs. It is suggested that at least 12 spaces be provided per output node.

QnRecI(FileName, InputIntegerArray, OutputIntegerArray)

Provides access to your neural network by using integer type arrays. This is not appropriate for all networks, but if the calling application only supports integer data types and this data type can accurately depict inputs and outputs, use this routine.

QnRecL(FileName, InputLongArray, OutputLongArray)

Provides access to your neural network by using long integer type arrays. This is not appropriate for all networks, but if the calling application only supports long integer data types and this data type can accurately depict inputs and outputs, use this routine.

All input and output storage requirements must be allocated by your programming application. All qnetsolv routines assume that adequate storage is available and access array elements as needed (determined by the neural network model). Furthermore, the arguments to the routines must be global pointers (locked in memory) and not local memory to your application. The ability to specify this type of data must be investigated through your application's programming language. The following further summarizes the argument types:

The FileName argument is a text string that should contain the fully qualified Qnet neural network definition file.

The NumberOfCases argument to QnetRecall is an integer type (32-bit).

The Array types are of type specified by the name where: float indicates a 32-bit floating point value, double indicates a 64-bit floating point value, integer indicates a indicates a 32-bit integer (Win32). Each array must have enough elements to support the requested operation. For example, if QnetRecall is being called for a network with 20 input nodes and 10 cases are being processed, QnetRecall will attempt to access 200 sepqential floating point elements. All other access routines support only one case per call, so adequate storage must be provided for a single case only. Storage for the arrays must be made available by your calling application.

Accessing Qnet neural networks through QNETSOLV requires that you be a fairly accomplished programmer and have access to a language that supports Win32 DLL access. In most cases, QnetTool can provide the level of integration you require without going through the details of programming the access yourself.

Programmers who build applications for resale may distribute Qnetsolv.dll royalty free with applications accessing Qnet neural networks.

The exported declarations of the Qnetsolv routines are shown below:

int _QnRecF@12(char *NetFile, float *inputs, float *outputs)
int _QnRecI@12(char *NetFile, int *inputs, int *outputs)
int _QnRecL@12(char *NetFile, long *inputs, long *outputs)
int _QnRecS@12(char *NetFile, char *inputs, char *outputs)
int _QnetRecall@16(char *NetFile, int nSolve, float *inputs, float *outputs)

An example use in Visual Basic would be:

Private Declare Function QnRecF Lib
"c:\QnetV2K\source\dll\Qnetsolv.dll" Alias "_QnRecF@12" (ByVal
NNFileName As String, ByRef inV As Single, ByRef outV As Single) As Long

Sub test()
Dim NNFileName As String
ReDim inV(2) As Single
Dim outV As Single
Dim rv As Long

inV(0) = 1
inV(1) = 0.3

NNFileName = "c:\QnetV2K\Samples\SphereDrag/SphereDragTrained.net"
rv = QnRecF(NNFileName, inV(0), outV)

MsgBox outV, 0, "Output"

End Sub