MoochoPack_QuasiRangeSpaceStepTailoredApproach_Strategy.cpp

Go to the documentation of this file.
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 "MoochoPack_QuasiRangeSpaceStepTailoredApproach_Strategy.hpp"
00030 #include "MoochoPack_MoochoAlgorithmStepNames.hpp"
00031 #include "MoochoPack_NLPAlgo.hpp"
00032 #include "MoochoPack_NLPAlgoState.hpp"
00033 #include "MoochoPack/src/NLPrSQPTailoredApproach.h"
00034 #include "MoochoPack_EvalNewPointTailoredApproach_Step.hpp"
00035 #include "ConstrainedOptPack/src/DenseIdentVertConcatMatrixSubclass.h"
00036 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixOp.hpp"
00037 #include "DenseLinAlgPack_LinAlgOpPack.hpp"
00038 #include "MiWorkspacePack.h"
00039 #include "Midynamic_cast_verbose.h"
00040 
00041 namespace LinAlgOpPack {
00042   using AbstractLinAlgPack::Vp_StMtV;
00043 }
00044 
00045 namespace MoochoPack {
00046 
00047 bool QuasiRangeSpaceStepTailoredApproach_Strategy::solve_quasi_range_space_step(
00048   std::ostream& out, EJournalOutputLevel olevel, NLPAlgo *algo, NLPAlgoState *s
00049   ,const DVectorSlice& xo, const DVectorSlice& c_xo, DVectorSlice* v
00050     )
00051 {
00052   using Teuchos::dyn_cast;
00053   using Teuchos::Workspace;
00054   Teuchos::WorkspaceStore* wss = Teuchos::get_default_workspace_store().get();
00055 
00056   // Get NLP reference
00057 #ifdef _WINDOWS
00058   NLPrSQPTailoredApproach
00059     &nlp  = dynamic_cast<NLPrSQPTailoredApproach&>(algo->nlp());
00060 #else
00061   NLPrSQPTailoredApproach
00062     &nlp  = dyn_cast<NLPrSQPTailoredApproach>(algo->nlp());
00063 #endif
00064 
00065   // Get D for Z_k = [ D; I ]
00066   const MatrixOp
00067     &Z_k = s->Z().get_k(0);
00068 #ifdef _WINDOWS
00069   const DenseIdentVertConcatMatrixSubclass
00070     &cZ_k = dynamic_cast<const DenseIdentVertConcatMatrixSubclass&>(Z_k);
00071 #else
00072   const DenseIdentVertConcatMatrixSubclass
00073     &cZ_k = dyn_cast<const DenseIdentVertConcatMatrixSubclass>(Z_k);
00074 #endif
00075   const DMatrixSlice
00076     D = cZ_k.m().D();
00077 
00078   // Get reference to EvalNewPoint step
00079 #ifdef _WINDOWS
00080   EvalNewPointTailoredApproach_Step
00081     &eval_tailored = dynamic_cast<EvalNewPointTailoredApproach_Step&>(
00082       *algo->get_step(algo->get_step_poss(EvalNewPoint_name)));
00083 #else
00084   EvalNewPointTailoredApproach_Step
00085     &eval_tailored = dyn_cast<EvalNewPointTailoredApproach_Step>(
00086       *algo->get_step(algo->get_step_poss(EvalNewPoint_name)));
00087 #endif
00088 
00089   // Compute an approximate newton step for constriants wy
00090   DVector c_xo_tmp = c_xo, vy_tmp;  // This is hacked.  This sucks!
00091   nlp.calc_semi_newton_step(xo,&c_xo_tmp,false,&vy_tmp);
00092     
00093   // Compute wy, Ywy
00094   eval_tailored.recalc_py_Ypy(D,&vy_tmp(),v,olevel,out);
00095 
00096   return true;
00097 }
00098 
00099 void QuasiRangeSpaceStepTailoredApproach_Strategy::print_step( std::ostream& out, const std::string& L ) const
00100 {
00101   out << L << "*** Compute the approximate range space step by calling on the \"Tailored Approach\" NLP interface:\n"
00102     << L << "Compute vy s.t. ||Gc_k'*Y_k*vy + c_xo|| << ||c_xo|| (nlp.calc_semi_newton_step(...))\n"
00103     << L << "update vy and compute v = Yvy from EvalNewPointTailoredApproach_Step::recalc_py_Ypy(...)\n";
00104     ;
00105 }
00106 
00107 } // end namespace MoochoPack

Generated on Thu Sep 18 12:35:18 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1