1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
// Copyright (C) 2004, 2006 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// Authors: Andreas Waechter IBM 2004-11-12
#ifndef __IPQUALITYFUNCTIONMUORACLE_HPP__
#define __IPQUALITYFUNCTIONMUORACLE_HPP__
#include "IpMuOracle.hpp"
#include "IpPDSystemSolver.hpp"
#include "IpIpoptCalculatedQuantities.hpp"
namespace Ipopt
{
/** Implementation of the probing strategy for computing the
* barrier parameter.
*/
class QualityFunctionMuOracle: public MuOracle
{
public:
/**@name Constructors/Destructors */
///@{
/** Constructor */
QualityFunctionMuOracle(
const SmartPtr<PDSystemSolver>& pd_solver
);
/** Destructor */
virtual ~QualityFunctionMuOracle();
///@}
virtual bool InitializeImpl(
const OptionsList& options,
const std::string& prefix
);
/** Method for computing the value of the barrier parameter that
* could be used in the current iteration (using the LOQO formula).
*/
virtual bool CalculateMu(
Number mu_min,
Number mu_max,
Number& new_mu
);
static void RegisterOptions(
SmartPtr<RegisteredOptions> roptions
);
/** @name Public enums.
* Some of those are also used for the quality function.
*/
///@{
/** enum for norm type */
enum NormEnum
{
NM_NORM_1 = 0,
NM_NORM_2_SQUARED,
NM_NORM_MAX,
NM_NORM_2
};
/** enum for centrality type */
enum CentralityEnum
{
CEN_NONE = 0,
CEN_LOG,
CEN_RECIPROCAL,
CEN_CUBED_RECIPROCAL
};
/** enum for the quality function balancing term type */
enum BalancingTermEnum
{
BT_NONE = 0,
BT_CUBIC
};
///@}
private:
/**@name Default Compiler Generated Methods
* (Hidden to avoid implicit creation/calling).
*
* These methods are not implemented and
* we do not want the compiler to implement
* them for us, so we declare them private
* and do not define them. This ensures that
* they will not be implicitly created/called.
*/
///@{
/** Default Constructor */
QualityFunctionMuOracle();
/** Copy Constructor */
QualityFunctionMuOracle(
const QualityFunctionMuOracle&
);
/** Default Assignment Operator */
void operator=(
const QualityFunctionMuOracle&
);
///@}
/** Pointer to the object that should be used to solve the
* primal-dual system.
*/
SmartPtr<PDSystemSolver> pd_solver_;
/** Auxiliary function for computing the average complementarity
* at a point, given step sizes and step.
*/
Number CalculateQualityFunction(
Number sigma,
const Vector& step_aff_x_L,
const Vector& step_aff_x_U,
const Vector& step_aff_s_L,
const Vector& step_aff_s_U,
const Vector& step_aff_y_c,
const Vector& step_aff_y_d,
const Vector& step_aff_z_L,
const Vector& step_aff_z_U,
const Vector& step_aff_v_L,
const Vector& step_aff_v_U,
const Vector& step_cen_x_L,
const Vector& step_cen_x_U,
const Vector& step_cen_s_L,
const Vector& step_cen_s_U,
const Vector& step_cen_y_c,
const Vector& step_cen_y_d,
const Vector& step_cen_z_L,
const Vector& step_cen_z_U,
const Vector& step_cen_v_L,
const Vector& step_cen_v_U
);
/** Auxiliary function performing the golden section */
Number PerformGoldenSection(
Number sigma_up,
Number q_up,
Number sigma_lo,
Number q_lo,
Number sigma_tol,
Number qf_tol,
const Vector& step_aff_x_L,
const Vector& step_aff_x_U,
const Vector& step_aff_s_L,
const Vector& step_aff_s_U,
const Vector& step_aff_y_c,
const Vector& step_aff_y_d,
const Vector& step_aff_z_L,
const Vector& step_aff_z_U,
const Vector& step_aff_v_L,
const Vector& step_aff_v_U,
const Vector& step_cen_x_L,
const Vector& step_cen_x_U,
const Vector& step_cen_s_L,
const Vector& step_cen_s_U,
const Vector& step_cen_y_c,
const Vector& step_cen_y_d,
const Vector& step_cen_z_L,
const Vector& step_cen_z_U,
const Vector& step_cen_v_L,
const Vector& step_cen_v_U
);
/** Auxiliary functions for scaling the sigma axis in the golden
* section procedure
*/
///@{
Number ScaleSigma(
Number sigma
);
Number UnscaleSigma(
Number scaled_sigma
);
///@}
/** Auxiliary function performing the golden section in the
* logarithmic scale
*/
/* This doesn't seem to work well, so I took it out for now (AW)
Number PerformGoldenSectionLog(Number sigma_up,
Number sigma_lo,
Number tol,
const Vector& step_aff_x_L,
const Vector& step_aff_x_U,
const Vector& step_aff_s_L,
const Vector& step_aff_s_U,
const Vector& step_aff_y_c,
const Vector& step_aff_y_d,
const Vector& step_aff_z_L,
const Vector& step_aff_z_U,
const Vector& step_aff_v_L,
const Vector& step_aff_v_U,
const Vector& step_cen_x_L,
const Vector& step_cen_x_U,
const Vector& step_cen_s_L,
const Vector& step_cen_s_U,
const Vector& step_cen_y_c,
const Vector& step_cen_y_d,
const Vector& step_cen_z_L,
const Vector& step_cen_z_U,
const Vector& step_cen_v_L,
const Vector& step_cen_v_U);
*/
/** @name Algorithmic parameters */
///@{
/** Upper bound on centering parameter sigma */
Number sigma_max_;
/** Lower bound on centering parameter sigma */
Number sigma_min_;
/** Norm to be used for the quality function. */
NormEnum quality_function_norm_;
/** Flag indicating how centrality should be involved in the
* quality function
*/
CentralityEnum quality_function_centrality_;
/** Flag indicating whether we use a balancing term in the quality
* function.
*/
BalancingTermEnum quality_function_balancing_term_;
/** Relative tolerance for golden bi-section algorithm in sigma
* space.
*/
Number quality_function_section_sigma_tol_;
/** Relative tolerance for golden bi-section algorithm in function
* value space.
*/
Number quality_function_section_qf_tol_;
/** Maximal number of bi-section steps in the golden section
* search for sigma.
*/
Index quality_function_max_section_steps_;
///@}
/** @name Temporary work space vectors.
*
* We use those to avoid repeated reallocation in CalculateQualityFunction.
*/
///@{
SmartPtr<Vector> tmp_step_x_L_;
SmartPtr<Vector> tmp_step_x_U_;
SmartPtr<Vector> tmp_step_s_L_;
SmartPtr<Vector> tmp_step_s_U_;
SmartPtr<Vector> tmp_step_z_L_;
SmartPtr<Vector> tmp_step_z_U_;
SmartPtr<Vector> tmp_step_v_L_;
SmartPtr<Vector> tmp_step_v_U_;
SmartPtr<Vector> tmp_slack_x_L_;
SmartPtr<Vector> tmp_slack_x_U_;
SmartPtr<Vector> tmp_slack_s_L_;
SmartPtr<Vector> tmp_slack_s_U_;
SmartPtr<Vector> tmp_z_L_;
SmartPtr<Vector> tmp_z_U_;
SmartPtr<Vector> tmp_v_L_;
SmartPtr<Vector> tmp_v_U_;
///@}
/* Counter for the qualify function evaluations */
Index count_qf_evals_;
/**@name Quantities used many times in CalculateQualityFunction,
* which we store here instead of retrieving them from cache every time.
*
* I (AW) don't know if that really makes a difference, but
* some of those things showed up in gprof.
*/
///@{
bool initialized_;
Index n_dual_;
Index n_pri_;
Index n_comp_;
SmartPtr<const Vector> curr_slack_x_L_;
SmartPtr<const Vector> curr_slack_x_U_;
SmartPtr<const Vector> curr_slack_s_L_;
SmartPtr<const Vector> curr_slack_s_U_;
SmartPtr<const Vector> curr_z_L_;
SmartPtr<const Vector> curr_z_U_;
SmartPtr<const Vector> curr_v_L_;
SmartPtr<const Vector> curr_v_U_;
Number curr_grad_lag_x_asum_;
Number curr_grad_lag_s_asum_;
Number curr_c_asum_;
Number curr_d_minus_s_asum_;
Number curr_grad_lag_x_nrm2_;
Number curr_grad_lag_s_nrm2_;
Number curr_c_nrm2_;
Number curr_d_minus_s_nrm2_;
Number curr_grad_lag_x_amax_;
Number curr_grad_lag_s_amax_;
Number curr_c_amax_;
Number curr_d_minus_s_amax_;
///@}
};
} // namespace Ipopt
#endif