#include "msvc.h"


#ifndef NETWORK_H
#define NETWORK_H

enum {NS_RECALL_NETWORK, NS_LEARNING_NETWORK, NS_NETWORK};
enum {ONLINE, BATCH, CUSTOM};


class NSRecallNetwork
{
public:
//Overridden functions
     virtual int                     createNetwork();
     virtual int                     randomizeWeights();
     virtual int                     resetNetwork();
     virtual int                     getResponse(int, double *, double *);
     virtual int                     getSensitivity(int, double *, double *&, double);
     virtual int                     destroyNetwork();
     virtual int                     train(int, int, double *, double *, int, double *, double *){return 1;};
     virtual int                     setBestCost(double){return 1;};
     virtual int                     getBestCost(double &){return 1;};
     virtual int                     getEpochOfBestCost(int &){return 1;};
     virtual int                     setBestWeightsPathName(char *){return 1;};
     virtual int                     getBestWeightsPathName(char *, int, int &){return 1;};
     virtual int                     setSaveBestWeightsEnabled(bool){return 1;};
     virtual int                     getSaveBestWeightsEnabled(bool &){return 1;};
     virtual int                     setSaveBestWeightsForTraining(bool){return 1;};
     virtual int                     getSaveBestWeightsForTraining(bool &){return 1;};
     virtual int                     setCrossValidationEnabled(bool){return 1;};
     virtual int                     getCrossValidationEnabled(bool &){return 1;};
     virtual int                     getInput(double *, double *, double, double *){return 1;};
     virtual int                     setAutoComputeInputNormCoeff(bool){return 1;};
     virtual int                     getAutoComputeInputNormCoeff(bool &){return 1;};
     virtual int                     setAutoComputeOutputNormCoeff(bool){return 1;};
     virtual int                     getAutoComputeOutputNormCoeff(bool &){return 1;};
     virtual int                     removeInputNormalization(){return 1;};
     virtual int                     removeOutputNormalization(){return 1;};
     virtual int                     setInputNormMin(double){return 1;};
     virtual int                     getInputNormMin(double &){return 1;};
     virtual int                     setInputNormMax(double){return 1;};
     virtual int                     getInputNormMax(double &){return 1;};
     virtual int                     setOutputNormMin(double){return 1;};
     virtual int                     getOutputNormMin(double &){return 1;};
     virtual int                     setOutputNormMax(double){return 1;};
     virtual int                     getOutputNormMax(double &){return 1;};
     virtual int                     setNormalizeInputByChannel(bool){return 1;};
     virtual int                     getNormalizeInputByChannel(bool &){return 1;};
     virtual int                     setNormalizeOutputByChannel(bool){return 1;};
     virtual int                     getNormalizeOutputByChannel(bool &){return 1;};
     virtual int                     getCostData(double *){return 1;};
     virtual int                     getCrossValidationCostData(double *){return 1;};
     virtual int                     getNumberOfEpochsTrained(int &){return 1;};
     virtual int                     seedRandom(unsigned int){return 1;};

     virtual int                     setUpdateMethod(int){return 1;};
     virtual int                     getUpdateMethod(int &){return 1;};
     virtual int                     setCustomExemplarsPerUpdate(int){return 1;};
     virtual int                     getCustomExemplarsPerUpdate(int &){return 1;};
     virtual int                     getGradient(double *, double *){return 1;};
     virtual int                     setNumberOfInputs(int){return 1;};
     virtual int                     setNumberOfOutputs(int){return 1;};
     virtual int                     getNumberOfHiddenLayers(int &){return 1;};
     virtual int                     setNumberOfHiddenLayerPEs(int, int){return 1;};
     virtual int                     getNumberOfHiddenLayerPEs(int, int &){return 1;};
     virtual int                     getNumberOfStepSizes(int &){return 1;};
     virtual int                     setStepSize(int, double){return 1;};
     virtual int                     getStepSize(int, double &){return 1;};
     virtual int                     bumpStepSizes(double){return 1;};
     virtual int                     getNumberOfMomentums(int &){return 1;};
     virtual int                     setMomentum(int, double){return 1;};
     virtual int                     getMomentum(int, double &){return 1;};
     virtual int                     setSamplesPerExemplar(int){return 1;};
     virtual int                     getSamplesPerExemplar(int &){return 1;};
     virtual int                     setSamplesPerExemplarBackprop(int){return 1;};
     virtual int                     getSamplesPerExemplarBackprop(int &){return 1;};
     virtual int                     isDynamicNetwork(bool &){return 1;};
     virtual int                     getNumberOfTDNNAxons(int &){return 1;};
     virtual int                     setNumberOfTDNNAxonTaps(int, int){return 1;};
     virtual int                     getNumberOfTDNNAxonTaps(int, int &){return 1;};
     virtual int                     setOnEpochEndedFunctionPointer(void *){return 1;};
     virtual int                     getCurrentCost(double &){return 1;};
     virtual int                     getCurrentCrossValidationCost(double &){return 1;};
     virtual int                     setInputDataMask(int *){return 1;};
     virtual int                     getInputDataMask(int *){return 1;};
     virtual int                     removeInputDataMask(bool){return 1;};
     virtual int                     setUseRecencyOfObservationScaling(bool){return 1;};
     virtual int                     setUseDirectionOfChangeScaling(bool){return 1;};
     virtual int                     setUseMagnitudeOfChangeScaling(bool){return 1;};
     virtual int                     setSmallChangeScale(double){return 1;};
     virtual int                     setLargeChangeScale(double){return 1;};
     virtual int                     setRightDirectionScale(double){return 1;};
     virtual int                     setWrongDirectionScale(double){return 1;};
     virtual int                     setSmallChangeRightDirectionScale(double){return 1;};
     virtual int                     setLargeChangeRightDirectionScale(double){return 1;};
     virtual int                     setSmallChangeWrongDirectionScale(double){return 1;};
     virtual int                     setLargeChangeWrongDirectionScale(double){return 1;};
     virtual int                     setDiscountRate(double){return 1;};
     virtual int                     setDataPreDifferenced(bool){return 1;};
     virtual int                     setGradientDescentMethod(int){return 1;};
     virtual int                     getGradientDescentMethod(int &){return 1;};
     virtual int                     setOutputLayerTransferFunction(int){return 1;};
     virtual int                     getOutputLayerTransferFunction(int &){return 1;};
     virtual int                     setHiddenLayerTransferFunction(int, int) {return 1;};
     virtual int                     getHiddenLayerTransferFunction(int, int &) {return 1;};
     virtual int                     setHiddenLayerBeta(int, double) {return 1;};
     virtual int                     getHiddenLayerBeta(int, double &) {return 1;};
     virtual int                     setOutputLayerBeta(double) {return 1;};
     virtual int                     getOutputLayerBeta(double &) {return 1;};
     virtual int                     setHiddenLayerBiasVariance(int, double) {return 1;};
     virtual int                     getHiddenLayerBiasVariance(int, double &) {return 1;};
     virtual int                     setOutputLayerBiasVariance(double) {return 1;};
     virtual int                     getOutputLayerBiasVariance(double &) {return 1;};
     virtual int                     getMAPE(int, double *, double *, int, double &) {return 1;};

//Non-overridden functions
                                     NSRecallNetwork();
     int                             getOutputs(int &);
     int                             getInputs(int &);
     int                             loadWeights(char *);
     int                             saveWeights(char *, char *);
//DLL function prototypes and instance variable declarations

protected:
//Overridden functions
     virtual int                     createComponents();
     virtual int                     setInitializations();
     virtual int                     setInterconnections();
     virtual int                     postInterconnections();
     virtual int                     loadComponentWeights(FILE *&);
     virtual int                     saveComponentWeights(FILE *&);
     virtual int                     saveNormalizationCoefficients(FILE *&);
     virtual int                     preRunGetReady();
//Non-overridden functions
     int                             loadNormalizationCoefficients(FILE *&);
     int                             getOutput(int, double*);
     int                             getOutputWithoutDenormalization(int, double*);
     int                             setInput(int, double*);
     int                             fireConclude();
     int                             getNumberOfInputs();
     int                             postFireGetReady();
//Components
Axon *inputAxon;
FullSynapse *hidden1Synapse;
Axon *hidden1Axon;
FullSynapse *hidden2Synapse;
Axon *hidden2Axon;
FullSynapse *hidden3Synapse;
Axon *hidden3Axon;
FullSynapse *hidden4Synapse;
Axon *hidden4Axon;
FullSynapse *hidden5Synapse;
Axon *hidden5Axon;
FullSynapse *outputSynapse;
Axon *outputAxon;
DynamicControl *control;
FullSynapse *recurrentSynapse;
FullSynapse *forwardSynapse;

//DLL global variable declarations

//Variables
    double                            *m_dpInputNormAmp,
                                     *m_dpInputNormOffset,
                                     *m_dpOutputNormAmp,
                                     *m_dpOutputNormOffset;
    bool                             m_bNormalizeInput;
    bool                             m_bNormalizeOutput;
    int                              m_iNumberOfInputs;
    int                              m_iNumberOfOutputs;
    unsigned short int               m_usiWeightFileVersion;
    int                              *m_ipInputDataMap;
    int                              m_iNumberOfInputsAfterMask;
};

#endif
