/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/src/Algorithm/IpIpoptCalculatedQuantities.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2007 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpIpoptCalculatedQuantities.hpp 1063 2007-08-06 18:55:25Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPIPOPTCALCULATEDQUANTITIES_HPP__
00010 #define __IPIPOPTCALCULATEDQUANTITIES_HPP__
00011 
00012 #include "IpIpoptNLP.hpp"
00013 #include "IpIpoptData.hpp"
00014 
00015 namespace Ipopt
00016 {
00017 
00019   enum ENormType {
00020     NORM_1=0,
00021     NORM_2,
00022     NORM_MAX
00023   };
00024 
00025   // forward definition
00026   class CGPenaltyCq;
00027 
00031   class IpoptCalculatedQuantities : public ReferencedObject
00032   {
00033   public:
00034 
00038     IpoptCalculatedQuantities(const SmartPtr<IpoptNLP>& ip_nlp,
00039                               const SmartPtr<IpoptData>& ip_data);
00041     virtual ~IpoptCalculatedQuantities();
00043 
00047     bool Initialize(const Journalist& jnlst,
00048                     const OptionsList& options,
00049                     const std::string& prefix);
00050 
00054     SmartPtr<const Vector> curr_slack_x_L();
00056     SmartPtr<const Vector> curr_slack_x_U();
00058     SmartPtr<const Vector> curr_slack_s_L();
00060     SmartPtr<const Vector> curr_slack_s_U();
00062     SmartPtr<const Vector> trial_slack_x_L();
00064     SmartPtr<const Vector> trial_slack_x_U();
00066     SmartPtr<const Vector> trial_slack_s_L();
00068     SmartPtr<const Vector> trial_slack_s_U();
00070     Index AdjustedTrialSlacks();
00072     void ResetAdjustedTrialSlacks();
00074 
00078     Number curr_f();
00080     Number unscaled_curr_f();
00082     Number trial_f();
00084     Number unscaled_trial_f();
00086     SmartPtr<const Vector> curr_grad_f();
00088     SmartPtr<const Vector> trial_grad_f();
00090 
00096     Number curr_barrier_obj();
00100     Number trial_barrier_obj();
00101 
00104     SmartPtr<const Vector> curr_grad_barrier_obj_x();
00107     SmartPtr<const Vector> curr_grad_barrier_obj_s();
00108 
00111     SmartPtr<const Vector> grad_kappa_times_damping_x();
00114     SmartPtr<const Vector> grad_kappa_times_damping_s();
00116 
00120     SmartPtr<const Vector> curr_c();
00122     SmartPtr<const Vector> unscaled_curr_c();
00124     SmartPtr<const Vector> trial_c();
00126     SmartPtr<const Vector> curr_d();
00128     SmartPtr<const Vector> unscaled_curr_d();
00130     SmartPtr<const Vector> trial_d();
00132     SmartPtr<const Vector> curr_d_minus_s();
00134     SmartPtr<const Vector> trial_d_minus_s();
00136     SmartPtr<const Matrix> curr_jac_c();
00138     SmartPtr<const Matrix> trial_jac_c();
00140     SmartPtr<const Matrix> curr_jac_d();
00142     SmartPtr<const Matrix> trial_jac_d();
00145     SmartPtr<const Vector> curr_jac_cT_times_vec(const Vector& vec);
00148     SmartPtr<const Vector> trial_jac_cT_times_vec(const Vector& vec);
00151     SmartPtr<const Vector> curr_jac_dT_times_vec(const Vector& vec);
00154     SmartPtr<const Vector> trial_jac_dT_times_vec(const Vector& vec);
00157     SmartPtr<const Vector> curr_jac_cT_times_curr_y_c();
00160     SmartPtr<const Vector> trial_jac_cT_times_trial_y_c();
00163     SmartPtr<const Vector> curr_jac_dT_times_curr_y_d();
00166     SmartPtr<const Vector> trial_jac_dT_times_trial_y_d();
00169     SmartPtr<const Vector> curr_jac_c_times_vec(const Vector& vec);
00172     SmartPtr<const Vector> curr_jac_d_times_vec(const Vector& vec);
00176     Number curr_constraint_violation();
00180     Number trial_constraint_violation();
00184     Number curr_nlp_constraint_violation(ENormType NormType);
00188     Number unscaled_curr_nlp_constraint_violation(ENormType NormType);
00190 
00194     SmartPtr<const SymMatrix> curr_exact_hessian();
00196 
00200     SmartPtr<const Vector> curr_grad_lag_x();
00202     SmartPtr<const Vector> trial_grad_lag_x();
00204     SmartPtr<const Vector> curr_grad_lag_s();
00206     SmartPtr<const Vector> trial_grad_lag_s();
00209     SmartPtr<const Vector> curr_grad_lag_with_damping_x();
00212     SmartPtr<const Vector> curr_grad_lag_with_damping_s();
00214     SmartPtr<const Vector> curr_compl_x_L();
00216     SmartPtr<const Vector> curr_compl_x_U();
00218     SmartPtr<const Vector> curr_compl_s_L();
00220     SmartPtr<const Vector> curr_compl_s_U();
00222     SmartPtr<const Vector> trial_compl_x_L();
00224     SmartPtr<const Vector> trial_compl_x_U();
00226     SmartPtr<const Vector> trial_compl_s_L();
00228     SmartPtr<const Vector> trial_compl_s_U();
00230     SmartPtr<const Vector> curr_relaxed_compl_x_L();
00232     SmartPtr<const Vector> curr_relaxed_compl_x_U();
00234     SmartPtr<const Vector> curr_relaxed_compl_s_L();
00236     SmartPtr<const Vector> curr_relaxed_compl_s_U();
00237 
00239     Number curr_primal_infeasibility(ENormType NormType);
00241     Number trial_primal_infeasibility(ENormType NormType);
00242 
00244     Number curr_dual_infeasibility(ENormType NormType);
00246     Number trial_dual_infeasibility(ENormType NormType);
00248     Number unscaled_curr_dual_infeasibility(ENormType NormType);
00249 
00252     Number curr_complementarity(Number mu, ENormType NormType);
00255     Number trial_complementarity(Number mu, ENormType NormType);
00258     Number unscaled_curr_complementarity(Number mu, ENormType NormType);
00259 
00261     Number CalcCentralityMeasure(const Vector& compl_x_L,
00262                                  const Vector& compl_x_U,
00263                                  const Vector& compl_s_L,
00264                                  const Vector& compl_s_U);
00266     Number curr_centrality_measure();
00267 
00272     Number curr_nlp_error();
00277     Number unscaled_curr_nlp_error();
00278 
00281     Number curr_barrier_error();
00282 
00289     Number curr_primal_dual_system_error(Number mu);
00296     Number trial_primal_dual_system_error(Number mu);
00298 
00303     Number primal_frac_to_the_bound(Number tau,
00304                                     const Vector& delta_x,
00305                                     const Vector& delta_s);
00308     Number curr_primal_frac_to_the_bound(Number tau);
00311     Number dual_frac_to_the_bound(Number tau,
00312                                   const Vector& delta_z_L,
00313                                   const Vector& delta_z_U,
00314                                   const Vector& delta_v_L,
00315                                   const Vector& delta_v_U);
00318     Number uncached_dual_frac_to_the_bound(Number tau,
00319                                            const Vector& delta_z_L,
00320                                            const Vector& delta_z_U,
00321                                            const Vector& delta_v_L,
00322                                            const Vector& delta_v_U);
00325     Number curr_dual_frac_to_the_bound(Number tau);
00333     Number uncached_slack_frac_to_the_bound(Number tau,
00334                                             const Vector& delta_x_L,
00335                                             const Vector& delta_x_U,
00336                                             const Vector& delta_s_L,
00337                                             const Vector& delta_s_U);
00339 
00342     SmartPtr<const Vector> curr_sigma_x();
00343     SmartPtr<const Vector> curr_sigma_s();
00345 
00347     Number curr_avrg_compl();
00349     Number trial_avrg_compl();
00350 
00353     Number curr_gradBarrTDelta();
00354 
00356     Number
00357     CalcNormOfType(ENormType NormType,
00358                    std::vector<SmartPtr<const Vector> > vecs);
00359 
00361     Number
00362     CalcNormOfType(ENormType NormType,
00363                    const Vector& vec1, const Vector& vec2);
00364 
00366     ENormType constr_viol_normtype() const
00367     {
00368       return constr_viol_normtype_;
00369     }
00370 
00372     bool IsSquareProblem() const;
00373 
00376     SmartPtr<IpoptNLP>& GetIpoptNLP()
00377     {
00378       return ip_nlp_;
00379     }
00380 
00381     CGPenaltyCq& CGPenCq()
00382     {
00383       return *cgpen_cq_;
00384     }
00385 
00389     static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
00391 
00392   private:
00402     IpoptCalculatedQuantities();
00403 
00405     IpoptCalculatedQuantities(const IpoptCalculatedQuantities&);
00406 
00408     void operator=(const IpoptCalculatedQuantities&);
00410 
00414     SmartPtr<IpoptNLP> ip_nlp_;
00416     SmartPtr<IpoptData> ip_data_;
00418     CGPenaltyCq* cgpen_cq_;
00420 
00427     Number s_max_;
00430     Number kappa_d_;
00432     Number slack_move_;
00434     ENormType constr_viol_normtype_;
00437     bool warm_start_same_structure_;
00439 
00442     CachedResults< SmartPtr<Vector> > curr_slack_x_L_cache_;
00443     CachedResults< SmartPtr<Vector> > curr_slack_x_U_cache_;
00444     CachedResults< SmartPtr<Vector> > curr_slack_s_L_cache_;
00445     CachedResults< SmartPtr<Vector> > curr_slack_s_U_cache_;
00446     CachedResults< SmartPtr<Vector> > trial_slack_x_L_cache_;
00447     CachedResults< SmartPtr<Vector> > trial_slack_x_U_cache_;
00448     CachedResults< SmartPtr<Vector> > trial_slack_s_L_cache_;
00449     CachedResults< SmartPtr<Vector> > trial_slack_s_U_cache_;
00450     Index num_adjusted_slack_x_L_;
00451     Index num_adjusted_slack_x_U_;
00452     Index num_adjusted_slack_s_L_;
00453     Index num_adjusted_slack_s_U_;
00455 
00458     CachedResults<Number> curr_f_cache_;
00459     CachedResults<Number> trial_f_cache_;
00460     CachedResults< SmartPtr<const Vector> > curr_grad_f_cache_;
00461     CachedResults< SmartPtr<const Vector> > trial_grad_f_cache_;
00463 
00466     CachedResults<Number> curr_barrier_obj_cache_;
00467     CachedResults<Number> trial_barrier_obj_cache_;
00468     CachedResults< SmartPtr<const Vector> > curr_grad_barrier_obj_x_cache_;
00469     CachedResults< SmartPtr<const Vector> > curr_grad_barrier_obj_s_cache_;
00470     CachedResults< SmartPtr<const Vector> > grad_kappa_times_damping_x_cache_;
00471     CachedResults< SmartPtr<const Vector> > grad_kappa_times_damping_s_cache_;
00473 
00476     CachedResults< SmartPtr<const Vector> > curr_c_cache_;
00477     CachedResults< SmartPtr<const Vector> > trial_c_cache_;
00478     CachedResults< SmartPtr<const Vector> > curr_d_cache_;
00479     CachedResults< SmartPtr<const Vector> > trial_d_cache_;
00480     CachedResults< SmartPtr<const Vector> > curr_d_minus_s_cache_;
00481     CachedResults< SmartPtr<const Vector> > trial_d_minus_s_cache_;
00482     CachedResults< SmartPtr<const Matrix> > curr_jac_c_cache_;
00483     CachedResults< SmartPtr<const Matrix> > trial_jac_c_cache_;
00484     CachedResults< SmartPtr<const Matrix> > curr_jac_d_cache_;
00485     CachedResults< SmartPtr<const Matrix> > trial_jac_d_cache_;
00486     CachedResults< SmartPtr<const Vector> > curr_jac_cT_times_vec_cache_;
00487     CachedResults< SmartPtr<const Vector> > trial_jac_cT_times_vec_cache_;
00488     CachedResults< SmartPtr<const Vector> > curr_jac_dT_times_vec_cache_;
00489     CachedResults< SmartPtr<const Vector> > trial_jac_dT_times_vec_cache_;
00490     CachedResults< SmartPtr<const Vector> > curr_jac_c_times_vec_cache_;
00491     CachedResults< SmartPtr<const Vector> > curr_jac_d_times_vec_cache_;
00492     CachedResults<Number> curr_constraint_violation_cache_;
00493     CachedResults<Number> trial_constraint_violation_cache_;
00494     CachedResults<Number> curr_nlp_constraint_violation_cache_;
00495     CachedResults<Number> unscaled_curr_nlp_constraint_violation_cache_;
00497 
00499     CachedResults< SmartPtr<const SymMatrix> > curr_exact_hessian_cache_;
00500 
00503     CachedResults< SmartPtr<const Vector> > curr_grad_lag_x_cache_;
00504     CachedResults< SmartPtr<const Vector> > trial_grad_lag_x_cache_;
00505     CachedResults< SmartPtr<const Vector> > curr_grad_lag_s_cache_;
00506     CachedResults< SmartPtr<const Vector> > trial_grad_lag_s_cache_;
00507     CachedResults< SmartPtr<const Vector> > curr_grad_lag_with_damping_x_cache_;
00508     CachedResults< SmartPtr<const Vector> > curr_grad_lag_with_damping_s_cache_;
00509     CachedResults< SmartPtr<const Vector> > curr_compl_x_L_cache_;
00510     CachedResults< SmartPtr<const Vector> > curr_compl_x_U_cache_;
00511     CachedResults< SmartPtr<const Vector> > curr_compl_s_L_cache_;
00512     CachedResults< SmartPtr<const Vector> > curr_compl_s_U_cache_;
00513     CachedResults< SmartPtr<const Vector> > trial_compl_x_L_cache_;
00514     CachedResults< SmartPtr<const Vector> > trial_compl_x_U_cache_;
00515     CachedResults< SmartPtr<const Vector> > trial_compl_s_L_cache_;
00516     CachedResults< SmartPtr<const Vector> > trial_compl_s_U_cache_;
00517     CachedResults< SmartPtr<const Vector> > curr_relaxed_compl_x_L_cache_;
00518     CachedResults< SmartPtr<const Vector> > curr_relaxed_compl_x_U_cache_;
00519     CachedResults< SmartPtr<const Vector> > curr_relaxed_compl_s_L_cache_;
00520     CachedResults< SmartPtr<const Vector> > curr_relaxed_compl_s_U_cache_;
00521     CachedResults<Number> curr_primal_infeasibility_cache_;
00522     CachedResults<Number> trial_primal_infeasibility_cache_;
00523     CachedResults<Number> curr_dual_infeasibility_cache_;
00524     CachedResults<Number> trial_dual_infeasibility_cache_;
00525     CachedResults<Number> unscaled_curr_dual_infeasibility_cache_;
00526     CachedResults<Number> curr_complementarity_cache_;
00527     CachedResults<Number> trial_complementarity_cache_;
00528     CachedResults<Number> curr_centrality_measure_cache_;
00529     CachedResults<Number> curr_nlp_error_cache_;
00530     CachedResults<Number> unscaled_curr_nlp_error_cache_;
00531     CachedResults<Number> curr_barrier_error_cache_;
00532     CachedResults<Number> curr_primal_dual_system_error_cache_;
00533     CachedResults<Number> trial_primal_dual_system_error_cache_;
00535 
00538     CachedResults<Number> primal_frac_to_the_bound_cache_;
00539     CachedResults<Number> dual_frac_to_the_bound_cache_;
00541 
00544     CachedResults< SmartPtr<const Vector> > curr_sigma_x_cache_;
00545     CachedResults< SmartPtr<const Vector> > curr_sigma_s_cache_;
00547 
00549     CachedResults<Number> curr_avrg_compl_cache_;
00551     CachedResults<Number> trial_avrg_compl_cache_;
00552 
00554     CachedResults<Number> curr_gradBarrTDelta_cache_;
00555 
00561     SmartPtr<Vector> dampind_x_L_;
00564     SmartPtr<Vector> dampind_x_U_;
00567     SmartPtr<Vector> dampind_s_L_;
00570     SmartPtr<Vector> dampind_s_U_;
00572 
00577     SmartPtr<Vector> tmp_x_;
00578     SmartPtr<Vector> tmp_s_;
00579     SmartPtr<Vector> tmp_c_;
00580     SmartPtr<Vector> tmp_d_;
00581     SmartPtr<Vector> tmp_x_L_;
00582     SmartPtr<Vector> tmp_x_U_;
00583     SmartPtr<Vector> tmp_s_L_;
00584     SmartPtr<Vector> tmp_s_U_;
00585 
00587     Vector& Tmp_x();
00588     Vector& Tmp_s();
00589     Vector& Tmp_c();
00590     Vector& Tmp_d();
00591     Vector& Tmp_x_L();
00592     Vector& Tmp_x_U();
00593     Vector& Tmp_s_L();
00594     Vector& Tmp_s_U();
00596 
00599     bool initialize_called_;
00600 
00606     SmartPtr<Vector> CalcSlack_L(const Matrix& P,
00607                                  const Vector& x,
00608                                  const Vector& x_bound);
00612     SmartPtr<Vector> CalcSlack_U(const Matrix& P,
00613                                  const Vector& x,
00614                                  const Vector& x_bound);
00618     Number CalcBarrierTerm(Number mu,
00619                            const Vector& slack_x_L,
00620                            const Vector& slack_x_U,
00621                            const Vector& slack_s_L,
00622                            const Vector& slack_s_U);
00623 
00625     SmartPtr<const Vector> CalcCompl(const Vector& slack,
00626                                      const Vector& mult);
00627 
00629     Number CalcFracToBound(const Vector& slack_L,
00630                            Vector& tmp_L,
00631                            const Matrix& P_L,
00632                            const Vector& slack_U,
00633                            Vector& tmp_U,
00634                            const Matrix& P_U,
00635                            const Vector& delta,
00636                            Number tau);
00637 
00639     void ComputeOptimalityErrorScaling(const Vector& y_c, const Vector& y_d,
00640                                        const Vector& z_L, const Vector& z_U,
00641                                        const Vector& v_L, const Vector& v_U,
00642                                        Number s_max,
00643                                        Number& s_d, Number& s_c);
00644 
00648     Index CalculateSafeSlack(SmartPtr<Vector>& slack,
00649                              const SmartPtr<const Vector>& bound,
00650                              const SmartPtr<const Vector>& curr_point,
00651                              const SmartPtr<const Vector>& multiplier);
00652 
00658     void ComputeDampingIndicators(SmartPtr<const Vector>& dampind_x_L,
00659                                   SmartPtr<const Vector>& dampind_x_U,
00660                                   SmartPtr<const Vector>& dampind_s_L,
00661                                   SmartPtr<const Vector>& dampind_s_U);
00662 
00669     bool in_restoration_phase();
00670 
00672   };
00673 
00674 } // namespace Ipopt
00675 
00676 #endif

Generated on Sun Nov 14 14:06:34 2010 for Coin-All by  doxygen 1.4.7