|
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 // This library is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as 00014 // published by the Free Software Foundation; either version 2.1 of the 00015 // License, or (at your option) any later version. 00016 // 00017 // This library is distributed in the hope that it will be useful, but 00018 // WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 // Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with this library; if not, write to the Free Software 00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00025 // USA 00026 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00027 // 00028 // *********************************************************************** 00029 // @HEADER 00030 00031 #include "MoochoPack_QuasiRangeSpaceStepTailoredApproach_Strategy.hpp" 00032 #include "MoochoPack_MoochoAlgorithmStepNames.hpp" 00033 #include "MoochoPack_NLPAlgo.hpp" 00034 #include "MoochoPack_NLPAlgoState.hpp" 00035 #include "MoochoPack/src/NLPrSQPTailoredApproach.h" 00036 #include "MoochoPack_EvalNewPointTailoredApproach_Step.hpp" 00037 #include "ConstrainedOptPack/src/DenseIdentVertConcatMatrixSubclass.h" 00038 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixOp.hpp" 00039 #include "DenseLinAlgPack_LinAlgOpPack.hpp" 00040 #include "MiWorkspacePack.h" 00041 #include "Midynamic_cast_verbose.h" 00042 00043 namespace LinAlgOpPack { 00044 using AbstractLinAlgPack::Vp_StMtV; 00045 } 00046 00047 namespace MoochoPack { 00048 00049 bool QuasiRangeSpaceStepTailoredApproach_Strategy::solve_quasi_range_space_step( 00050 std::ostream& out, EJournalOutputLevel olevel, NLPAlgo *algo, NLPAlgoState *s 00051 ,const DVectorSlice& xo, const DVectorSlice& c_xo, DVectorSlice* v 00052 ) 00053 { 00054 using Teuchos::dyn_cast; 00055 using Teuchos::Workspace; 00056 Teuchos::WorkspaceStore* wss = Teuchos::get_default_workspace_store().get(); 00057 00058 // Get NLP reference 00059 #ifdef _WINDOWS 00060 NLPrSQPTailoredApproach 00061 &nlp = dynamic_cast<NLPrSQPTailoredApproach&>(algo->nlp()); 00062 #else 00063 NLPrSQPTailoredApproach 00064 &nlp = dyn_cast<NLPrSQPTailoredApproach>(algo->nlp()); 00065 #endif 00066 00067 // Get D for Z_k = [ D; I ] 00068 const MatrixOp 00069 &Z_k = s->Z().get_k(0); 00070 #ifdef _WINDOWS 00071 const DenseIdentVertConcatMatrixSubclass 00072 &cZ_k = dynamic_cast<const DenseIdentVertConcatMatrixSubclass&>(Z_k); 00073 #else 00074 const DenseIdentVertConcatMatrixSubclass 00075 &cZ_k = dyn_cast<const DenseIdentVertConcatMatrixSubclass>(Z_k); 00076 #endif 00077 const DMatrixSlice 00078 D = cZ_k.m().D(); 00079 00080 // Get reference to EvalNewPoint step 00081 #ifdef _WINDOWS 00082 EvalNewPointTailoredApproach_Step 00083 &eval_tailored = dynamic_cast<EvalNewPointTailoredApproach_Step&>( 00084 *algo->get_step(algo->get_step_poss(EvalNewPoint_name))); 00085 #else 00086 EvalNewPointTailoredApproach_Step 00087 &eval_tailored = dyn_cast<EvalNewPointTailoredApproach_Step>( 00088 *algo->get_step(algo->get_step_poss(EvalNewPoint_name))); 00089 #endif 00090 00091 // Compute an approximate newton step for constriants wy 00092 DVector c_xo_tmp = c_xo, vy_tmp; // This is hacked. This sucks! 00093 nlp.calc_semi_newton_step(xo,&c_xo_tmp,false,&vy_tmp); 00094 00095 // Compute wy, Ywy 00096 eval_tailored.recalc_py_Ypy(D,&vy_tmp(),v,olevel,out); 00097 00098 return true; 00099 } 00100 00101 void QuasiRangeSpaceStepTailoredApproach_Strategy::print_step( std::ostream& out, const std::string& L ) const 00102 { 00103 out << L << "*** Compute the approximate range space step by calling on the \"Tailored Approach\" NLP interface:\n" 00104 << L << "Compute vy s.t. ||Gc_k'*Y_k*vy + c_xo|| << ||c_xo|| (nlp.calc_semi_newton_step(...))\n" 00105 << L << "update vy and compute v = Yvy from EvalNewPointTailoredApproach_Step::recalc_py_Ypy(...)\n"; 00106 ; 00107 } 00108 00109 } // end namespace MoochoPack 00110 00111 #endif // 0
1.7.4