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

AmplFunctional.hh

Go to the documentation of this file.
00001 #ifndef AMPLFUNCTIONAL
00002 #define AMPLFUNCTIONAL
00003 
00016 #include "Functional.hh"
00017 #include "IotrConfiguration.hh"
00018 
00019 #include<string>
00020 
00021 struct ASL;
00022 struct Option_Info;
00023 struct keyword;
00024 
00025 class ElementGatherSeq;
00026 
00027 #include "SimpleVector.hh"
00028 
00031 class AmplAdaptor : public IotrRefCount {
00032 protected:
00034   ASL * asl;
00036   Option_Info * oi;
00037   std::string mSname;
00038   std::string mBsname;
00039 
00040   SimpleVectorHandle mX;
00041   SimpleVectorHandle mYZ;
00042 
00043   IotrConfigurationHandle mCommandLineOptions;
00044 
00046 public:
00047 
00048   IotrVector & x() { return *mX; };
00049   IotrVector & yz() { return *mYZ; };
00050 
00051   ASL * itsAsl() { return asl; }
00052 
00053   char * processKeyword( keyword * kw, char value[] );
00055   AmplAdaptor( const char sname[], const char bsname[] );
00056   ~AmplAdaptor();
00058   virtual IotrConfiguration * initialize( char ** argv, int &ierr,
00059                                           keyword * kw, int nkw );
00062   virtual void writeSolution( char * msg, IotrVector * primal,
00063                               IotrVector * dual );
00065   void getBounds( IotrVector & rxlow,
00066                   IotrVector & rxupp,
00067                   IotrVector & rclow,
00068                   IotrVector & rcupp );
00069 
00070   void getInitialPrimal( IotrVector & primal ) const
00071   {
00072     primal.copyFrom( *mX );
00073   };
00074 
00075   void getInitialDual( IotrVector & dual ) {
00076     dual.copyFrom( *mYZ );
00077   };
00078 
00079 };
00080 
00081 typedef Handle<AmplAdaptor> AmplAdaptorHandle;
00082 
00087 class AmplFunctional : public ConcreteFunctional {
00088 protected:
00090   ASL * asl;
00093   AmplAdaptorHandle adaptor;
00094 public:
00095   AmplFunctional( AmplAdaptor * adaptor );
00096   //specialize ConcreteFunctional::concreteValues
00097   virtual void concreteValues( double & obj, IotrVector & c,
00098                                IotrVector & x);
00099   //specialize ConcreteFunctional::concreteGrads
00100   virtual void concreteGrads( IotrVector & g, GenMatrix & J,
00101                               IotrVector & x ) = 0;
00102   //specializes ConcreteFunctional::concreteHess
00103   virtual void concreteHess( SymMatrix & H,
00104                              IotrVector & x, IotrVector & Lm) = 0;
00105 
00106   virtual IotrVector * newPrimalVector() const;
00107   virtual IotrVector * newDualVector() const;
00108   virtual GenMatrix  * newJacobianMatrix() const = 0;
00109   virtual SymMatrix  * newHessianMatrix() const = 0;
00110 
00111   virtual PrimalDualSystem *
00112   newPrimalDualSystem( ElementGather * iclow, ElementGather * icupp,
00113                        ElementGather * ieq,
00114                        ElementGather * ixlow, ElementGather * ixupp,
00115                        IotrMask * aXmask ) = 0;
00116 
00117   virtual void writeConfiguration( std::ostream & out, char indent[] ) = 0;
00118 };
00119 
00120 typedef Handle<AmplFunctional> AmplFunctionalHandle;
00121 
00122 char * ampladaptor_process_keyword( Option_Info * oi,
00123                                        keyword * kw, char value[] );
00124 
00129 #endif

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