NLPBase.h

00001 #ifndef NLPBase_h
00002 #define NLPBase_h
00003 
00004 /*----------------------------------------------------------------------
00005  Copyright (c) 2001, Sandia Corporation.   Under the terms of Contract 
00006  DE-AC04-94AL85000, there is a non-exclusive license for use of this 
00007  work by or on behalf of the U.S. Government.
00008 
00009  P.J. Williams, Sandia National Laboratories, pwillia@sandia.gov
00010  ----------------------------------------------------------------------*/
00011 
00012 #ifdef HAVE_CONFIG_H
00013 #include "OPT++_config.h"
00014 #endif
00015 
00016 #include <iostream>
00017 #include <fstream>
00018 #ifdef HAVE_STD
00019 #include <cstring>
00020 #include <cfloat>
00021 #include <cmath>
00022 #else
00023 #include <string.h>
00024 #include <float.h>
00025 #include <math.h>
00026 #endif
00027 
00028 using std::ostream;
00029 
00030 #include "globals.h"
00031 #include "precisio.h"
00032 #include "OptppArray.h"
00033 #include "OptppFatalError.h"
00034 #include "OptppExceptions.h"
00035 
00036 
00037 namespace OPTPP {
00038 
00046 class NLPBase{
00047 
00048 public:
00049 // Destructor
00050   virtual ~NLPBase() {;}
00051 
00052 // set and Accessor Methods
00053   virtual void setX(const int i, const real& x)  = 0;
00054   virtual void setX(const NEWMAT::ColumnVector& x)       = 0;
00055 
00056   virtual void setF(const real& fx)              = 0;
00057 
00058   virtual void setIsExpensive(const int e)       = 0;
00059 
00060   virtual void setFcnAccrcy(const int i, const real& accrcy)  = 0;
00061   virtual void setFcnAccrcy(const NEWMAT::ColumnVector& accrcy)       = 0;
00062 
00063   virtual int  getDim()                 const = 0;
00064   virtual int  getFevals()              const = 0;
00065   virtual int  getIsExpensive()         const = 0;
00066   virtual real getF()                   const = 0;
00067   virtual NEWMAT::ColumnVector getFcnAccrcy()   const = 0;
00068   virtual NEWMAT::ColumnVector getXc()          const = 0;
00069   virtual real getFcnTime()             const = 0;
00070 
00071 // Constraint Accessor Methods
00072   virtual int  getNumOfCons()           const = 0;
00073   virtual int  getNumOfNLCons()         const = 0;
00074   virtual bool hasConstraints()               = 0;
00075   virtual void printConstraints()             = 0; 
00076 
00077 // Reset values to allow multiple instantiations 
00078   virtual void reset() = 0;
00079 
00080 // Debugging tools
00081   virtual void setDebug()       = 0;
00082   virtual bool getDebug() const = 0;
00083 
00084 // Function Evaluation Methods
00085   virtual void initFcn()  = 0;
00086   virtual real evalF()  = 0;
00087   virtual real evalF(const NEWMAT::ColumnVector &x)  = 0;
00088   virtual NEWMAT::ColumnVector evalG()  = 0;
00089   virtual NEWMAT::ColumnVector evalG(const NEWMAT::ColumnVector &x)  = 0;
00090   virtual NEWMAT::SymmetricMatrix evalH()  = 0;
00091   virtual NEWMAT::SymmetricMatrix evalH(NEWMAT::ColumnVector &x)  = 0;
00092   virtual void eval()  = 0;
00093 
00094 // Constraint Evaluation Methods
00095   virtual NEWMAT::ColumnVector evalCF(const NEWMAT::ColumnVector &x)  = 0;
00096   virtual NEWMAT::Matrix evalCG(const NEWMAT::ColumnVector &x)  = 0;
00097   virtual NEWMAT::SymmetricMatrix evalCH(NEWMAT::ColumnVector &x)  = 0;
00098   virtual OptppArray<NEWMAT::SymmetricMatrix> evalCH(NEWMAT::ColumnVector &x, int darg)  = 0;
00099   virtual void evalC(const NEWMAT::ColumnVector &x)  = 0;
00100 
00101 // Print Methods
00102   virtual void printState(char *s) = 0; 
00103   virtual void fPrintState(ostream *nlpout, char *s) = 0; 
00104 
00105 };
00106 
00107 } // namespace OPTPP
00108 #endif
Generated on Mon Jan 24 12:04:37 2011 for FASTlib by  doxygen 1.6.3