NonLinearConstraint.h

00001 #ifndef NonLinearConstraint_h
00002 #define NonLinearConstraint_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 "NLP.h"
00017 #include "ConstraintBase.h"
00018 
00028 namespace OPTPP {
00029 
00030 class NonLinearConstraint: public ConstraintBase{
00031 protected:      
00033   NLP*           nlp_;          
00035   NEWMAT::ColumnVector  lower_;         
00037   NEWMAT::ColumnVector  upper_;         
00039   mutable NEWMAT::ColumnVector  cvalue_;                
00041   mutable NEWMAT::ColumnVector  cviolation_;            
00043   int   numOfCons_;             
00045   int   numOfVars_;             
00047   int   nnzl_;                  
00049   int   nnzu_;                  
00051   OptppArray<int> constraintMappingIndices_; 
00053   bool  stdForm_;               
00055   NEWMAT::ColumnVector ctype_;          
00056 
00057 public:
00058 // Constructors
00062   NonLinearConstraint();
00067   NonLinearConstraint(NLP* nlprob, int numconstraints = 1);
00073   NonLinearConstraint(NLP* nlprob, const bool conFlag, int numconstraints = 1);
00079   NonLinearConstraint(NLP* nlprob, const NEWMAT::ColumnVector& rhs, 
00080                    int numconstraints = 1); 
00087   NonLinearConstraint(NLP* nlprob, const NEWMAT::ColumnVector& rhs, 
00088                    const bool conFlag = true, int numconstraints = 1); 
00095   NonLinearConstraint(NLP* nlprob, const NEWMAT::ColumnVector& lower, 
00096                      const NEWMAT::ColumnVector& upper, int numconstraints = 1);
00097 
00098 #ifdef DAKOTA_OPTPP
00099   NonLinearConstraint(NLP* nlprob, const NEWMAT::ColumnVector& lower, 
00100                      const NEWMAT::ColumnVector& upper, int ne, int ni );
00101 #endif // DAKOTA_OPTPP
00102 
00106   virtual ~NonLinearConstraint(){}
00107 
00111   virtual int getNumOfCons() const {return numOfCons_;}
00112 
00116   virtual int getNumOfVars() const {return numOfVars_;}
00117         
00121   virtual NEWMAT::ColumnVector getLower() const {return lower_;}
00122 
00126   virtual NEWMAT::ColumnVector getUpper() const {return upper_;}
00127 
00131   virtual NEWMAT::ColumnVector getConstraintValue() const {return cvalue_;}
00132 
00136   virtual NEWMAT::ColumnVector getConstraintViolation() const {return cviolation_;}
00137 
00141   virtual OptppArray<int> getConstraintMappingIndices() const 
00142                 {return constraintMappingIndices_;}
00143 
00144 #ifdef DAKOTA_OPTPP
00145   virtual NEWMAT::ColumnVector getConstraintType() const {return ctype_;}
00146   virtual NEWMAT::ColumnVector evalResidual(const NEWMAT::ColumnVector& xc) const ;
00147   virtual void evalCFGH(const NEWMAT::ColumnVector& xc) const ;
00148   virtual NEWMAT::Matrix evalGradient(const NEWMAT::ColumnVector& xc) const ;
00149   virtual NEWMAT::SymmetricMatrix evalHessian(NEWMAT::ColumnVector& xc) const ;
00150   virtual OptppArray<NEWMAT::SymmetricMatrix> evalHessian(NEWMAT::ColumnVector& xc, int darg) const ; 
00151   virtual bool amIFeasible(const NEWMAT::ColumnVector& xc, double epsilon) const;
00152 #else
00153 
00158   virtual NEWMAT::ColumnVector evalResidual(const NEWMAT::ColumnVector& xc) const = 0;
00159   virtual void evalCFGH(const NEWMAT::ColumnVector& xc) const = 0;
00160 
00166   virtual NEWMAT::Matrix evalGradient(const NEWMAT::ColumnVector& xc) const = 0;
00167 
00173   virtual NEWMAT::SymmetricMatrix evalHessian(NEWMAT::ColumnVector& xc) const = 0;
00174 
00181   virtual OptppArray<NEWMAT::SymmetricMatrix> evalHessian(NEWMAT::ColumnVector& xc, int darg) const  = 0; 
00182 
00189   virtual bool amIFeasible(const NEWMAT::ColumnVector& xc, double epsilon) const = 0;
00190 #endif // DAKOTA_OPTPP
00191 
00192 };
00193 
00194 } // namespace OPTPP
00195 #endif
Generated on Mon Jan 24 12:04:37 2011 for FASTlib by  doxygen 1.6.3