NLPInterfacePack_ExampleNLPBanded.hpp

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 #include "NLPInterfacePack_NLPSerialPreprocessExplJac.hpp"
00033 
00034 namespace NLPInterfacePack {
00035 
00143 class ExampleNLPBanded
00144   : public NLPSerialPreprocessExplJac
00145 {
00146 public:
00147 
00150 
00155   ExampleNLPBanded(
00156     size_type     nD
00157     ,size_type    nI
00158     ,size_type    bw                = 1
00159     ,size_type    mU                = 0
00160     ,size_type    mI                = 0
00161     ,value_type   xo                = 0.1
00162     ,value_type   xDl               = -NLP::infinite_bound()
00163     ,value_type   xDu               = +NLP::infinite_bound()
00164     ,value_type   xIl               = -NLP::infinite_bound()
00165     ,value_type   xIu               = +NLP::infinite_bound()
00166     ,value_type   hl                = -NLP::infinite_bound()
00167     ,value_type   hu                = +NLP::infinite_bound()
00168     ,bool         nlp_selects_basis = false
00169     ,value_type   diag_scal         = 10.0
00170     ,value_type   diag_vary         = 1.0
00171     ,bool         sym_basis         = false
00172     ,value_type   f_offset          = 0.0
00173     ,value_type   co                = 0.0
00174     ,bool         ignore_constraints = false
00175     );
00176 
00178 
00179   // Todo: Add methods to manipulate bounds and co ...
00180 
00183   
00184   // ToDo: Add these ...
00185 
00187 
00190 
00192   void initialize(bool test_setup);
00194   bool is_initialized() const;
00196   value_type max_var_bounds_viol() const;
00197 
00199 
00202   
00204   bool nlp_selects_basis() const;
00205 
00207 
00208 protected:
00209 
00212 
00214   bool imp_nlp_has_changed() const;
00216   size_type imp_n_orig() const;
00218   size_type imp_m_orig() const;
00220   size_type imp_mI_orig() const;
00222   const DVectorSlice imp_xinit_orig() const;
00224   bool imp_has_var_bounds() const;
00226   const DVectorSlice imp_xl_orig() const;
00228   const DVectorSlice imp_xu_orig() const;
00230   const DVectorSlice imp_hl_orig() const;
00232   const DVectorSlice imp_hu_orig() const;
00234   void imp_calc_f_orig(
00235     const DVectorSlice            &x_full
00236     ,bool                        newx
00237     ,const ZeroOrderInfoSerial   &zero_order_info
00238     ) const;
00240   void imp_calc_c_orig(
00241     const DVectorSlice            &x_full
00242     ,bool                        newx
00243     ,const ZeroOrderInfoSerial   &zero_order_info
00244     ) const;
00246   void imp_calc_h_orig(
00247     const DVectorSlice            &x_full
00248     ,bool                        newx
00249     ,const ZeroOrderInfoSerial   &zero_order_info
00250     ) const;
00252   void imp_calc_Gf_orig(
00253     const DVectorSlice            &x_full
00254     ,bool                        newx
00255     ,const ObjGradInfoSerial     &obj_grad_info
00256     ) const;
00258   bool imp_get_next_basis(
00259     IVector      *var_perm_full
00260     ,IVector     *equ_perm_full
00261     ,size_type   *rank_full
00262     ,size_type   *rank
00263     );
00265   void imp_report_orig_final_solution(
00266     const DVectorSlice      &x_orig
00267     ,const DVectorSlice     *lambda_orig
00268     ,const DVectorSlice     *lambdaI_orig
00269     ,const DVectorSlice     *nu_orig
00270     ,bool                  is_optimal
00271     ) const;
00272 
00274   
00277 
00279   size_type imp_Gc_nz_orig() const;
00281   size_type imp_Gh_nz_orig() const;
00283   void imp_calc_Gc_orig(
00284     const DVectorSlice& x_full, bool newx
00285     , const FirstOrderExplInfo& first_order_expl_info
00286     ) const;
00288   void imp_calc_Gh_orig(
00289     const DVectorSlice& x_full, bool newx
00290     , const FirstOrderExplInfo& first_order_expl_info
00291     ) const;
00292 
00294 
00295 private:
00296 
00297   // /////////////////////////////////////////
00298   // Private types
00299 
00300   // /////////////////////////////////////////
00301   // Private data members
00302 
00303   bool         is_initialized_;
00304 
00305   bool         nlp_selects_basis_;
00306   bool         basis_selection_was_given_;
00307 
00308   bool         has_var_bounds_;
00309 
00310   value_type   f_offset_;
00311 
00312   size_type    nD_;
00313   size_type    nI_;
00314   size_type    bw_;
00315   size_type    mU_;
00316   size_type    mI_;
00317 
00318   bool         ignore_constraints_;
00319 
00320   size_type    Gc_orig_nz_;
00321   size_type    Gh_orig_nz_;
00322 
00323   DVector      xinit_orig_;
00324   DVector      xl_orig_;
00325   DVector      xu_orig_;
00326   DVector      hl_orig_;
00327   DVector      hu_orig_;
00328 
00329   DVector      co_orig_;
00330 
00331   mutable bool c_orig_updated_;
00332 
00333   value_type   diag_scal_;
00334   value_type   diag_vary_;
00335   value_type   fu_;
00336 
00337   // /////////////////////////////////////////
00338   // Private member functions
00339 
00341   void assert_is_initialized() const;
00342 
00344   void inform_new_point(bool newx) const;
00345 
00346   // Not defined and not to be called
00347   ExampleNLPBanded();
00348   ExampleNLPBanded(const ExampleNLPBanded&);
00349   ExampleNLPBanded& operator=(const ExampleNLPBanded&);
00350 
00351 };  // end class ExampleNLPBanded
00352 
00353 } // end namespace NLPInterfacePack
00354 
00355 #endif  // EXAMPLE_NLP_BANDED_H

Generated on Wed May 12 21:57:50 2010 for MOOCHO by  doxygen 1.4.7