NLP2.h
00001 #ifndef NLP2_h
00002 #define NLP2_h
00003
00004 #include "NLP1.h"
00005
00006 using std::ostream;
00007
00018 namespace OPTPP {
00019
00020 class NLP2: public NLP1 {
00021 protected:
00023 NEWMAT::SymmetricMatrix Hessian;
00025 int nhevals;
00026
00027 public:
00034 NLP2():
00035 NLP1(), Hessian(0), nhevals(0) {;}
00042 NLP2(int ndim):
00043 NLP1(ndim), Hessian(ndim), nhevals(0) {;}
00051 NLP2(int ndim, int nlncons):
00052 NLP1(ndim, nlncons), Hessian(ndim), nhevals(0) {;}
00060 NLP2(int ndim, CompoundConstraint* constraint):
00061 NLP1(ndim,constraint), Hessian(ndim), nhevals(0) {;}
00062
00066 virtual ~NLP2() {}
00067
00071 NEWMAT::SymmetricMatrix getHess() const {return Hessian;}
00072
00076 int getHevals() const {return nhevals;}
00077
00079 virtual void reset() = 0;
00081 virtual void initFcn() = 0;
00083 virtual real evalF() = 0;
00085 virtual real evalF(const NEWMAT::ColumnVector& x) = 0;
00087 virtual void eval() = 0;
00088
00090 virtual NEWMAT::ColumnVector evalG() = 0;
00092 virtual NEWMAT::ColumnVector evalG(const NEWMAT::ColumnVector& x) = 0;
00093
00095 virtual NEWMAT::SymmetricMatrix evalH() = 0;
00097 virtual NEWMAT::SymmetricMatrix evalH(NEWMAT::ColumnVector& x) = 0;
00098
00099
00101 virtual real evalLagrangian(const NEWMAT::ColumnVector& x, NEWMAT::ColumnVector& mult,
00102 const NEWMAT::ColumnVector& type) = 0;
00104 virtual NEWMAT::ColumnVector evalLagrangianGradient(const NEWMAT::ColumnVector& x,
00105 const NEWMAT::ColumnVector& mult,
00106 const NEWMAT::ColumnVector& type) = 0;
00107
00109 virtual NEWMAT::ColumnVector evalCF(const NEWMAT::ColumnVector& x) = 0;
00111 virtual NEWMAT::Matrix evalCG(const NEWMAT::ColumnVector& x) = 0;
00112 virtual NEWMAT::SymmetricMatrix evalCH(NEWMAT::ColumnVector& x) = 0;
00114 virtual OptppArray<NEWMAT::SymmetricMatrix> evalCH(NEWMAT::ColumnVector& x, int darg) = 0;
00115 virtual void evalC(const NEWMAT::ColumnVector& x) = 0;
00116
00117
00119 virtual void printState(char* s) ;
00121 virtual void fPrintState(ostream *nlpout, char* s ) ;
00122
00123 };
00124
00129 void Print(const NEWMAT::Matrix& X);
00130 void Print(const NEWMAT::UpperTriangularMatrix& X);
00131 void Print(const NEWMAT::DiagonalMatrix& X);
00132 void Print(const NEWMAT::SymmetricMatrix& X);
00133 void Print(const NEWMAT::LowerTriangularMatrix& X);
00134
00135 void FPrint(ostream *fout, const NEWMAT::Matrix& X);
00136 void FPrint(ostream *fout, const NEWMAT::SymmetricMatrix& X);
00137 void FPrint(ostream *fout, const NEWMAT::DiagonalMatrix& X);
00138
00139 }
00140
00141 #endif