00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __BONCURVATUREESTIMATOR_HPP__
00010 #define __BONCURVATUREESTIMATOR_HPP__
00011 #error "Not supported currently"
00012 #include "IpTNLP.hpp"
00013 #include "IpOptionsList.hpp"
00014 #include "IpCompoundSymMatrix.hpp"
00015 #include "IpCompoundVector.hpp"
00016 #include <vector>
00017
00018 namespace Ipopt {
00019
00020 class TSymLinearSolver;
00021 }
00022
00023 namespace Bonmin
00024 {
00025 using namespace Ipopt;
00026
00029 class CurvatureEstimator: public ReferencedObject
00030 {
00031 public:
00036 CurvatureEstimator(
00037 SmartPtr<Journalist> jnlst,
00038 SmartPtr<OptionsList> options,
00039 SmartPtr<TNLP> tnlp);
00040
00042 virtual ~CurvatureEstimator();
00044
00056 bool ComputeNullSpaceCurvature(
00057 int n,
00058 const Number* x,
00059 bool new_x,
00060 const Number* x_l,
00061 const Number* x_u,
00062 const Number* g_l,
00063 const Number* g_u,
00064 bool new_bounds,
00065 const Number* z_L,
00066 const Number* z_U,
00067 int m,
00068 const Number* lam,
00069 bool new_mults,
00070 const Number* orig_d,
00071 Number* projected_d,
00072 Number& gradLagTd,
00073 Number& dTHLagd);
00074
00075 private:
00085 CurvatureEstimator();
00086
00088 CurvatureEstimator(const CurvatureEstimator&);
00089
00091 void operator=(const CurvatureEstimator&);
00093
00096 SmartPtr<Journalist> jnlst_;
00097 SmartPtr<OptionsList> options_;
00100 std::string prefix_;
00103 SmartPtr<TSymLinearSolver> eq_tsymlinearsolver_;
00106 SmartPtr<TSymLinearSolver> all_tsymlinearsolver_;
00108
00111 SmartPtr<TNLP> tnlp_;
00112 Index n_;
00113 Number* grad_f_;
00114 Index m_;
00115 Index nnz_jac_;
00116 Index* irows_jac_;
00117 Index* jcols_jac_;
00118 Number* jac_vals_;
00119 Index nnz_hess_;
00120 Index* irows_hess_;
00121 Index* jcols_hess_;
00122 Number* hess_vals_;
00124
00129 Index eq_nx_free_;
00132 Index* eq_x_free_map_;
00134 Index eq_ng_fixed_;
00137 Index* eq_g_fixed_map_;
00139
00144 Index all_nx_free_;
00147 Index* all_x_free_map_;
00149 Index all_ng_fixed_;
00152 Index* all_g_fixed_map_;
00154
00156 Number* lambda_;
00157
00161 Number* eq_projected_d_;
00162
00168 SmartPtr<CompoundSymMatrixSpace> eq_comp_proj_matrix_space_;
00170 SmartPtr<CompoundSymMatrix> eq_comp_proj_matrix_;
00173 SmartPtr<CompoundVectorSpace> eq_comp_vec_space_;
00175
00181 SmartPtr<CompoundSymMatrixSpace> all_comp_proj_matrix_space_;
00183 SmartPtr<CompoundSymMatrix> all_comp_proj_matrix_;
00186 SmartPtr<CompoundVectorSpace> all_comp_vec_space_;
00188
00191 std::vector<int> active_x_;
00192 std::vector<int> active_g_;
00194
00195 bool initialized_;
00196
00197 bool Initialize();
00198
00199 bool PrepareNewMatrixStructure(
00200 const Number* x_l,
00201 const Number* x_u,
00202 const Number* g_l,
00203 const Number* g_u,
00204 std::vector<int>& active_x,
00205 std::vector<int>& active_g,
00206 Index& nx_free,
00207 Index* x_free_map,
00208 Index& ng_fixed,
00209 Index* g_fixed_map,
00210 SmartPtr<CompoundSymMatrixSpace>& comp_proj_matrix_space,
00211 SmartPtr<CompoundVectorSpace>& comp_vec_space);
00212
00213 bool PrepareNewMatrixValues(
00214 const Index* x_free_map,
00215 const Index* g_fixed_map,
00216 SmartPtr<CompoundSymMatrixSpace>& comp_proj_matrix_space,
00217 SmartPtr<CompoundSymMatrix>& comp_proj_matrix,
00218 SmartPtr<TSymLinearSolver>& tsymlinearsolver);
00219
00220 bool SolveSystem(
00221 const Number* rhs_x,
00222 const Number* rhs_g,
00223 Number* sol_x, Number* sol_g,
00224 const Index* x_free_map,
00225 const Index* g_fixed_map,
00226 SmartPtr<CompoundVectorSpace>& comp_vec_space,
00227 SmartPtr<CompoundSymMatrix>& comp_proj_matrix,
00228 SmartPtr<TSymLinearSolver>& tsymlinearsolver);
00229
00230 bool Compute_dTHLagd(
00231 const Number* d, const Number* x, bool new_x, const Number* lambda,
00232 bool new_lambda, Number& dTHLagd);
00233 };
00234
00235 }
00236 #endif