MOOCHO Version of the Day
NLPInterfacePack_NLPWBCounterExample.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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef NLP_WB_COUNTER_EXAMPLE_H
00043 #define NLP_WB_COUNTER_EXAMPLE_H
00044 
00045 #include "NLPInterfacePack_NLPSerialPreprocessExplJac.hpp"
00046 
00047 namespace NLPInterfacePack {
00048 
00081 class NLPWBCounterExample : public NLPSerialPreprocessExplJac {
00082 public:
00083 
00086 
00101   NLPWBCounterExample(
00102     value_type   xinit[3]
00103     ,value_type   a                  = 0.0
00104     ,value_type   b                  = 1.0
00105     ,bool         nlp_selects_basis  = true
00106     ,bool         linear_obj         = true
00107     );
00108 
00110 
00113 
00115   void initialize(bool test_setup);
00117   bool is_initialized() const;
00119   value_type max_var_bounds_viol() const;
00120 
00122 
00125   
00127   bool nlp_selects_basis() const;
00128 
00130 
00131 protected:
00132 
00135 
00137   bool imp_nlp_has_changed() const;
00139   size_type imp_n_orig() const;
00141   size_type imp_m_orig() const;
00143   size_type imp_mI_orig() const;
00145   const DVectorSlice imp_xinit_orig() const;
00147   bool imp_has_var_bounds() const;
00149   const DVectorSlice imp_xl_orig() const;
00151   const DVectorSlice imp_xu_orig() const;
00153   const DVectorSlice imp_hl_orig() const;
00155   const DVectorSlice imp_hu_orig() const;
00157   void imp_calc_f_orig(
00158     const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info ) const;
00160   void imp_calc_c_orig(
00161     const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info ) const;
00163   void imp_calc_h_orig(
00164     const DVectorSlice &x_full, bool newx, const ZeroOrderInfoSerial &zero_order_info ) const;
00166   void imp_calc_Gf_orig(
00167     const DVectorSlice &x_full, bool newx, const ObjGradInfoSerial &obj_grad_info ) const;
00169   bool imp_get_next_basis(
00170     IVector *var_perm_full, IVector *equ_perm_full, size_type *rank_full, size_type *rank );
00172   void imp_report_orig_final_solution(
00173     const DVectorSlice &x_orig, const DVectorSlice *lambda_orig
00174     ,const DVectorSlice *lambdaI_orig, const DVectorSlice *nu_orig, bool is_optimal ) const;
00175 
00177   
00180 
00182   size_type imp_Gc_nz_orig() const;
00184   size_type imp_Gh_nz_orig() const;
00186   void imp_calc_Gc_orig(
00187     const DVectorSlice& x_full, bool newx, const FirstOrderExplInfo& first_order_expl_info ) const;
00189   void imp_calc_Gh_orig(
00190     const DVectorSlice& x_full, bool newx, const FirstOrderExplInfo& first_order_expl_info ) const;
00191 
00193 
00194 private:
00195 
00196   // /////////////////////////////////////////
00197   // Private data members
00198 
00199   bool         is_initialized_;                 // Flag for if this is initialized
00200   bool         nlp_selects_basis_;              // Flag for if this selects first basis
00201   bool         basis_selection_was_given_;      // Flag for if this already selected a basis
00202   bool         linear_obj_;                     // Flag for if objective is linear or quadratic
00203   size_type    n_orig_, m_orig_, Gc_orig_nz_;   // NLP sizes and number nonzeros in Jacobian
00204   value_type   a_, b_;                          // Constants for constraints
00205   DVector      xinit_orig_, xl_orig_, xu_orig_; // Guess, and bounds on x_orig
00206 
00207   // /////////////////////////////////////////
00208   // Private member functions
00209 
00210   // Not defined and not to be called
00211   NLPWBCounterExample();
00212   NLPWBCounterExample(const NLPWBCounterExample&);
00213   NLPWBCounterExample& operator=(const NLPWBCounterExample&);
00214 
00215 };  // end class NLPWBCounterExample
00216 
00217 } // end namespace NLPInterfacePack
00218 
00219 #endif  // NLP_WB_COUNTER_EXAMPLE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends