Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

NlpSimple.hh

Go to the documentation of this file.
00001 #ifndef NLPSIMPLE
00002 #define NLPSIMPLE
00003 
00017 #include "IotrRefCount.hh"
00018 #include "IotrHandle.hh"
00019 #include "NlpBounds.hh"
00020 #include "Nlp.hh"
00021 
00022 class NlpIterate;
00023 class NlpResiduals;
00024 class NlpLinsys;
00025 class NlpLocalModel;
00026 class NlpValues;
00027 class NlpGrads;
00028 class NlpHessian;
00029 class GenMatrix;
00030 class Functional;
00031 class IotrMask;
00032 
00033 typedef Handle<Functional> FunctionalHandle;
00034 typedef Handle<NlpBounds>  NlpBoundsHandle;
00035 typedef Handle<GenMatrix>  GenMatrixHandle;
00036 typedef Handle<IotrMask>   IotrMaskHandle;
00037 
00042 class NlpSimple : public Nlp {
00043 private:
00044   void initializeBounds( IotrVector & rxlow, IotrVector & rxupp,
00045                          IotrVector & rclow, IotrVector & rcupp,
00046                          double bignum  );
00047 protected:
00049   NlpBoundsHandle  mBounds;
00051   FunctionalHandle mRawFunctional;
00052   ElementGatherHandle mIxfixed, mXfilter;
00053   IotrMaskHandle mXmask;
00054   IotrVectorHandle mFixed;
00055 
00056   IotrVectorHandle mRawX, mYz;
00057 public:
00058   NlpSimple();
00059   virtual void initialize( IotrVector & rxlow, IotrVector & rxupp,
00060                            IotrVector & rclow, IotrVector & rcupp,
00061                            IotrVector & x,     IotrVector & yz,
00062                            double bignum,
00063                            Functional * c);
00064 
00066   virtual NlpBounds * getBoundsPtr();
00067   virtual NlpBounds & bounds();
00068   NlpBounds & rawBounds() { return *mBounds; }
00069 
00073   virtual NlpIterate   * newVariables();
00074   virtual NlpIterate   * initialVariables();
00075   virtual NlpResiduals * newResiduals();
00076   virtual NlpLinsys    * newLinsys();
00077   virtual NlpValues    * newValues();
00078   virtual NlpGrads     * newGrads();
00079   virtual NlpHessian   * newHessian();
00081 
00082   virtual NlpLocalModel * localModelAt( NlpIterate & );
00083   virtual void inspect();
00084   virtual void writeConfiguration( std::ostream & out, char indent[] );
00085 };
00086 typedef Handle<NlpSimple> NlpSimpleHandle;
00087 
00088 
00089 class IotrVector;
00090 class EvaluationContext;
00091 class SymMatrix;
00092 class IotrMask;
00093 
00094 typedef Handle<IotrVector> IotrVectorHandle;
00095 typedef Handle<IotrMask> IotrMaskHandle;
00096 typedef Handle<EvaluationContext> EvaluationContextHandle;
00097 typedef Handle<SymMatrix> SymMatrixHandle;
00098 
00103 class NlpSimpleLocalModel : public NlpLocalModel {
00104 protected:
00106   EvaluationContextHandle  mEc;
00107 
00108 public:
00109   NlpSimpleLocalModel( EvaluationContext * ec );
00115   virtual void updateValues( NlpValues & values );
00117   virtual void updateGrads( NlpGrads & grads );
00119   virtual void updateHessian( NlpHessian & hessian );
00121 };
00122 
00129 class NlpSimpleValues : public NlpValues {
00130   friend class NlpSimpleLocalModel;
00131 protected:
00133   IotrVectorHandle mC;
00135   double mObj;
00136 public:
00138   NlpSimpleValues( IotrVector * c );
00139 
00140   virtual const IotrVector & c() const;
00142   virtual double obj();
00143 
00144   virtual void inspect();
00145   virtual void inspectAsMatlab();
00146 };
00147 
00153 class NlpSimpleGrads : public NlpGrads {
00154   friend class NlpSimpleLocalModel;
00155 protected:
00157   IotrVectorHandle mRawG, mYz;
00159   GenMatrixHandle mJ;
00160 
00161   ElementGatherHandle mXfilter;
00162   NlpBoundsHandle mBounds;
00163 public:
00165   NlpSimpleGrads( IotrVector * rawG, IotrVector * yz, GenMatrix * J,
00166                   ElementGather * aXfilter, NlpBounds * bounds );
00167 
00168   GenMatrix & J() { return *mJ; }
00169   virtual LinearOperator * condensedJacobianOperator();
00170 
00172   virtual void getObjectiveGradient( IotrVector & g );
00174   virtual void jacobianTransposeMult( double alpha, IotrVector & x,
00175                                       double beta,  IotrVector & y );
00176   virtual void jacobianTransposeMult( double alpha, IotrVector & y,
00177                                       IotrVector & lambda, IotrVector & pi,
00178                                       IotrVector & gamma,  IotrVector & phi,
00179                                       double beta,  IotrVector & x );
00180 
00182   virtual void jacobianMult( double alpha, IotrVector & x,
00183                              double beta,  IotrVector & y );
00184 
00186   virtual void condensedJacobianMult( double alpha, IotrVector & x,
00187                              double beta,  IotrVector & y );
00188 
00189   virtual void inspect();
00190   virtual void inspectAsMatlab();
00191 };
00192 
00197 class NlpSimpleHessian : public NlpHessian {
00198   friend class NlpSimpleLocalModel;
00199 protected:
00201   SymMatrixHandle mH;
00202   IotrMaskHandle mXmask;
00203 public:
00205   NlpSimpleHessian( SymMatrix * H, IotrMask * aMask );
00207   SymMatrix & H() { return *mH; }
00208   virtual double lowerBoundEigenvalue();
00209   virtual void mult( double alpha, IotrVector & x,
00210                      double beta,  IotrVector & y );
00211   virtual void inspect();
00212   virtual void inspectAsMatlab();
00213 };
00214 
00215 typedef Handle<NlpSimpleLocalModel> NlpSimpleLocalModelHandle;
00216 typedef Handle<NlpSimpleValues>     NlpSimpleValuesHandle;
00217 typedef Handle<NlpSimpleGrads>      NlpSimpleGradsHandle;
00218 typedef Handle<NlpSimpleHessian>    NlpSimpleHessianHandle;
00219 
00220 #endif
00221 

Generated on Wed Aug 27 10:03:41 2003 for iotr by doxygen1.2.18