Debian Codegraph @

Bonmin/src/Interfaces/BonCurvatureEstimator.hpp

raw
1 // Copyright (C) 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id$
6 //
7 // Author: Andreas Waechter IBM 2006-10-11
8
9 #ifndef __BONCURVATUREESTIMATOR_HPP__
10 #define __BONCURVATUREESTIMATOR_HPP__
11 #error "Not supported currently"
12 #include "IpTNLP.hpp"
13 #include "IpOptionsList.hpp"
14 #include "IpCompoundSymMatrix.hpp"
15 #include "IpCompoundVector.hpp"
16 #include <vector>
17
18 namespace Ipopt {
19 //forward declarations
20 class TSymLinearSolver;
21 }
22
23 namespace Bonmin
24 {
25 using namespace Ipopt;
26
27 /**
28 */
29 class CurvatureEstimator: public ReferencedObject
30 {
31 public:
32 /** @name Constructor/Destructor */
33 //@{
34 /** Constructor. It is given the options list to extract options
35 * specifying linear solver options. */
36 CurvatureEstimator(
37 SmartPtr<Journalist> jnlst,
38 SmartPtr<OptionsList> options,
39 SmartPtr<TNLP> tnlp);
40
41 /** Destructor */
42 virtual ~CurvatureEstimator();
43 //@}
44
45 /** Method for computing a direction projected_d related to the
46 given direction orig_d and the two-sided product of
47 projected_d with Hessian of Lagrangian. The arrays x, y_c,
48 and y_d constain the primal and dual variables definiting the
49 Lagrangian Hessian. The vectors active_d and active_x contain
50 the indices of active inequality and bound constraints,
51 respectively. A positive index number is interpreted to
52 belong to an upper bound, and a negative number to a lower
53 bound. The return status is false if the computation was not
54 possible, and true otherwise. */
55
56 bool ComputeNullSpaceCurvature(
57 int n,
58 const Number* x,
59 bool new_x,
60 const Number* x_l,
61 const Number* x_u,
62 const Number* g_l,
63 const Number* g_u,
64 bool new_bounds,
65 const Number* z_L,
66 const Number* z_U,
67 int m,
68 const Number* lam,
69 bool new_mults,
70 const Number* orig_d,
71 Number* projected_d,
72 Number& gradLagTd,
73 Number& dTHLagd);
74
75 private:
76 /**@name Default Compiler Generated Methods
77 * (Hidden to avoid implicit creation/calling).
78 * These methods are not implemented and
79 * we do not want the compiler to implement
80 * them for us, so we declare them private
81 * and do not define them. This ensures that
82 * they will not be implicitly created/called. */
83 //@{
84 /** Default Constructor */
85 CurvatureEstimator();
86
87 /** Copy Constructor */
88 CurvatureEstimator(const CurvatureEstimator&);
89
90 /** Overloaded Equals Operator */
91 void operator=(const CurvatureEstimator&);
92 //@}
93
94 /** @name Items related to handling the linear solver object */
95 //@{
96 SmartPtr<Journalist> jnlst_;
97 SmartPtr<OptionsList> options_;
98 /** prefix to be used when parsion the options for the linear
99 * solver */
100 std::string prefix_;
101 /** Strategy object for solving the projection matrix for
102 equality constraints only */
103 SmartPtr<TSymLinearSolver> eq_tsymlinearsolver_;
104 /** Strategy object for solving the projection matrix for
105 all active constraints */
106 SmartPtr<TSymLinearSolver> all_tsymlinearsolver_;
107 //@}
108
109 /** @name Information about the tnlp */
110 //@{
111 SmartPtr<TNLP> tnlp_;
112 Index n_;
113 Number* grad_f_;
114 Index m_;
115 Index nnz_jac_;
116 Index* irows_jac_;
117 Index* jcols_jac_;
118 Number* jac_vals_;
119 Index nnz_hess_;
120 Index* irows_hess_;
121 Index* jcols_hess_;
122 Number* hess_vals_;
123 //@}
124
125 /** @name Information about activities for equality projection
126 only */
127 //@{
128 /** Number of free x variables */
129 Index eq_nx_free_;
130 /** Map for pointing from the original x space to the one without
131 * fixed variables. */
132 Index* eq_x_free_map_;
133 /** Number of active constraints */
134 Index eq_ng_fixed_;
135 /** Map for pointing from the original constraint space to the one
136 * with only active constraints */
137 Index* eq_g_fixed_map_;
138 //@}
139
140 /** @name Information about activities for projection
141 with respect to all active constraints */
142 //@{
143 /** Number of free x variables */
144 Index all_nx_free_;
145 /** Map for pointing from the original x space to the one without
146 * fixed variables. */
147 Index* all_x_free_map_;
148 /** Number of active constraints */
149 Index all_ng_fixed_;
150 /** Map for pointing from the original constraint space to the one
151 * with only active constraints */
152 Index* all_g_fixed_map_;
153 //@}
154
155 /** Space for most recent computed least-square multipliers */
156 Number* lambda_;
157
158 /** Space for storing the direction projected into the equality
159 * constraints only. Having this array around all the time means
160 * that we don't have to be so careful about memory leaks. */
161 Number* eq_projected_d_;
162
163 /** @name Items for handling the projection system for equality
164 * constraints only */
165 //@{
166 /** Compound Matrix space for storing the linear system for the
167 * projection */
168 SmartPtr<CompoundSymMatrixSpace> eq_comp_proj_matrix_space_;
169 /** Compound Matrix storing the current projection matrix */
170 SmartPtr<CompoundSymMatrix> eq_comp_proj_matrix_;
171 /** Compound Vector space for storing right hand side and solution
172 * for the projection system */
173 SmartPtr<CompoundVectorSpace> eq_comp_vec_space_;
174 //@}
175
176 /** @name Items for handling the projection system for all
177 * constraints */
178 //@{
179 /** Compound Matrix space for storing the linear system for the
180 * projection */
181 SmartPtr<CompoundSymMatrixSpace> all_comp_proj_matrix_space_;
182 /** Compound Matrix storing the current projection matrix */
183 SmartPtr<CompoundSymMatrix> all_comp_proj_matrix_;
184 /** Compound Vector space for storing right hand side and solution
185 * for the projection system */
186 SmartPtr<CompoundVectorSpace> all_comp_vec_space_;
187 //@}
188
189 /** Storing the activities */
190 //@{
191 std::vector<int> active_x_;
192 std::vector<int> active_g_;
193 //@}
194
195 bool initialized_;
196
197 bool Initialize();
198
199 bool PrepareNewMatrixStructure(
200 const Number* x_l,
201 const Number* x_u,
202 const Number* g_l,
203 const Number* g_u,
204 std::vector<int>& active_x,
205 std::vector<int>& active_g,
206 Index& nx_free,
207 Index* x_free_map,
208 Index& ng_fixed,
209 Index* g_fixed_map,
210 SmartPtr<CompoundSymMatrixSpace>& comp_proj_matrix_space,
211 SmartPtr<CompoundVectorSpace>& comp_vec_space);
212
213 bool PrepareNewMatrixValues(
214 const Index* x_free_map,
215 const Index* g_fixed_map,
216 SmartPtr<CompoundSymMatrixSpace>& comp_proj_matrix_space,
217 SmartPtr<CompoundSymMatrix>& comp_proj_matrix,
218 SmartPtr<TSymLinearSolver>& tsymlinearsolver);
219
220 bool SolveSystem(
221 const Number* rhs_x,
222 const Number* rhs_g,
223 Number* sol_x, Number* sol_g,
224 const Index* x_free_map,
225 const Index* g_fixed_map,
226 SmartPtr<CompoundVectorSpace>& comp_vec_space,
227 SmartPtr<CompoundSymMatrix>& comp_proj_matrix,
228 SmartPtr<TSymLinearSolver>& tsymlinearsolver);
229
230 bool Compute_dTHLagd(
231 const Number* d, const Number* x, bool new_x, const Number* lambda,
232 bool new_lambda, Number& dTHLagd);
233 };
234
235 } // namespace Ipopt
236 #endif