- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/SVN-release/Ipopt-3.5.1/Ipopt/src/Interfaces/IpTNLP.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2004, 2008 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Common Public License.
    00004 //
    00005 // $Id: IpTNLP.hpp 1290 2008-08-25 15:48:22Z 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     }
    00183
    00187     virtual void finalize_solution(SolverReturn status,
    00188                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
    00189                                    Index m, const Number* g, const Number* lambda,
    00190                                    Number obj_value,
    00191                                    const IpoptData* ip_data,
    00192                                    IpoptCalculatedQuantities* ip_cq)=0;
    00193
    00197     virtual bool intermediate_callback(AlgorithmMode mode,
    00198                                        Index iter, Number obj_value,
    00199                                        Number inf_pr, Number inf_du,
    00200                                        Number mu, Number d_norm,
    00201                                        Number regularization_size,
    00202                                        Number alpha_du, Number alpha_pr,
    00203                                        Index ls_trials,
    00204                                        const IpoptData* ip_data,
    00205                                        IpoptCalculatedQuantities* ip_cq)
    00206     {
    00207       return true;
    00208     }
    00210
    00224     virtual Index get_number_of_nonlinear_variables()
    00225     {
    00226       return -1;
    00227     }
    00228
    00229     virtual bool get_list_of_nonlinear_variables(Index num_nonlin_vars,
    00230         Index* pos_nonlin_vars)
    00231     {
    00232       return false;
    00233     }
    00235
    00236   private:
    00246     //TNLP();
    00247
    00249     TNLP(const TNLP&);
    00250
    00252     void operator=(const TNLP&);
    00254   };
    00255
    00256 } // namespace Ipopt
    00257
    00258 #endif