GAMSlinks  0.4
SmagNLP.hpp
Go to the documentation of this file.
1 // Copyright (C) GAMS Development 2007
2 // All Rights Reserved.
3 // This code is published under the Common Public License.
4 //
5 // $Id: SmagNLP.hpp 510 2008-08-16 19:31:27Z stefan $
6 //
7 // Authors: Steve Dirkse, Stefan Vigerske
8 
9 #ifndef __SMAGNLP_HPP__
10 #define __SMAGNLP_HPP__
11 
12 #include "GAMSlinksConfig.h"
13 
14 #include "IpTNLP.hpp"
15 
16 // smag.h will try to include stdio.h and stdarg.h
17 // so we include cstdio and cstdarg before if we know that we have them
18 #ifdef HAVE_CSTDIO
19 #include <cstdio>
20 #endif
21 #ifdef HAVE_CSTDARG
22 #include <cstdarg>
23 #endif
24 #include "smag.h"
25 
26 using namespace Ipopt;
27 
30 class SMAG_NLP : public TNLP {
31 public:
35  SMAG_NLP (smagHandle_t prob);
36 
38  virtual ~SMAG_NLP();
39 
41  virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
42  Index& nnz_h_lag, IndexStyleEnum& index_style);
43 
45  virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
46  Index m, Number* g_l, Number* g_u);
47 
49  virtual bool get_starting_point(Index n, bool init_x, Number* x,
50  bool init_z, Number* z_L, Number* z_U,
51  Index m, bool init_lambda,
52  Number* lambda);
53 
54  virtual bool get_scaling_parameters(Number &obj_scaling,
55  bool &use_x_scaling, Index n, Number *x_scaling,
56  bool &use_g_scaling, Index m, Number *g_scaling);
57 
59  virtual bool get_variables_linearity(Index n, LinearityType* var_types);
60 
62  virtual bool get_constraints_linearity(Index m, LinearityType* const_types);
63 
65  virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
66 
68  virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
69 
71  virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
72 
77  virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
78  Index m, Index nele_jac, Index* iRow, Index *jCol,
79  Number* values);
80 
85  virtual bool eval_h(Index n, const Number* x, bool new_x,
86  Number obj_factor, Index m, const Number* lambda,
87  bool new_lambda, Index nele_hess, Index* iRow,
88  Index* jCol, Number* values);
89 
93  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);
94 
97  virtual void finalize_solution(SolverReturn status,
98  Index n, const Number* x, const Number* z_L,
99  const Number* z_U,
100  Index m, const Number* g, const Number* lambda,
101  Number obj_value,
102  const IpoptData* data, IpoptCalculatedQuantities* cq);
103 
104  double div_iter_tol;
107 
108 // IpoptApplication* ipopt_app;
109 
110 private:
111  smagHandle_t prob;
112  double clockStart;
113  double *negLambda;
114  double isMin;
115  double timelimit;
117  long int domviolations;
118 
119  /* Methods to block default compiler methods.
120  * The compiler automatically generates the following three methods.
121  * Since the default compiler implementation is generally not what
122  * you want (for all but the most simple classes), we usually
123  * put the declarations of these methods in the private section
124  * and never implement them. This prevents the compiler from
125  * implementing an incorrect "default" behavior without us
126  * knowing. (See Scott Meyers book, "Effective C++")
127  */
128  SMAG_NLP();
129  SMAG_NLP(const SMAG_NLP&);
130  SMAG_NLP& operator=(const SMAG_NLP&);
131 };
132 
133 
134 #endif /* ifndef __SMAGNLP_HPP__ */
double unscaled_conviol_tol
Definition: SmagNLP.hpp:106
double div_iter_tol
Definition: SmagNLP.hpp:104
long int domviolations
Definition: SmagNLP.hpp:117
int domviollimit
Definition: SmagNLP.hpp:116
double clockStart
Definition: SmagNLP.hpp:112
double * negLambda
Definition: SmagNLP.hpp:113
double scaled_conviol_tol
Definition: SmagNLP.hpp:105
A TNLP for Ipopt that uses SMAG to interface the problem formulation.
Definition: SmagNLP.hpp:30
double timelimit
Definition: SmagNLP.hpp:115
smagHandle_t prob
Definition: SmagNLP.hpp:111
double isMin
Definition: SmagNLP.hpp:114