|
NLPInterfacePack: C++ Interfaces and Implementation for Non-Linear Programs Version of the Day
|
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 #include "NLPInterfacePack_NLPSecondOrder.hpp" 00030 #include "Teuchos_TestForException.hpp" 00031 00032 namespace { 00033 const char name_HL[] = "HL"; 00034 } 00035 00036 namespace NLPInterfacePack { 00037 00038 // constructors 00039 00040 NLPSecondOrder::NLPSecondOrder() 00041 : HL_(NULL) 00042 {} 00043 00044 00045 void NLPSecondOrder::initialize(bool test_setup) { 00046 num_HL_evals_ = 0; 00047 NLPFirstOrder::initialize(test_setup); 00048 } 00049 00050 // <<std aggr>> members for HL 00051 00052 void NLPSecondOrder::set_HL(MatrixSymOp* HL) 00053 { 00054 HL_ = HL; 00055 } 00056 00057 MatrixSymOp* NLPSecondOrder::get_HL() 00058 { 00059 return StandardCompositionRelationshipsPack::get_role_name(HL_, false, name_HL); 00060 } 00061 00062 MatrixSymOp& NLPSecondOrder::HL() 00063 { 00064 return StandardCompositionRelationshipsPack::role_name(HL_, false, name_HL); 00065 } 00066 00067 const MatrixSymOp& NLPSecondOrder::HL() const 00068 { 00069 return StandardCompositionRelationshipsPack::role_name(HL_, false, name_HL); 00070 } 00071 00072 void NLPSecondOrder::unset_quantities() 00073 { 00074 NLPFirstOrder::unset_quantities(); 00075 HL_ = NULL; 00076 } 00077 00078 // calculations 00079 00080 void NLPSecondOrder::calc_HL( 00081 const Vector& x, const Vector* lambda, bool newpoint 00082 ) const 00083 { 00084 #ifdef TEUCHOS_DEBUG 00085 TEST_FOR_EXCEPTION( lambda && this->m() == 0, std::logic_error, "" ); 00086 #endif 00087 StandardCompositionRelationshipsPack::assert_role_name_set(HL_, "NLP::calc_HL()", name_HL); 00088 imp_calc_HL(x,lambda,newpoint,second_order_info()); 00089 } 00090 00091 size_type NLPSecondOrder::num_HL_evals() const 00092 { 00093 return num_HL_evals_; 00094 } 00095 00096 } // namespace NLPInterfacePack
1.7.4