SmagNLP.hpp

Go to the documentation of this file.
00001 // Copyright (C) GAMS Development 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: SmagNLP.hpp 510 2008-08-16 19:31:27Z stefan $
00006 //
00007 // Authors:  Steve Dirkse, Stefan Vigerske
00008 
00009 #ifndef __SMAGNLP_HPP__
00010 #define __SMAGNLP_HPP__
00011 
00012 #include "GAMSlinksConfig.h"
00013 
00014 #include "IpTNLP.hpp"
00015 
00016 // smag.h will try to include stdio.h and stdarg.h
00017 // so we include cstdio and cstdarg before if we know that we have them
00018 #ifdef HAVE_CSTDIO
00019 #include <cstdio>
00020 #endif
00021 #ifdef HAVE_CSTDARG
00022 #include <cstdarg>
00023 #endif
00024 #include "smag.h"
00025 
00026 using namespace Ipopt;
00027 
00030 class SMAG_NLP : public TNLP {
00031 public:
00035   SMAG_NLP (smagHandle_t prob);
00036 
00038   virtual ~SMAG_NLP();
00039 
00041   virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00042                             Index& nnz_h_lag, IndexStyleEnum& index_style);
00043 
00045   virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00046                                Index m, Number* g_l, Number* g_u);
00047 
00049   virtual bool get_starting_point(Index n, bool init_x, Number* x,
00050                                   bool init_z, Number* z_L, Number* z_U,
00051                                   Index m, bool init_lambda,
00052                                   Number* lambda);
00053 
00054   virtual bool get_scaling_parameters(Number &obj_scaling,
00055                 bool &use_x_scaling, Index n, Number *x_scaling,
00056                 bool &use_g_scaling, Index m, Number *g_scaling);
00057 
00059   virtual bool get_variables_linearity(Index n, LinearityType* var_types);
00060 
00062   virtual bool get_constraints_linearity(Index m, LinearityType* const_types);
00063 
00065   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00066 
00068   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00069 
00071   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00072 
00077   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00078                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00079                           Number* values);
00080 
00085   virtual bool eval_h(Index n, const Number* x, bool new_x,
00086                       Number obj_factor, Index m, const Number* lambda,
00087                       bool new_lambda, Index nele_hess, Index* iRow,
00088                       Index* jCol, Number* values);
00089 
00093         virtual bool intermediate_callback (AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq);
00094 
00097   virtual void finalize_solution(SolverReturn status,
00098                     Index n, const Number* x, const Number* z_L,
00099                     const Number* z_U,
00100                     Index m, const Number* g, const Number* lambda,
00101                     Number obj_value,
00102                     const IpoptData* data, IpoptCalculatedQuantities* cq);
00103 
00104         double div_iter_tol;
00105         double scaled_conviol_tol;
00106         double unscaled_conviol_tol;
00107         
00108 //      IpoptApplication* ipopt_app;
00109         
00110 private:
00111   smagHandle_t prob;
00112   double clockStart;
00113   double *negLambda;
00114   double isMin;
00115         double timelimit;
00116         int domviollimit;
00117         long int domviolations;
00118 
00119   /* Methods to block default compiler methods.
00120    * The compiler automatically generates the following three methods.
00121    *  Since the default compiler implementation is generally not what
00122    *  you want (for all but the most simple classes), we usually 
00123    *  put the declarations of these methods in the private section
00124    *  and never implement them. This prevents the compiler from
00125    *  implementing an incorrect "default" behavior without us
00126    *  knowing. (See Scott Meyers book, "Effective C++")
00127    */
00128         SMAG_NLP();
00129   SMAG_NLP(const SMAG_NLP&);
00130   SMAG_NLP& operator=(const SMAG_NLP&);
00131 };
00132 
00133 
00134 #endif /* ifndef __SMAGNLP_HPP__ */

Generated on Tue Dec 30 03:01:24 2008 for GAMSlinks by  doxygen 1.4.7