LinearConstraint.h

00001 #ifndef LinearConstraint_h
00002 #define LinearConstraint_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 
00013 #include "ConstraintBase.h"
00014 
00025 namespace OPTPP {
00026 
00027 class LinearConstraint: public ConstraintBase {
00028 protected:
00030   int           numOfCons_;     
00032   int           numOfVars_;     
00034   int           nnzl_;          
00036   int           nnzu_;          
00038   NEWMAT::Matrix       A_;              
00039 
00041   NEWMAT::ColumnVector Ax_;             
00043   NEWMAT::ColumnVector lower_;          
00045   NEWMAT::ColumnVector upper_;          
00047   mutable NEWMAT::ColumnVector cvalue_;         
00049   mutable NEWMAT::ColumnVector cviolation_;             
00050 
00052   OptppArray<int> constraintMappingIndices_;
00054   bool          stdForm_;       
00055 
00056 public:
00057 // Constructors
00061   LinearConstraint();
00070   LinearConstraint(const NEWMAT::Matrix& A);
00080   LinearConstraint(const NEWMAT::Matrix& A, const NEWMAT::ColumnVector& b); 
00090   LinearConstraint(const NEWMAT::Matrix& A, const NEWMAT::ColumnVector& b, 
00091                    const bool rowFlag);
00101   LinearConstraint(const NEWMAT::Matrix& A, const NEWMAT::ColumnVector& lower,
00102                    const NEWMAT::ColumnVector& upper);
00103 
00107   virtual ~LinearConstraint(){}
00108 
00109 
00113   virtual int getNumOfCons() const {return numOfCons_;}
00114 
00118   virtual int getNumOfVars() const {return numOfVars_;}
00119 
00123   virtual NEWMAT::ColumnVector getLower() const {return lower_;}
00124 
00128   virtual NEWMAT::ColumnVector getUpper() const {return upper_;}
00129 
00133   virtual NEWMAT::ColumnVector getConstraintValue() const {return cvalue_;}
00134 
00138   virtual NEWMAT::ColumnVector getConstraintViolation() const {return cviolation_;}
00139 
00143   OptppArray<int> getConstraintMappingIndices() const 
00144                 { return constraintMappingIndices_; }
00145 
00146   
00150   void setA(NEWMAT::Matrix & A);
00151 
00159   virtual NEWMAT::ColumnVector getConstraintType() const = 0;
00160 
00166   virtual NEWMAT::ColumnVector evalAx(const NEWMAT::ColumnVector& xc) const = 0;
00167 
00174   virtual NEWMAT::ColumnVector evalResidual(const NEWMAT::ColumnVector& xc) const = 0;
00175   virtual void evalCFGH(const NEWMAT::ColumnVector& xc) const = 0;
00176 
00183   virtual NEWMAT::Matrix evalGradient(const NEWMAT::ColumnVector& xc) const = 0;
00184 
00191   virtual bool amIFeasible(const NEWMAT::ColumnVector& xc, double epsilon) const = 0;
00192 
00193 private:
00199   virtual NEWMAT::SymmetricMatrix evalHessian(NEWMAT::ColumnVector& xc) const ;
00206   virtual OptppArray<NEWMAT::SymmetricMatrix> evalHessian(NEWMAT::ColumnVector& xc, int darg) const;
00207 
00213   bool dimMatch(NEWMAT::Matrix& A);
00214 
00215 };
00216 
00217 } // namespace OPTPP
00218 #endif
Generated on Mon Jan 24 12:04:37 2011 for FASTlib by  doxygen 1.6.3