Ipopt  3.11.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpStdInterfaceTNLP.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2010 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id: IpStdInterfaceTNLP.hpp 1861 2010-12-21 21:34:47Z andreasw $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPSTDINTERFACETNLP_HPP__
10 #define __IPSTDINTERFACETNLP_HPP__
11 
12 #include "IpUtils.hpp"
13 #include "IpTNLP.hpp"
14 #include "IpJournalist.hpp"
15 #include "IpException.hpp"
16 #include "IpStdCInterface.h"
17 #include "IpSmartPtr.hpp"
18 
19 namespace Ipopt
20 {
23  DECLARE_STD_EXCEPTION(INVALID_STDINTERFACE_NLP);
24 
30  class StdInterfaceTNLP : public TNLP
31  {
32  public:
39  StdInterfaceTNLP(Index n_var,
40  const Number* x_L, const Number* x_U,
41  Index n_con,
42  const Number* g_L, const Number* g_U,
46  const Number* start_x,
47  const Number* start_lam,
48  const Number* start_z_L,
49  const Number* start_z_U,
56  Number* x_sol,
57  Number* z_L_sol,
58  Number* z_U_sol,
59  Number* g_sol,
60  Number* lam_sol,
61  Number* obj_sol,
64  const Number* x_scaling = NULL,
65  const Number* g_scaling = NULL);
66 
68  virtual ~StdInterfaceTNLP();
70 
75  virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
76  Index& nnz_h_lag, IndexStyleEnum& index_style);
77 
79  virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
80  Index m, Number* g_l, Number* g_u);
81 
85  bool& use_x_scaling, Index n,
87  bool& use_g_scaling, Index m,
88  Number* g_scaling);
89 
91  virtual bool get_starting_point(Index n, bool init_x, Number* x,
92  bool init_z, Number* z_L, Number* z_U,
93  Index m, bool init_lambda, Number* lambda);
94 
96  virtual bool eval_f(Index n, const Number* x, bool new_x,
97  Number& obj_value);
98 
101  virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
102  Number* grad_f);
103 
105  virtual bool eval_g(Index n, const Number* x, bool new_x, Index m,
106  Number* g);
107 
111  virtual bool eval_jac_g(Index n, const Number* x, bool new_x, Index m,
112  Index nele_jac, Index* iRow, Index *jCol,
113  Number* values);
114 
117  virtual bool eval_h(Index n, const Number* x, bool new_x,
118  Number obj_factor, Index m, const Number* lambda,
119  bool new_lambda, Index nele_hess, Index* iRow,
120  Index* jCol, Number* values);
121 
123  virtual bool intermediate_callback(AlgorithmMode mode,
124  Index iter, Number obj_value,
125  Number inf_pr, Number inf_du,
126  Number mu, Number d_norm,
127  Number regularization_size,
128  Number alpha_du, Number alpha_pr,
129  Index ls_trials,
130  const IpoptData* ip_data,
133 
136  virtual void finalize_solution(SolverReturn status,
137  Index n, const Number* x, const Number* z_L, const Number* z_U,
138  Index m, const Number* g, const Number* lambda,
139  Number obj_value,
140  const IpoptData* ip_data,
143 
144  private:
147 
151  const Index n_var_;
153  const Index n_con_;
155  const Number* x_L_;
157  const Number* x_U_;
159  const Number* g_L_;
161  const Number* g_U_;
169  const Number* start_x_;
201 
202 
205 
213 
216  void apply_new_x(bool new_x, Index n, const Number* x);
217 
228 
231 
233  void operator=(const StdInterfaceTNLP&);
235 
236  };
237 
238 } // namespace Ipopt
239 
240 #endif