/build/buildd/coinor-ipopt-3.10.1/Ipopt/src/Interfaces/IpTNLPReducer.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Eclipse Public License.
00004 //
00005 // $Id: IpTNLPReducer.hpp 1861 2010-12-21 21:34:47Z andreasw $
00006 //
00007 // Authors:  Andreas Waechter                  IBM    2008-08-10
00008 
00009 #ifndef __IPTNLPREDUCER_HPP__
00010 #define __IPTNLPREDUCER_HPP__
00011 
00012 #include "IpTNLP.hpp"
00013 
00014 namespace Ipopt
00015 {
00023   class TNLPReducer : public TNLP
00024   {
00025   public:
00031     TNLPReducer(TNLP& tnlp, Index n_g_skip, const Index* index_g_skip,
00032                 Index n_xL_skip, const Index* index_xL_skip,
00033                 Index n_xU_skip, const Index* index_xU_skip,
00034                 Index n_x_fix, const Index* index_f_fix);
00035 
00037     virtual ~TNLPReducer();
00039 
00041     virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00042                               Index& nnz_h_lag, IndexStyleEnum& index_style);
00043 
00044     virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00045                                  Index m, Number* g_l, Number* g_u);
00046 
00047     virtual bool get_scaling_parameters(Number& obj_scaling,
00048                                         bool& use_x_scaling, Index n,
00049                                         Number* x_scaling,
00050                                         bool& use_g_scaling, Index m,
00051                                         Number* g_scaling);
00052 
00053     virtual bool get_variables_linearity(Index n, LinearityType* var_types);
00054 
00055     virtual bool get_constraints_linearity(Index m, LinearityType* const_types);
00056 
00057     virtual bool get_starting_point(Index n, bool init_x, Number* x,
00058                                     bool init_z, Number* z_L, Number* z_U,
00059                                     Index m, bool init_lambda,
00060                                     Number* lambda);
00061 
00062     virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate);
00063 
00064     virtual bool eval_f(Index n, const Number* x, bool new_x,
00065                         Number& obj_value);
00066 
00067     virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
00068                              Number* grad_f);
00069 
00070     virtual bool eval_g(Index n, const Number* x, bool new_x,
00071                         Index m, Number* g);
00072 
00073     virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00074                             Index m, Index nele_jac, Index* iRow,
00075                             Index *jCol, Number* values);
00076 
00077     virtual bool eval_h(Index n, const Number* x, bool new_x,
00078                         Number obj_factor, Index m, const Number* lambda,
00079                         bool new_lambda, Index nele_hess,
00080                         Index* iRow, Index* jCol, Number* values);
00081 
00082     virtual void finalize_solution(SolverReturn status,
00083                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
00084                                    Index m, const Number* g, const Number* lambda,
00085                                    Number obj_value,
00086                                    const IpoptData* ip_data,
00087                                    IpoptCalculatedQuantities* ip_cq);
00088 
00089     virtual bool intermediate_callback(AlgorithmMode mode,
00090                                        Index iter, Number obj_value,
00091                                        Number inf_pr, Number inf_du,
00092                                        Number mu, Number d_norm,
00093                                        Number regularization_size,
00094                                        Number alpha_du, Number alpha_pr,
00095                                        Index ls_trials,
00096                                        const IpoptData* ip_data,
00097                                        IpoptCalculatedQuantities* ip_cq);
00098 
00099     virtual Index get_number_of_nonlinear_variables();
00100 
00101     virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars,
00102         Index* pos_nonlin_vars);
00104 
00105   private:
00115     TNLPReducer();
00116 
00118     TNLPReducer(const TNLPReducer&);
00119 
00121     void operator=(const TNLPReducer&);
00123 
00126     SmartPtr<TNLP> tnlp_;
00127     Index m_orig_;
00128     Index nnz_jac_g_orig_;
00130 
00132     Index n_g_skip_;
00133 
00136     Index* index_g_skip_;
00137 
00140     IndexStyleEnum index_style_orig_;
00141 
00144     Index* g_keep_map_;
00145 
00147     Index m_reduced_;
00148 
00150     Index nnz_jac_g_reduced_;
00151 
00153     Index nnz_jac_g_skipped_;
00154 
00157     Index* jac_g_skipped_;
00158 
00160     Index n_xL_skip_;
00161 
00163     Index* index_xL_skip_;
00164 
00166     Index n_xU_skip_;
00167 
00169     Index* index_xU_skip_;
00170 
00172     Index n_x_fix_;
00173 
00175     Index* index_x_fix_;
00176   };
00177 
00178 } // namespace Ipopt
00179 
00180 #endif