/home/coin/SVN-release/OS-1.0.0/OS/src/OSSolverInterfaces/IpoptSolver.h

Go to the documentation of this file.
00001 
00016 #ifndef IPOPTSOLVER_H 
00017 #define IPOPTSOLVER_H
00018 
00019 #include "OSConfig.h" 
00020 #include "DefaultSolver.h"
00021 #include "OSrLWriter.h"
00022 #include "OSInstance.h"
00023 #include "OSParameters.h"
00024 #include "OSnLNode.h"
00025 #include "OSiLReader.h"
00026 #include "OSInstance.h"
00027 #include "OSExpressionTree.h"
00028 #include "OSnLNode.h"
00029 #include "OSDataStructures.h"
00030 #include "FileUtil.h"  
00031 #include "ErrorClass.h"
00032 
00033 # include <cstddef>
00034 # include <cstdlib>
00035 # include <cctype>
00036 # include <cassert>
00037 # include <stack>
00038 #include <string>
00039 # include <cppad/cppad.hpp>
00040 #include<iostream>
00041 
00042 #ifdef HAVE_CTIME
00043 # include <ctime>
00044 #else
00045 # ifdef HAVE_TIME_H
00046 #  include <time.h>
00047 # else
00048 #  error "don't have header file for time"
00049 # endif
00050 #endif 
00051 
00052  
00053 #ifdef HAVE_CMATH
00054 # include <cmath>
00055 #else
00056 # ifdef HAVE_MATH_H
00057 #  include <math.h>
00058 # else
00059 #  error "don't have header file for math"
00060 # endif
00061 #endif
00062 #include<vector>
00063 #include <map>  
00064 
00065 #ifdef COIN_HAS_ASL
00066 #include "IpTNLP.hpp"
00067 #else
00068 #include "IpTNLP.hpp"
00069 #undef COIN_HAS_ASL
00070 #endif
00071 
00072 
00073 using namespace Ipopt;
00074 
00075 
00088 class IpoptSolver : public DefaultSolver, public TNLP{  
00089         
00090 public:
00091 
00093         IpoptSolver();
00094         
00096         ~IpoptSolver();
00097         
00100         virtual void  solve() throw (ErrorClass) ;
00101         
00107         void dataEchoCheck();
00108 
00110         virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00111                             Index& nnz_h_lag, IndexStyleEnum& index_style);
00112 
00114         virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00115                                                                 Index m, Number* g_l, Number* g_u);
00116 
00118         virtual bool get_starting_point(Index n, bool init_x, Number* x,
00119                                                                         bool init_z, Number* z_L, Number* z_U,
00120                                                                         Index m, bool init_lambda,
00121                                                                         Number* lambda);
00122 
00124         virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00125 
00127         virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00128 
00130         virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00131 
00136         virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00137                                                         Index m, Index nele_jac, Index* iRow, Index *jCol,
00138                                                         Number* values);
00139 
00144         virtual bool eval_h(Index n, const Number* x, bool new_x,
00145                                                 Number obj_factor, Index m, const Number* lambda,
00146                                                 bool new_lambda, Index nele_hess, Index* iRow,
00147                                                 Index* jCol, Number* values);
00148 
00150         
00151         
00152         virtual bool get_scaling_parameters(Number& obj_scaling,
00153                                     bool& use_x_scaling, Index n,
00154                                     Number* x_scaling,
00155                                     bool& use_g_scaling, Index m,
00156                                     Number* g_scaling);
00157 
00161         virtual void finalize_solution(SolverReturn status,
00162                                                                         Index n, const Number* x, const Number* z_L, const Number* z_U,
00163                                                                         Index m, const Number* g, const Number* lambda,
00164                                                                         Number obj_value,
00165                                    const IpoptData* ip_data,
00166                                    IpoptCalculatedQuantities* ip_cq);
00168 
00169 private:
00170         OSrLWriter  *osrlwriter;
00171 
00183         //  IpoptSolver();
00184         IpoptSolver(const IpoptSolver&);
00185         IpoptSolver& operator=(const IpoptSolver&);
00187         std::string ipoptErrorMsg;
00188 };
00189 
00190 #endif /*IPOPTSOLVER_H*/

Generated on Thu May 15 22:15:05 2008 by  doxygen 1.4.7