00001 #ifndef NLPBOUNDS
00002 #define NLPBOUNDS
00003
00014 #include "IotrRefCount.hh"
00015 #include "IotrHandle.hh"
00016 #include "ElementGather.hh"
00017
00018 #include "IotrVector.hh"
00019
00020
00021 class NlpSimpleLinsys;
00022
00023 class NlpIterate;
00024 class IotrVector;
00025 class ElementGather;
00026
00027 typedef Handle<IotrVector> IotrVectorHandle;
00028 typedef Handle<ElementGather> ElementGatherHandle;
00029
00034 class NlpBounds : public IotrRefCount {
00035
00036 friend class NlpSimpleLinsys;
00037
00038 protected:
00039
00043 IotrVectorHandle mXlow, mXupp;
00044 ElementGatherHandle mIxlow, mIxupp;
00046
00049 IotrVectorHandle mClow, mCupp;
00050 ElementGatherHandle mIclow, mIcupp;
00051
00052 IotrVectorHandle mCeq;
00053 ElementGatherHandle mIceq;
00054
00055 ElementGatherHandle mIcineq, mIneq2Cupp, mIneq2Clow;
00057 public:
00058 NlpBounds( IotrVector * xlow, ElementGather * ixlow,
00059 IotrVector * xupp, ElementGather * ixupp,
00060 IotrVector * clow, ElementGather * iclow,
00061 IotrVector * cupp, ElementGather * icupp,
00062 IotrVector * mEquality, ElementGather * iequality);
00063
00065 static NlpBounds * fromRanges( IotrVector & xlow, IotrVector & xupp,
00066 IotrVector & clow, IotrVector & cupp,
00067 double bignum );
00068
00072 IotrVector & xlow() { return *mXlow; }
00073 ElementGather & ixlow() { return *mIxlow; }
00074 ElementGather * pixlow() { return HandleAsPointer( mIxlow ); };
00075
00076 IotrVector & xupp() { return *mXupp; }
00077 ElementGather & ixupp() { return *mIxupp; }
00078 ElementGather * pixupp() { return HandleAsPointer( mIxupp ); };
00079
00080 IotrVector & clow() { return *mClow; }
00081 ElementGather & iclow() { return *mIclow; }
00082 ElementGather * piclow() { return HandleAsPointer( mIclow ); };
00083
00084 IotrVector & cupp() { return *mCupp; }
00085 ElementGather & icupp() { return *mIcupp; }
00086 ElementGather * picupp() { return HandleAsPointer( mIcupp ); };
00087
00088 IotrVector & equality() { return *mCeq; }
00089 ElementGather & iequality() { return *mIceq; }
00090 ElementGather * piequality() { return HandleAsPointer( mIceq ); };
00091
00092 ElementGather & iinequality() { return *mIcineq; }
00093
00094 ElementGather & ineq2Clow() { return *mIneq2Clow; }
00095 ElementGather & ineq2Cupp() { return *mIneq2Cupp; }
00097 int nx() { return mIxupp->nx(); }
00099 int nxupp() { return mIxupp->my(); }
00101 int nxlow() { return mIxlow->my(); }
00102
00104 int mcupp() { return mIcupp->my(); }
00106 int mclow() { return mIclow->my(); }
00108 int mequality() { return mIceq->my(); }
00109 int mcon() { return mIceq->nx(); }
00110 int my() { return mIceq->my(); }
00111 int mz() { return mIcineq->my(); }
00112
00113 IotrVector * newDualVector() { return mIclow->domainVector(); }
00114 IotrVector * newPrimalVector() { return mIxlow->domainVector(); }
00115 virtual void condenseMultipliers( IotrVector & y, IotrVector & lambda,
00116 IotrVector & pi, IotrVector & yz );
00117 virtual void inspect();
00118 };
00119
00127 struct BasicCategorizeConstraints : public IotrVectorCategorize {
00128 double mBignum;
00129 BasicCategorizeConstraints( double bignum ) : mBignum(bignum) {}
00130 enum{ lowerBound = category1, upperBound = category2,
00131 equality = category3 };
00132 void operator()( unsigned char result[], int len, int ncat,
00133 const double rxlow[], const double *rhs[], int nrhs ) const;
00134 };
00135
00139 struct BoundsFindFixed : public IotrVectorCategorize {
00140 virtual void operator()( unsigned char cat[], int len, int ncat,
00141 const double self[],
00142 const double *rhs[], int nrhs ) const;
00143 };
00144
00145 typedef Handle<NlpBounds> NlpBoundsHandle;
00146
00147 #endif