NLPInterfacePack_ExampleNLPBanded.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef EXAMPLE_NLP_BANDED_H
00030 #define EXAMPLE_NLP_BANDED_H
00031 
00032 
00033 #include "NLPInterfacePack_NLPSerialPreprocessExplJac.hpp"
00034 
00035 
00036 namespace NLPInterfacePack {
00037 
00038 
00146 class ExampleNLPBanded
00147   : public NLPSerialPreprocessExplJac
00148 {
00149 public:
00150 
00153 
00158   ExampleNLPBanded(
00159     size_type     nD
00160     ,size_type    nI
00161     ,size_type    bw                = 1
00162     ,size_type    mU                = 0
00163     ,size_type    mI                = 0
00164     ,value_type   xo                = 0.1
00165     ,value_type   xDl               = -NLP::infinite_bound()
00166     ,value_type   xDu               = +NLP::infinite_bound()
00167     ,value_type   xIl               = -NLP::infinite_bound()
00168     ,value_type   xIu               = +NLP::infinite_bound()
00169     ,value_type   hl                = -NLP::infinite_bound()
00170     ,value_type   hu                = +NLP::infinite_bound()
00171     ,bool         nlp_selects_basis = false
00172     ,value_type   diag_scal         = 10.0
00173     ,value_type   diag_vary         = 1.0
00174     ,bool         sym_basis         = false
00175     ,value_type   f_offset          = 0.0
00176     ,value_type   co                = 0.0
00177     ,bool         ignore_constraints = false
00178     );
00179 
00181 
00182   // Todo: Add methods to manipulate bounds and co ...
00183 
00186   
00187   // ToDo: Add these ...
00188 
00190 
00193 
00195   void initialize(bool test_setup);
00197   bool is_initialized() const;
00199   value_type max_var_bounds_viol() const;
00200 
00202 
00205   
00207   bool nlp_selects_basis() const;
00208 
00210 
00211 protected:
00212 
00215 
00217   bool imp_nlp_has_changed() const;
00219   size_type imp_n_orig() const;
00221   size_type imp_m_orig() const;
00223   size_type imp_mI_orig() const;
00225   const DVectorSlice imp_xinit_orig() const;
00227   bool imp_has_var_bounds() const;
00229   const DVectorSlice imp_xl_orig() const;
00231   const DVectorSlice imp_xu_orig() const;
00233   const DVectorSlice imp_hl_orig() const;
00235   const DVectorSlice imp_hu_orig() const;
00237   void imp_calc_f_orig(
00238     const DVectorSlice            &x_full
00239     ,bool                        newx
00240     ,const ZeroOrderInfoSerial   &zero_order_info
00241     ) const;
00243   void imp_calc_c_orig(
00244     const DVectorSlice            &x_full
00245     ,bool                        newx
00246     ,const ZeroOrderInfoSerial   &zero_order_info
00247     ) const;
00249   void imp_calc_h_orig(
00250     const DVectorSlice            &x_full
00251     ,bool                        newx
00252     ,const ZeroOrderInfoSerial   &zero_order_info
00253     ) const;
00255   void imp_calc_Gf_orig(
00256     const DVectorSlice            &x_full
00257     ,bool                        newx
00258     ,const ObjGradInfoSerial     &obj_grad_info
00259     ) const;
00261   bool imp_get_next_basis(
00262     IVector      *var_perm_full
00263     ,IVector     *equ_perm_full
00264     ,size_type   *rank_full
00265     ,size_type   *rank
00266     );
00268   void imp_report_orig_final_solution(
00269     const DVectorSlice      &x_orig
00270     ,const DVectorSlice     *lambda_orig
00271     ,const DVectorSlice     *lambdaI_orig
00272     ,const DVectorSlice     *nu_orig
00273     ,bool                  is_optimal
00274     ) const;
00275 
00277   
00280 
00282   size_type imp_Gc_nz_orig() const;
00284   size_type imp_Gh_nz_orig() const;
00286   void imp_calc_Gc_orig(
00287     const DVectorSlice& x_full, bool newx
00288     , const FirstOrderExplInfo& first_order_expl_info
00289     ) const;
00291   void imp_calc_Gh_orig(
00292     const DVectorSlice& x_full, bool newx
00293     , const FirstOrderExplInfo& first_order_expl_info
00294     ) const;
00295 
00297 
00298 private:
00299 
00300   // /////////////////////////////////////////
00301   // Private types
00302 
00303   // /////////////////////////////////////////
00304   // Private data members
00305 
00306   bool         is_initialized_;
00307 
00308   bool         nlp_selects_basis_;
00309   bool         basis_selection_was_given_;
00310 
00311   bool         has_var_bounds_;
00312 
00313   value_type   f_offset_;
00314 
00315   size_type    nD_;
00316   size_type    nI_;
00317   size_type    bw_;
00318   size_type    mU_;
00319   size_type    mI_;
00320 
00321   bool         ignore_constraints_;
00322 
00323   size_type    Gc_orig_nz_;
00324   size_type    Gh_orig_nz_;
00325 
00326   DVector      xinit_orig_;
00327   DVector      xl_orig_;
00328   DVector      xu_orig_;
00329   DVector      hl_orig_;
00330   DVector      hu_orig_;
00331 
00332   DVector      co_orig_;
00333 
00334   mutable bool c_orig_updated_;
00335 
00336   value_type   diag_scal_;
00337   value_type   diag_vary_;
00338   value_type   fu_;
00339 
00340   // /////////////////////////////////////////
00341   // Private member functions
00342 
00344   void assert_is_initialized() const;
00345 
00347   void inform_new_point(bool newx) const;
00348 
00349   // Not defined and not to be called
00350   ExampleNLPBanded();
00351   ExampleNLPBanded(const ExampleNLPBanded&);
00352   ExampleNLPBanded& operator=(const ExampleNLPBanded&);
00353 
00354 
00355 };  // end class ExampleNLPBanded
00356 
00357 
00358 } // end namespace NLPInterfacePack
00359 
00360 
00361 #endif  // EXAMPLE_NLP_BANDED_H

Generated on Tue Jul 13 09:30:53 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7