/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/src/Interfaces/IpTNLP.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2006 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpTNLP.hpp 1001 2007-06-18 20:36:53Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPTNLP_HPP__
00010 #define __IPTNLP_HPP__
00011 
00012 #include "IpUtils.hpp"
00013 #include "IpReferenced.hpp"
00014 #include "IpException.hpp"
00015 #include "IpAlgTypes.hpp"
00016 #include "IpReturnCodes.hpp"
00017 
00018 namespace Ipopt
00019 {
00020   // forward declarations
00021   class IpoptData;
00022   class IpoptCalculatedQuantities;
00023   class IteratesVector;
00024 
00048   class TNLP : public ReferencedObject
00049   {
00050   public:
00052     enum LinearityType
00053     {
00054       LINEAR,
00055       NON_LINEAR
00056     };
00057 
00060     TNLP()
00061     {}
00062 
00064     virtual ~TNLP()
00065     {}
00067 
00068     DECLARE_STD_EXCEPTION(INVALID_TNLP);
00069 
00078     enum IndexStyleEnum { C_STYLE=0, FORTRAN_STYLE=1 };
00079     virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00080                               Index& nnz_h_lag, IndexStyleEnum& index_style)=0;
00081 
00088     virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00089                                  Index m, Number* g_l, Number* g_u)=0;
00090 
00098     virtual bool get_scaling_parameters(Number& obj_scaling,
00099                                         bool& use_x_scaling, Index n,
00100                                         Number* x_scaling,
00101                                         bool& use_g_scaling, Index m,
00102                                         Number* g_scaling)
00103     {
00104       return false;
00105     }
00106 
00111     virtual bool get_variables_linearity(Index n, LinearityType* var_types)
00112     {
00113       return false;
00114     }
00115 
00119     virtual bool get_constraints_linearity(Index m, LinearityType* const_types)
00120     {
00121       return false;
00122     }
00123 
00131     virtual bool get_starting_point(Index n, bool init_x, Number* x,
00132                                     bool init_z, Number* z_L, Number* z_U,
00133                                     Index m, bool init_lambda,
00134                                     Number* lambda)=0;
00135 
00140     virtual bool get_warm_start_iterate(IteratesVector& warm_start_iterate)
00141     {
00142       return false;
00143     }
00144 
00146     virtual bool eval_f(Index n, const Number* x, bool new_x,
00147                         Number& obj_value)=0;
00148 
00151     virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
00152                              Number* grad_f)=0;
00153 
00155     virtual bool eval_g(Index n, const Number* x, bool new_x,
00156                         Index m, Number* g)=0;
00162     virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00163                             Index m, Index nele_jac, Index* iRow,
00164                             Index *jCol, Number* values)=0;
00165 
00175     virtual bool eval_h(Index n, const Number* x, bool new_x,
00176                         Number obj_factor, Index m, const Number* lambda,
00177                         bool new_lambda, Index nele_hess,
00178                         Index* iRow, Index* jCol, Number* values)
00179     {
00180       return false;
00181     }
00182 
00187     virtual bool set_variable_values(Index n, const Number* x, bool new_x,
00188                                      Index m, const Number* lambda,
00189                                      bool new_lambda)
00190     {
00191       return false;
00192     }
00194 
00198     virtual void finalize_solution(SolverReturn status,
00199                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
00200                                    Index m, const Number* g, const Number* lambda,
00201                                    Number obj_value,
00202                                    const IpoptData* ip_data,
00203                                    IpoptCalculatedQuantities* ip_cq)=0;
00204 
00208     virtual bool intermediate_callback(AlgorithmMode mode,
00209                                        Index iter, Number obj_value,
00210                                        Number inf_pr, Number inf_du,
00211                                        Number mu, Number d_norm,
00212                                        Number regularization_size,
00213                                        Number alpha_du, Number alpha_pr,
00214                                        Index ls_trials,
00215                                        const IpoptData* ip_data,
00216                                        IpoptCalculatedQuantities* ip_cq)
00217     {
00218       return true;
00219     }
00221 
00235     virtual Index get_number_of_nonlinear_variables()
00236     {
00237       return -1;
00238     }
00239 
00240     virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars,
00241         Index* pos_nonlin_vars)
00242     {
00243       return false;
00244     }
00246 
00247   private:
00257     //TNLP();
00258 
00260     TNLP(const TNLP&);
00261 
00263     void operator=(const TNLP&);
00265   };
00266 
00267 } // namespace Ipopt
00268 
00269 #endif

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