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 56 2007-02-03 17:51:56Z 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 private:
00094   smagHandle_t prob;
00095   double clockStart;
00096   double *negLambda;
00097   double isMin;
00098         double timelimit;
00099         int domviollimit;
00100         long int domviolations;
00101 
00102   /* Methods to block default compiler methods.
00103    * The compiler automatically generates the following three methods.
00104    *  Since the default compiler implementation is generally not what
00105    *  you want (for all but the most simple classes), we usually 
00106    *  put the declarations of these methods in the private section
00107    *  and never implement them. This prevents the compiler from
00108    *  implementing an incorrect "default" behavior without us
00109    *  knowing. (See Scott Meyers book, "Effective C++")
00110    */
00111         SMAG_NLP();
00112   SMAG_NLP(const SMAG_NLP&);
00113   SMAG_NLP& operator=(const SMAG_NLP&);
00114 };
00115 
00116 
00117 #endif /* if ! defined(__SMAGNLP_HPP__) */

Generated on Fri May 16 00:28:04 2008 for GAMSlinks by  doxygen 1.4.7