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 67 2007-02-16 19:10:17Z stefan $
00006 //
00007 // Authors:  Steve Dirkse, Stefan Vigerske
00008 
00009 #if ! defined(__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 
00055   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00056 
00058   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00059 
00061   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00062 
00067   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00068                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00069                           Number* values);
00070 
00075   virtual bool eval_h(Index n, const Number* x, bool new_x,
00076                       Number obj_factor, Index m, const Number* lambda,
00077                       bool new_lambda, Index nele_hess, Index* iRow,
00078                       Index* jCol, Number* values);
00079 
00083         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);
00084 
00087   virtual void finalize_solution(SolverReturn status,
00088                     Index n, const Number* x, const Number* z_L,
00089                     const Number* z_U,
00090                     Index m, const Number* g, const Number* lambda,
00091                     Number obj_value);
00092 
00093         double div_iter_tol;
00094         double scaled_conviol_tol;
00095         double unscaled_conviol_tol;
00096 private:
00097   smagHandle_t prob;
00098   double clockStart;
00099   double *negLambda;
00100   double isMin;
00101         double timelimit;
00102         int domviollimit;
00103         long int domviolations;
00104 
00105   int last_iterationnumber;
00106   double last_scaled_conviol; // last scaled constraint violation
00107         double last_unscaled_conviol; // last unscaled constraint violation
00108 
00109   /* Methods to block default compiler methods.
00110    * The compiler automatically generates the following three methods.
00111    *  Since the default compiler implementation is generally not what
00112    *  you want (for all but the most simple classes), we usually 
00113    *  put the declarations of these methods in the private section
00114    *  and never implement them. This prevents the compiler from
00115    *  implementing an incorrect "default" behavior without us
00116    *  knowing. (See Scott Meyers book, "Effective C++")
00117    */
00118         SMAG_NLP();
00119   SMAG_NLP(const SMAG_NLP&);
00120   SMAG_NLP& operator=(const SMAG_NLP&);
00121 };
00122 
00123 
00124 #endif /* if ! defined(__SMAGNLP_HPP__) */

Generated on Fri May 16 19:23:21 2008 for GAMSlinks by  doxygen 1.4.7