Ipopt
trunk
|
00001 // Copyright (C) 2004, 2006 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // $Id$ 00006 // 00007 // Authors: Andreas Waechter IBM 2004-11-12 00008 00009 #ifndef __IPQUALITYFUNCTIONMUORACLE_HPP__ 00010 #define __IPQUALITYFUNCTIONMUORACLE_HPP__ 00011 00012 #include "IpMuOracle.hpp" 00013 #include "IpPDSystemSolver.hpp" 00014 #include "IpIpoptCalculatedQuantities.hpp" 00015 00016 namespace Ipopt 00017 { 00018 00022 class QualityFunctionMuOracle : public MuOracle 00023 { 00024 public: 00028 QualityFunctionMuOracle(const SmartPtr<PDSystemSolver>& pd_solver); 00030 virtual ~QualityFunctionMuOracle(); 00032 00034 virtual bool InitializeImpl(const OptionsList& options, 00035 const std::string& prefix); 00036 00040 virtual bool CalculateMu(Number mu_min, Number mu_max, Number& new_mu); 00041 00044 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00046 00051 enum NormEnum 00052 { 00053 NM_NORM_1=0, 00054 NM_NORM_2_SQUARED, 00055 NM_NORM_MAX, 00056 NM_NORM_2 00057 }; 00059 enum CentralityEnum 00060 { 00061 CEN_NONE=0, 00062 CEN_LOG, 00063 CEN_RECIPROCAL, 00064 CEN_CUBED_RECIPROCAL 00065 }; 00067 enum BalancingTermEnum 00068 { 00069 BT_NONE=0, 00070 BT_CUBIC 00071 }; 00073 00074 private: 00083 00085 QualityFunctionMuOracle(); 00087 QualityFunctionMuOracle(const QualityFunctionMuOracle&); 00088 00090 void operator=(const QualityFunctionMuOracle&); 00092 00096 SmartPtr<PDSystemSolver> pd_solver_; 00097 00101 // ToDo Replace pointers by references 00102 Number CalculateQualityFunction(Number sigma, 00103 const Vector& step_aff_x_L, 00104 const Vector& step_aff_x_U, 00105 const Vector& step_aff_s_L, 00106 const Vector& step_aff_s_U, 00107 const Vector& step_aff_y_c, 00108 const Vector& step_aff_y_d, 00109 const Vector& step_aff_z_L, 00110 const Vector& step_aff_z_U, 00111 const Vector& step_aff_v_L, 00112 const Vector& step_aff_v_U, 00113 const Vector& step_cen_x_L, 00114 const Vector& step_cen_x_U, 00115 const Vector& step_cen_s_L, 00116 const Vector& step_cen_s_U, 00117 const Vector& step_cen_y_c, 00118 const Vector& step_cen_y_d, 00119 const Vector& step_cen_z_L, 00120 const Vector& step_cen_z_U, 00121 const Vector& step_cen_v_L, 00122 const Vector& step_cen_v_U); 00123 00125 Number PerformGoldenSection(Number sigma_up, 00126 Number q_up, 00127 Number sigma_lo, 00128 Number q_lo, 00129 Number sigma_tol, 00130 Number qf_tol, 00131 const Vector& step_aff_x_L, 00132 const Vector& step_aff_x_U, 00133 const Vector& step_aff_s_L, 00134 const Vector& step_aff_s_U, 00135 const Vector& step_aff_y_c, 00136 const Vector& step_aff_y_d, 00137 const Vector& step_aff_z_L, 00138 const Vector& step_aff_z_U, 00139 const Vector& step_aff_v_L, 00140 const Vector& step_aff_v_U, 00141 const Vector& step_cen_x_L, 00142 const Vector& step_cen_x_U, 00143 const Vector& step_cen_s_L, 00144 const Vector& step_cen_s_U, 00145 const Vector& step_cen_y_c, 00146 const Vector& step_cen_y_d, 00147 const Vector& step_cen_z_L, 00148 const Vector& step_cen_z_U, 00149 const Vector& step_cen_v_L, 00150 const Vector& step_cen_v_U); 00151 00155 Number ScaleSigma(Number sigma); 00156 Number UnscaleSigma(Number scaled_sigma); 00158 00161 /* This doesn't seem to work well, so I took it out for now (AW) 00162 Number PerformGoldenSectionLog(Number sigma_up, 00163 Number sigma_lo, 00164 Number tol, 00165 const Vector& step_aff_x_L, 00166 const Vector& step_aff_x_U, 00167 const Vector& step_aff_s_L, 00168 const Vector& step_aff_s_U, 00169 const Vector& step_aff_y_c, 00170 const Vector& step_aff_y_d, 00171 const Vector& step_aff_z_L, 00172 const Vector& step_aff_z_U, 00173 const Vector& step_aff_v_L, 00174 const Vector& step_aff_v_U, 00175 const Vector& step_cen_x_L, 00176 const Vector& step_cen_x_U, 00177 const Vector& step_cen_s_L, 00178 const Vector& step_cen_s_U, 00179 const Vector& step_cen_y_c, 00180 const Vector& step_cen_y_d, 00181 const Vector& step_cen_z_L, 00182 const Vector& step_cen_z_U, 00183 const Vector& step_cen_v_L, 00184 const Vector& step_cen_v_U); 00185 */ 00186 00190 Number sigma_max_; 00192 Number sigma_min_; 00194 NormEnum quality_function_norm_; 00197 CentralityEnum quality_function_centrality_; 00201 BalancingTermEnum quality_function_balancing_term_; 00204 Number quality_function_section_sigma_tol_; 00207 Number quality_function_section_qf_tol_; 00210 Index quality_function_max_section_steps_; 00212 00216 SmartPtr<Vector> tmp_step_x_L_; 00217 SmartPtr<Vector> tmp_step_x_U_; 00218 SmartPtr<Vector> tmp_step_s_L_; 00219 SmartPtr<Vector> tmp_step_s_U_; 00220 SmartPtr<Vector> tmp_step_z_L_; 00221 SmartPtr<Vector> tmp_step_z_U_; 00222 SmartPtr<Vector> tmp_step_v_L_; 00223 SmartPtr<Vector> tmp_step_v_U_; 00224 00225 SmartPtr<Vector> tmp_slack_x_L_; 00226 SmartPtr<Vector> tmp_slack_x_U_; 00227 SmartPtr<Vector> tmp_slack_s_L_; 00228 SmartPtr<Vector> tmp_slack_s_U_; 00229 SmartPtr<Vector> tmp_z_L_; 00230 SmartPtr<Vector> tmp_z_U_; 00231 SmartPtr<Vector> tmp_v_L_; 00232 SmartPtr<Vector> tmp_v_U_; 00234 00235 /* Counter for the qualify function evaluations */ 00236 Index count_qf_evals_; 00237 00243 bool initialized_; 00244 Index n_dual_; 00245 Index n_pri_; 00246 Index n_comp_; 00247 00248 SmartPtr<const Vector> curr_slack_x_L_; 00249 SmartPtr<const Vector> curr_slack_x_U_; 00250 SmartPtr<const Vector> curr_slack_s_L_; 00251 SmartPtr<const Vector> curr_slack_s_U_; 00252 00253 SmartPtr<const Vector> curr_z_L_; 00254 SmartPtr<const Vector> curr_z_U_; 00255 SmartPtr<const Vector> curr_v_L_; 00256 SmartPtr<const Vector> curr_v_U_; 00257 00258 Number curr_grad_lag_x_asum_; 00259 Number curr_grad_lag_s_asum_; 00260 Number curr_c_asum_; 00261 Number curr_d_minus_s_asum_; 00262 00263 Number curr_grad_lag_x_nrm2_; 00264 Number curr_grad_lag_s_nrm2_; 00265 Number curr_c_nrm2_; 00266 Number curr_d_minus_s_nrm2_; 00267 00268 Number curr_grad_lag_x_amax_; 00269 Number curr_grad_lag_s_amax_; 00270 Number curr_c_amax_; 00271 Number curr_d_minus_s_amax_; 00273 }; 00274 00275 } // namespace Ipopt 00276 00277 #endif