|
MoochoPack : Framework for Large-Scale Optimization Algorithms
Version of the Day
|
00001 #if 0 00002 00003 // @HEADER 00004 // *********************************************************************** 00005 // 00006 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00007 // Copyright (2003) Sandia Corporation 00008 // 00009 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00010 // license for use of this work by or on behalf of the U.S. Government. 00011 // 00012 // Redistribution and use in source and binary forms, with or without 00013 // modification, are permitted provided that the following conditions are 00014 // met: 00015 // 00016 // 1. Redistributions of source code must retain the above copyright 00017 // notice, this list of conditions and the following disclaimer. 00018 // 00019 // 2. Redistributions in binary form must reproduce the above copyright 00020 // notice, this list of conditions and the following disclaimer in the 00021 // documentation and/or other materials provided with the distribution. 00022 // 00023 // 3. Neither the name of the Corporation nor the names of the 00024 // contributors may be used to endorse or promote products derived from 00025 // this software without specific prior written permission. 00026 // 00027 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00028 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00030 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00031 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00032 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00033 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00034 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00035 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00036 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00037 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00038 // 00039 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00040 // 00041 // *********************************************************************** 00042 // @HEADER 00043 00044 #include "MoochoPack_QuasiRangeSpaceStepTailoredApproach_Strategy.hpp" 00045 #include "MoochoPack_MoochoAlgorithmStepNames.hpp" 00046 #include "MoochoPack_NLPAlgo.hpp" 00047 #include "MoochoPack_NLPAlgoState.hpp" 00048 #include "MoochoPack/src/NLPrSQPTailoredApproach.h" 00049 #include "MoochoPack_EvalNewPointTailoredApproach_Step.hpp" 00050 #include "ConstrainedOptPack/src/DenseIdentVertConcatMatrixSubclass.h" 00051 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixOp.hpp" 00052 #include "DenseLinAlgPack_LinAlgOpPack.hpp" 00053 #include "MiWorkspacePack.h" 00054 #include "Midynamic_cast_verbose.h" 00055 00056 namespace LinAlgOpPack { 00057 using AbstractLinAlgPack::Vp_StMtV; 00058 } 00059 00060 namespace MoochoPack { 00061 00062 bool QuasiRangeSpaceStepTailoredApproach_Strategy::solve_quasi_range_space_step( 00063 std::ostream& out, EJournalOutputLevel olevel, NLPAlgo *algo, NLPAlgoState *s 00064 ,const DVectorSlice& xo, const DVectorSlice& c_xo, DVectorSlice* v 00065 ) 00066 { 00067 using Teuchos::dyn_cast; 00068 using Teuchos::Workspace; 00069 Teuchos::WorkspaceStore* wss = Teuchos::get_default_workspace_store().get(); 00070 00071 // Get NLP reference 00072 #ifdef _WINDOWS 00073 NLPrSQPTailoredApproach 00074 &nlp = dynamic_cast<NLPrSQPTailoredApproach&>(algo->nlp()); 00075 #else 00076 NLPrSQPTailoredApproach 00077 &nlp = dyn_cast<NLPrSQPTailoredApproach>(algo->nlp()); 00078 #endif 00079 00080 // Get D for Z_k = [ D; I ] 00081 const MatrixOp 00082 &Z_k = s->Z().get_k(0); 00083 #ifdef _WINDOWS 00084 const DenseIdentVertConcatMatrixSubclass 00085 &cZ_k = dynamic_cast<const DenseIdentVertConcatMatrixSubclass&>(Z_k); 00086 #else 00087 const DenseIdentVertConcatMatrixSubclass 00088 &cZ_k = dyn_cast<const DenseIdentVertConcatMatrixSubclass>(Z_k); 00089 #endif 00090 const DMatrixSlice 00091 D = cZ_k.m().D(); 00092 00093 // Get reference to EvalNewPoint step 00094 #ifdef _WINDOWS 00095 EvalNewPointTailoredApproach_Step 00096 &eval_tailored = dynamic_cast<EvalNewPointTailoredApproach_Step&>( 00097 *algo->get_step(algo->get_step_poss(EvalNewPoint_name))); 00098 #else 00099 EvalNewPointTailoredApproach_Step 00100 &eval_tailored = dyn_cast<EvalNewPointTailoredApproach_Step>( 00101 *algo->get_step(algo->get_step_poss(EvalNewPoint_name))); 00102 #endif 00103 00104 // Compute an approximate newton step for constriants wy 00105 DVector c_xo_tmp = c_xo, vy_tmp; // This is hacked. This sucks! 00106 nlp.calc_semi_newton_step(xo,&c_xo_tmp,false,&vy_tmp); 00107 00108 // Compute wy, Ywy 00109 eval_tailored.recalc_py_Ypy(D,&vy_tmp(),v,olevel,out); 00110 00111 return true; 00112 } 00113 00114 void QuasiRangeSpaceStepTailoredApproach_Strategy::print_step( std::ostream& out, const std::string& L ) const 00115 { 00116 out << L << "*** Compute the approximate range space step by calling on the \"Tailored Approach\" NLP interface:\n" 00117 << L << "Compute vy s.t. ||Gc_k'*Y_k*vy + c_xo|| << ||c_xo|| (nlp.calc_semi_newton_step(...))\n" 00118 << L << "update vy and compute v = Yvy from EvalNewPointTailoredApproach_Step::recalc_py_Ypy(...)\n"; 00119 ; 00120 } 00121 00122 } // end namespace MoochoPack 00123 00124 #endif // 0
1.7.6.1