BoundConstraint.h
00001 #ifndef BoundConstraint_h
00002 #define BoundConstraint_h
00003
00004
00005
00006
00007
00008
00009
00010 #include "ConstraintBase.h"
00011
00020 namespace OPTPP {
00021
00022 class BoundConstraint: public ConstraintBase {
00023
00024 protected:
00026 int numOfCons_;
00028 int numOfVars_;
00030 int nnzl_;
00032 int nnzu_;
00033
00035 NEWMAT::ColumnVector lower_;
00037 NEWMAT::ColumnVector upper_;
00039 mutable NEWMAT::ColumnVector cvalue_;
00040
00042 BoolVector fixedVar_;
00044 BoolVector freeVar_;
00045
00047 const BoolVector stdForm_;
00049 NEWMAT::ColumnVector ctype_;
00050
00052 OptppArray<int> constraintMappingIndices_;
00053
00054 public:
00063 BoundConstraint();
00064
00074 BoundConstraint(int nc, const NEWMAT::ColumnVector& lower);
00075
00085 BoundConstraint(int nc, const NEWMAT::ColumnVector& bound, const BoolVector& bdFlag);
00086
00096 BoundConstraint(int nc, const NEWMAT::ColumnVector& lower, const NEWMAT::ColumnVector& upper);
00097
00101 ~BoundConstraint() {;}
00102
00106 virtual int getNumOfCons() const {return numOfCons_;}
00107
00111 virtual int getNumOfVars() const {return numOfVars_;}
00112
00116 virtual NEWMAT::ColumnVector getLower() const {return lower_;}
00117
00121 void setLower(NEWMAT::ColumnVector& x) {lower_ = x;}
00122
00126 virtual NEWMAT::ColumnVector getUpper() const {return upper_;}
00127
00131 void setUpper(NEWMAT::ColumnVector& x) {upper_ = x;}
00132
00136 virtual NEWMAT::ColumnVector getConstraintType() const {return ctype_;}
00137
00141 virtual NEWMAT::ColumnVector getConstraintValue() const {return cvalue_;}
00142
00147 virtual NEWMAT::ColumnVector getConstraintViolation() const {return cvalue_;}
00148
00152 OptppArray<int> getConstraintMappingIndices() const
00153 { return constraintMappingIndices_; }
00154
00158 BoolVector getFixedVar() const {return fixedVar_;}
00159
00163 BoolVector getFreeVar() const {return freeVar_;}
00164
00168 BoolVector getStdForm() const {return stdForm_;}
00169
00177 virtual bool amIFeasible(const NEWMAT::ColumnVector& xc, double epsilon) const;
00178
00184 bool amIConsistent() const;
00185
00186
00187
00193 virtual NEWMAT::ColumnVector evalResidual(const NEWMAT::ColumnVector& xc) const;
00194 virtual void evalCFGH(const NEWMAT::ColumnVector& xc) const;
00195
00196 private:
00202 virtual NEWMAT::Matrix evalGradient(const NEWMAT::ColumnVector& xc) const;
00208 virtual NEWMAT::SymmetricMatrix evalHessian(NEWMAT::ColumnVector& xc) const;
00209
00216 virtual OptppArray<NEWMAT::SymmetricMatrix> evalHessian(NEWMAT::ColumnVector& xc, int darg) const;
00217 };
00218
00219 }
00220 #endif