- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/OS-2.3.5/OS/src/OSSolverInterfaces/OSKnitroSolver.h

Go to the documentation of this file.

    00001 /* $Id: OSKnitroSolver.h 4120 2011-03-30 06:28:16Z kmartin $ */
    00017 #ifndef KNITROSOLVER_H
    00018 #define KNITROSOLVER_H
    00019
    00020 #include "OSConfig.h"
    00021
    00022
    00023
    00024 #ifndef NLPPROBLEMDEF_H__
    00025 #include  "nlpProblemDef.h"
    00026 #endif
    00027
    00028 #include "OSConfig.h"
    00029 #include "OSDefaultSolver.h"
    00030 #include "OSrLWriter.h"
    00031 #include "OSiLWriter.h"
    00032 #include "OSInstance.h"
    00033 #include "OSParameters.h"
    00034 #include "OSnLNode.h"
    00035 #include "OSiLReader.h"
    00036 #include "OSInstance.h"
    00037 #include "OSExpressionTree.h"
    00038 #include "OSnLNode.h"
    00039 #include "OSDataStructures.h"
    00040 #include "OSFileUtil.h"
    00041 #include "OSErrorClass.h"
    00042
    00043 #ifndef KNITRO_H__
    00044 #include  "knitro.h"
    00045 #endif
    00046
    00047 # include <cstddef>
    00048 # include <cstdlib>
    00049 # include <cctype>
    00050 # include <cassert>
    00051 # include <stack>
    00052 #include <string>
    00053 # include <cppad/cppad.hpp>
    00054 #include<iostream>
    00055
    00056
    00057
    00058
    00059 #ifdef HAVE_CTIME
    00060 # include <ctime>
    00061 #else
    00062 # ifdef HAVE_TIME_H
    00063 #  include <time.h>
    00064 # else
    00065 #  error "don't have header file for time"
    00066 # endif
    00067 #endif
    00068
    00069
    00070 #ifdef HAVE_CMATH
    00071 # include <cmath>
    00072 #else
    00073 # ifdef HAVE_MATH_H
    00074 #  include <math.h>
    00075 # else
    00076 #  error "don't have header file for math"
    00077 # endif
    00078 #endif
    00079
    00080
    00081
    00082 //#include<vector>
    00083 //#include <map>
    00084
    00085
    00086
    00087 class KnitroProblem : public NlpProblemDef {
    00088 public:
    00089
    00091         KnitroProblem(OSInstance *osinstance_ , OSResult *osresult_);
    00092
    00094         virtual ~KnitroProblem();
    00095
    00096         OSResult *osresult;
    00097
    00098         OSInstance *osinstance;
    00099
    00100         //Knitro specific methods
    00101         //++ Declare virtual base class methods that are implemented here.
    00102     //++ See NlpProblemDef.h for descriptions.
    00103     int   getN (void);
    00104     int   getM (void);
    00105     void  getInitialX (double * const  daX);
    00106     bool  loadProblemIntoKnitro (KTR_context_ptr  kc);
    00107     bool  areDerivativesImplemented
    00108               (const DerivativesImplementedType  nWhichDers);
    00109
    00110     int  evalFC (const double * const  daX,
    00111                        double * const  dObj,
    00112                        double * const  daC,
    00113                        void   *        userParams);
    00114     int  evalGA (const double * const  daX,
    00115                        double * const  daG,
    00116                        double * const  daJ,
    00117                        void   *        userParams);
    00118     int  evalH (const double * const  daX,
    00119                 const double * const  daLambda,
    00120                       double * const  daH,
    00121                       void   *        userParams);
    00122     int  evalHV (const double * const  daX,
    00123                  const double * const  daLambda,
    00124                        double * const  daHV,
    00125                        void   *        userParams);
    00126
    00127         std::string knitroErrorMsg;
    00128 };
    00129
    00130
    00143 class KnitroSolver : public DefaultSolver {
    00144
    00145 public:
    00146
    00148         KnitroSolver();
    00149
    00151         ~KnitroSolver();
    00152
    00157         virtual void  buildSolverInstance() throw(ErrorClass);
    00158
    00163         virtual void  setSolverOptions() throw(ErrorClass);
    00164
    00167         virtual void  solve() throw (ErrorClass) ;
    00168
    00174         void dataEchoCheck();
    00175
    00176 private:
    00177
    00178         OSrLWriter  *osrlwriter;
    00179
    00191         //  KnitroSolver();
    00192         KnitroSolver(const KnitroSolver&);
    00193         KnitroSolver& operator=(const KnitroSolver&);
    00195         std::string knitroErrorMsg;
    00196
    00197 };
    00198
    00199
    00200 #endif