MoochoPack_EvalNewPointStd_Step.cpp

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 <ostream>
00030 #include <typeinfo>
00031 
00032 #include "MoochoPack_EvalNewPointStd_Step.hpp"
00033 #include "MoochoPack_Exceptions.hpp"
00034 #include "MoochoPack_moocho_algo_conversion.hpp"
00035 #include "IterationPack_print_algorithm_step.hpp"
00036 #include "NLPInterfacePack_NLPFirstOrder.hpp"
00037 #include "ConstrainedOptPack_DecompositionSystemVarReduct.hpp"
00038 #include "AbstractLinAlgPack_MatrixSymIdent.hpp"
00039 #include "AbstractLinAlgPack_PermutationOut.hpp"
00040 #include "AbstractLinAlgPack_MatrixOpNonsing.hpp"
00041 #include "AbstractLinAlgPack_MatrixOpOut.hpp"
00042 #include "AbstractLinAlgPack_VectorMutable.hpp"
00043 #include "AbstractLinAlgPack_VectorStdOps.hpp"
00044 #include "AbstractLinAlgPack_VectorOut.hpp"
00045 #include "AbstractLinAlgPack_assert_print_nan_inf.hpp"
00046 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
00047 #include "Teuchos_dyn_cast.hpp"
00048 #include "Teuchos_TestForException.hpp"
00049 
00050 #ifdef TEUCHOS_DEBUG
00051 #include "DenseLinAlgPack_PermVecMat.hpp"
00052 #endif
00053 
00054 namespace MoochoPack {
00055 
00056 EvalNewPointStd_Step::EvalNewPointStd_Step(
00057   const decomp_sys_handler_ptr_t                              &decomp_sys_handler
00058   ,const deriv_tester_ptr_t                                   &deriv_tester
00059   ,const bounds_tester_ptr_t                                  &bounds_tester
00060   ,const decomp_sys_tester_ptr_t                              &decomp_sys_tester
00061   ,EFDDerivTesting                                            fd_deriv_testing
00062   ,DecompositionSystemHandler_Strategy::EDecompSysTesting     decomp_sys_testing
00063   ,DecompositionSystemHandler_Strategy::EDecompSysPrintLevel  decomp_sys_testing_print_level
00064   )
00065   :decomp_sys_handler_(decomp_sys_handler)
00066   ,deriv_tester_(deriv_tester)
00067   ,bounds_tester_(bounds_tester)
00068   ,decomp_sys_tester_(decomp_sys_tester)
00069   ,fd_deriv_testing_(fd_deriv_testing)
00070   ,decomp_sys_testing_(decomp_sys_testing)
00071   ,decomp_sys_testing_print_level_(decomp_sys_testing_print_level)
00072 {}
00073 
00074 bool EvalNewPointStd_Step::do_step(
00075   Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
00076   ,poss_type assoc_step_poss
00077   )
00078 {
00079   using Teuchos::rcp;
00080   using Teuchos::dyn_cast;
00081   using AbstractLinAlgPack::assert_print_nan_inf;
00082   using IterationPack::print_algorithm_step;
00083   using NLPInterfacePack::NLPFirstOrder;
00084 
00085   NLPAlgo         &algo   = rsqp_algo(_algo);
00086   NLPAlgoState    &s      = algo.rsqp_state();
00087   NLPFirstOrder   &nlp    = dyn_cast<NLPFirstOrder>(algo.nlp());
00088 
00089   EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
00090   EJournalOutputLevel ns_olevel = algo.algo_cntr().null_space_journal_output_level();
00091   std::ostream& out = algo.track().journal_out();
00092 
00093   // print step header.
00094   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00095     using IterationPack::print_algorithm_step;
00096     print_algorithm_step( algo, step_poss, type, assoc_step_poss, out );
00097   }
00098 
00099   if(!nlp.is_initialized())
00100     nlp.initialize(algo.algo_cntr().check_results());
00101 
00102   Teuchos::VerboseObjectTempState<NLP>
00103     nlpOutputTempState(rcp(&nlp,false),Teuchos::getFancyOStream(rcp(&out,false)),convertToVerbLevel(olevel));
00104 
00105   const size_type
00106     n  = nlp.n(),
00107     nb = nlp.num_bounded_x(),
00108     m  = nlp.m();
00109   size_type
00110     r  = 0;
00111 
00112   // Get the iteration quantity container objects
00113   IterQuantityAccess<value_type>
00114     &f_iq   = s.f();
00115   IterQuantityAccess<VectorMutable>
00116     &x_iq   = s.x(),
00117     *c_iq   = m > 0  ? &s.c() : NULL,
00118     &Gf_iq  = s.Gf();
00119   IterQuantityAccess<MatrixOp>
00120     *Gc_iq  = m  > 0 ? &s.Gc() : NULL,
00121     *Z_iq   = NULL,
00122     *Y_iq   = NULL,
00123     *Uz_iq  = NULL,
00124     *Uy_iq  = NULL;
00125   IterQuantityAccess<MatrixOpNonsing>
00126     *R_iq   = NULL;
00127 
00128   MatrixOp::EMatNormType mat_nrm_inf = MatrixOp::MAT_NORM_INF;
00129   const bool calc_matrix_norms = algo.algo_cntr().calc_matrix_norms();
00130   const bool calc_matrix_info_null_space_only = algo.algo_cntr().calc_matrix_info_null_space_only();
00131   
00132   if( x_iq.last_updated() == IterQuantity::NONE_UPDATED ) {
00133     if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00134       out << "\nx is not updated for any k so set x_k = nlp.xinit() ...\n";
00135     }
00136     x_iq.set_k(0) = nlp.xinit();
00137   }
00138   
00139   // Validate x
00140   if( nb && algo.algo_cntr().check_results() ) {
00141     assert_print_nan_inf(
00142       x_iq.get_k(0), "x_k", true
00143       , int(olevel) >= int(PRINT_ALGORITHM_STEPS) ? &out : NULL
00144       );
00145     if( nlp.num_bounded_x() > 0 ) {
00146       if(!bounds_tester().check_in_bounds(
00147            int(olevel)  >= int(PRINT_ALGORITHM_STEPS) ? &out : NULL
00148            ,int(olevel) >= int(PRINT_VECTORS)                // print_all_warnings
00149            ,int(olevel) >= int(PRINT_ITERATION_QUANTITIES)  // print_vectors
00150            ,nlp.xl(),        "xl"
00151            ,nlp.xu(),        "xu"
00152            ,x_iq.get_k(0),   "x_k"
00153            ))
00154       {
00155         TEST_FOR_EXCEPTION(
00156           true, TestFailed
00157           ,"EvalNewPointStd_Step::do_step(...) : Error, "
00158           "the variables bounds xl <= x_k <= xu where violated!" );
00159       }
00160     }
00161   }
00162 
00163   Vector &x = x_iq.get_k(0);
00164 
00165   Range1D  var_dep(Range1D::INVALID), var_indep(Range1D::INVALID);
00166   if( s.get_decomp_sys().get() ) {
00167     const ConstrainedOptPack::DecompositionSystemVarReduct
00168       *decomp_sys_vr = dynamic_cast<ConstrainedOptPack::DecompositionSystemVarReduct*>(&s.decomp_sys());
00169     if(decomp_sys_vr) {
00170       var_dep   = decomp_sys_vr->var_dep();
00171       var_indep = decomp_sys_vr->var_indep();
00172     }
00173     s.var_dep(var_dep);
00174     s.var_indep(var_indep);
00175   }
00176 
00177   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00178     out << "\n||x_k||inf            = " << x.norm_inf();
00179     if( var_dep.size() )
00180       out << "\n||x(var_dep)_k||inf   = " << x.sub_view(var_dep)->norm_inf();
00181     if( var_indep.size() )
00182       out << "\n||x(var_indep)_k||inf = " << x.sub_view(var_indep)->norm_inf();
00183     out << std::endl;
00184   }
00185   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00186     out << "\nx_k = \n" << x;
00187     if( var_dep.size() )
00188       out << "\nx(var_dep)_k = \n" << *x.sub_view(var_dep);
00189   }
00190   if( static_cast<int>(ns_olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00191     if( var_indep.size() )
00192       out << "\nx(var_indep)_k = \n" << *x.sub_view(var_indep);
00193   }
00194 
00195   // Set the references to the current point's quantities to be updated
00196   const bool f_k_updated  = f_iq.updated_k(0);
00197   const bool Gf_k_updated = Gf_iq.updated_k(0);
00198   const bool c_k_updated  = m  > 0 ? c_iq->updated_k(0)  : false;
00199   const bool Gc_k_updated = m  > 0 ? Gc_iq->updated_k(0) : false;
00200   nlp.unset_quantities();
00201   if(!f_k_updated) nlp.set_f( &f_iq.set_k(0) );
00202   if(!Gf_k_updated) nlp.set_Gf( &Gf_iq.set_k(0) );
00203   if( m > 0 ) {
00204     if(!c_k_updated) nlp.set_c( &c_iq->set_k(0) );
00205     if(!Gc_k_updated) nlp.set_Gc( &Gc_iq->set_k(0) );
00206   }
00207 
00208   // Calculate Gc at x_k
00209   bool new_point = true;
00210   if(m > 0) {
00211     if(!Gc_k_updated) nlp.calc_Gc( x, new_point );
00212     new_point = false;
00213   }
00214 
00215   //
00216   // Update (or select a new) range/null decomposition
00217   //
00218   bool new_decomp_selected = false;
00219   if( m > 0 ) {
00220     
00221     // Update the range/null decomposition
00222     decomp_sys_handler().update_decomposition(
00223       algo, s, nlp, decomp_sys_testing(), decomp_sys_testing_print_level()
00224       ,&new_decomp_selected
00225       );
00226 
00227     r  = s.equ_decomp().size();
00228 
00229     Z_iq   = ( n > m && r > 0 )      ? &s.Z()  : NULL;
00230     Y_iq   = ( r > 0 )               ? &s.Y()  : NULL;
00231     Uz_iq  = ( m  > 0 && m  > r )    ? &s.Uz() : NULL;
00232     Uy_iq  = ( m  > 0 && m  > r )    ? &s.Uy() : NULL;
00233     R_iq   = ( m > 0 )               ? &s.R()  : NULL;
00234 
00235     // Determine if we will test the decomp_sys or not
00236     const DecompositionSystem::ERunTests
00237       ds_test_what = ( ( decomp_sys_testing() == DecompositionSystemHandler_Strategy::DST_TEST
00238                  || ( decomp_sys_testing() == DecompositionSystemHandler_Strategy::DST_DEFAULT
00239                   && algo.algo_cntr().check_results() ) )
00240                ? DecompositionSystem::RUN_TESTS
00241                : DecompositionSystem::NO_TESTS );
00242     
00243     // Determine the output level for decomp_sys        
00244     DecompositionSystem::EOutputLevel ds_olevel;
00245     switch(olevel) {
00246       case PRINT_NOTHING:
00247       case PRINT_BASIC_ALGORITHM_INFO:
00248         ds_olevel = DecompositionSystem::PRINT_NONE;
00249         break;
00250       case PRINT_ALGORITHM_STEPS:
00251       case PRINT_ACTIVE_SET:
00252         ds_olevel = DecompositionSystem::PRINT_BASIC_INFO;
00253         break;
00254       case PRINT_VECTORS:
00255         ds_olevel = DecompositionSystem::PRINT_VECTORS;
00256         break;
00257       case PRINT_ITERATION_QUANTITIES:
00258         ds_olevel = DecompositionSystem::PRINT_EVERY_THING;
00259         break;
00260       default:
00261         TEST_FOR_EXCEPT(true); // Should not get here!
00262     };
00263 
00264     // Test the decomposition system
00265     if( ds_test_what == DecompositionSystem::RUN_TESTS ) {
00266       // Set the output level
00267       if( decomp_sys_tester().print_tests() == DecompositionSystemTester::PRINT_NOT_SELECTED ) {
00268         DecompositionSystemTester::EPrintTestLevel  ds_olevel;
00269         switch(olevel) {
00270           case PRINT_NOTHING:
00271           case PRINT_BASIC_ALGORITHM_INFO:
00272             ds_olevel = DecompositionSystemTester::PRINT_NONE;
00273             break;
00274           case PRINT_ALGORITHM_STEPS:
00275           case PRINT_ACTIVE_SET:
00276             ds_olevel = DecompositionSystemTester::PRINT_BASIC;
00277             break;
00278           case PRINT_VECTORS:
00279             ds_olevel = DecompositionSystemTester::PRINT_MORE;
00280             break;
00281           case PRINT_ITERATION_QUANTITIES:
00282             ds_olevel = DecompositionSystemTester::PRINT_ALL;
00283             break;
00284           default:
00285             TEST_FOR_EXCEPT(true); // Should not get here!
00286         }
00287         decomp_sys_tester().print_tests(ds_olevel);
00288         decomp_sys_tester().dump_all( olevel == PRINT_ITERATION_QUANTITIES );
00289       }
00290       // Run the tests
00291       if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00292         out << "\nTesting the range/null decompostion ...\n";
00293       }
00294       const bool
00295         decomp_sys_passed = decomp_sys_tester().test_decomp_system(
00296           s.decomp_sys()
00297           ,Gc_iq->get_k(0)                   // Gc
00298           ,Z_iq ? &Z_iq->get_k(0) : NULL     // Z
00299           ,&Y_iq->get_k(0)                   // Y
00300           ,&R_iq->get_k(0)                   // R
00301           ,m > r  ? &Uz_iq->get_k(0) : NULL  // Uz
00302           ,m > r  ? &Uy_iq->get_k(0) : NULL  // Uy
00303           ,( olevel >= PRINT_ALGORITHM_STEPS ) ? &out : NULL
00304           );
00305       TEST_FOR_EXCEPTION(
00306         !decomp_sys_passed, TestFailed
00307         ,"EvalNewPointStd_Step::do_step(...) : Error, "
00308         "the tests of the decomposition system failed!" );
00309     }
00310   }
00311   else {
00312     // Unconstrained problem
00313     Z_iq = &s.Z();
00314     dyn_cast<MatrixSymIdent>(Z_iq->set_k(0)).initialize( nlp.space_x() );
00315     s.equ_decomp(Range1D::Invalid);
00316     s.equ_undecomp(Range1D::Invalid);
00317   }
00318 
00319   // Calculate the rest of the quantities.  If decomp_sys is a variable
00320   // reduction decomposition system object, then nlp will be hip to the
00321   // basis selection and will permute these quantities to that basis.
00322   // Note that x will already be permuted to the current basis.
00323   if(!Gf_k_updated) { nlp.calc_Gf( x, new_point ); new_point = false; }
00324   if( m && (!c_k_updated || new_decomp_selected ) ) {
00325     if(c_k_updated) nlp.set_c( &c_iq->set_k(0) ); // This was not set earlier!
00326     nlp.calc_c( x, false);
00327   }
00328   if(!f_k_updated) {
00329     nlp.calc_f( x, false);
00330   }
00331   nlp.unset_quantities();
00332   
00333   // Check for NaN and Inf
00334   assert_print_nan_inf(f_iq.get_k(0),"f_k",true,&out); 
00335   if(m)
00336     assert_print_nan_inf(c_iq->get_k(0),"c_k",true,&out); 
00337   assert_print_nan_inf(Gf_iq.get_k(0),"Gf_k",true,&out); 
00338   
00339   // Print the iteration quantities before we test the derivatives for debugging
00340 
00341   // Update the selection of dependent and independent variables
00342   if( s.get_decomp_sys().get() ) {
00343     const ConstrainedOptPack::DecompositionSystemVarReduct
00344       *decomp_sys_vr = dynamic_cast<ConstrainedOptPack::DecompositionSystemVarReduct*>(&s.decomp_sys());
00345     if(decomp_sys_vr) {
00346       var_dep   = decomp_sys_vr->var_dep();
00347       var_indep = decomp_sys_vr->var_indep();
00348     }
00349   }
00350   
00351   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00352     out << "\nPrinting the updated iteration quantities ...\n";
00353   }
00354 
00355   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00356     out << "\nf_k                      = "     << f_iq.get_k(0);
00357     out << "\n||Gf_k||inf              = "     << Gf_iq.get_k(0).norm_inf();
00358     if( var_dep.size() )
00359       out << "\n||Gf_k(var_dep)_k||inf   = " << Gf_iq.get_k(0).sub_view(var_dep)->norm_inf();
00360     if( var_indep.size() )
00361       out << "\n||Gf_k(var_indep)_k||inf = " << Gf_iq.get_k(0).sub_view(var_indep)->norm_inf();
00362     if(m) {
00363       out << "\n||c_k||inf               = " << c_iq->get_k(0).norm_inf();
00364       if( calc_matrix_norms && !calc_matrix_info_null_space_only )
00365         out << "\n||Gc_k||inf              = " << Gc_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00366       if( n > r && calc_matrix_norms && !calc_matrix_info_null_space_only )
00367         out << "\n||Z||inf                 = " << Z_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00368       if( r && calc_matrix_norms && !calc_matrix_info_null_space_only )
00369         out << "\n||Y||inf                 = " << Y_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00370       if( r && calc_matrix_norms && !calc_matrix_info_null_space_only  )
00371         out << "\n||R||inf                 = " << R_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00372       if( algo.algo_cntr().calc_conditioning() && !calc_matrix_info_null_space_only ) {
00373         out << "\ncond_inf(R)              = " << R_iq->get_k(0).calc_cond_num(mat_nrm_inf).value;
00374       }
00375       if( m > r && calc_matrix_norms && !calc_matrix_info_null_space_only ) {
00376         out << "\n||Uz_k||inf              = " << Uz_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00377         out << "\n||Uy_k||inf              = " << Uy_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00378       }
00379     }
00380     out << std::endl;
00381   }
00382 
00383   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ITERATION_QUANTITIES) ) {
00384     if(m)
00385       out << "\nGc_k =\n" << Gc_iq->get_k(0);
00386     if( n > r )
00387       out << "\nZ_k =\n" << Z_iq->get_k(0);
00388     if(r) {
00389       out << "\nY_k =\n" << Y_iq->get_k(0);
00390       out << "\nR_k =\n" << R_iq->get_k(0);
00391     }
00392     if( m > r ) {
00393       out << "\nUz_k =\n" << Uz_iq->get_k(0);
00394       out << "\nUy_k =\n" << Uy_iq->get_k(0);
00395     }
00396   }
00397   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00398     out << "\nGf_k =\n" << Gf_iq.get_k(0);
00399     if( var_dep.size() )
00400       out << "\nGf(var_dep)_k =\n " << *Gf_iq.get_k(0).sub_view(var_dep);
00401   }
00402   if( static_cast<int>(ns_olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00403     if( var_indep.size() )
00404       out << "\nGf(var_indep)_k =\n" << *Gf_iq.get_k(0).sub_view(var_indep);
00405   }
00406   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00407     if(m)
00408       out << "\nc_k = \n" << c_iq->get_k(0);
00409   }
00410   
00411   // Check the derivatives if we are checking the results
00412   if(   fd_deriv_testing() == FD_TEST
00413     || ( fd_deriv_testing() == FD_DEFAULT && algo.algo_cntr().check_results() )  )
00414   {
00415     
00416     if( olevel >= PRINT_ALGORITHM_STEPS ) {
00417       out << "\n*** Checking derivatives by finite differences\n";
00418     }
00419 
00420     const bool
00421       nlp_passed = deriv_tester().finite_diff_check(
00422         &nlp
00423         ,x
00424         ,nb ? &nlp.xl() : NULL
00425         ,nb ? &nlp.xu() : NULL
00426         ,m  ? &Gc_iq->get_k(0) : NULL
00427         ,&Gf_iq.get_k(0)
00428         ,olevel >= PRINT_VECTORS
00429         ,( olevel >= PRINT_ALGORITHM_STEPS ) ? &out : NULL
00430         );
00431     TEST_FOR_EXCEPTION(
00432       !nlp_passed, TestFailed
00433       ,"EvalNewPointStd_Step::do_step(...) : Error, "
00434       "the tests of the nlp derivatives failed!" );
00435   }
00436 
00437   return true;
00438 }
00439 
00440 void EvalNewPointStd_Step::print_step(
00441    const Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
00442   ,poss_type assoc_step_poss, std::ostream& out, const std::string& L
00443   ) const
00444 {
00445   const NLPAlgo       &algo = rsqp_algo(_algo);
00446   const NLPAlgoState  &s    = algo.rsqp_state();
00447   const NLP           &nlp  = algo.nlp();
00448   const size_type
00449     m = nlp.m();
00450   out
00451     << L << "*** Evaluate the new point and update the range/null decomposition\n"
00452     << L << "if nlp is not initialized then initialize the nlp\n"
00453     << L << "if x is not updated for any k then set x_k = xinit\n";
00454   if(m) {
00455     out
00456       << L << "if Gc_k is not updated Gc_k = Gc(x_k) <: space_x|space_c\n"
00457       << L << "For Gc_k = [ Gc_k(:,equ_decomp), Gc_k(:,equ_undecomp) ] where:\n"
00458       << L << "  Gc_k(:,equ_decomp) <: space_x|space_c(equ_decomp) has full column rank r\n"
00459       << L << "Find:\n"
00460       << L << "  Z_k  <: space_x|space_null    s.t. Gc_k(:,equ_decomp)' * Z_k = 0\n"
00461       << L << "  Y_k  <: space_x|space_range   s.t. [Z_k Y_k] is nonsigular \n"
00462       << L << "  R_k  <: space_c(equ_decomp)|space_range\n"
00463       << L << "                                s.t. R_k = Gc_k(:,equ_decomp)' * Y_k\n"
00464       << L << "  if m > r : Uz_k <: space_c(equ_undecomp)|space_null\n"
00465       << L << "                                s.t. Uz_k = Gc_k(:,equ_undecomp)' * Z_k\n"
00466       << L << "  if m > r : Uy_k <: space_c(equ_undecomp)|space_range\n"
00467       << L << "                                s.t. Uy_k = Gc_k(:,equ_undecomp)' * Y_k\n"
00468       << L << "begin update decomposition (class \'" << typeName(decomp_sys_handler()) << "\')\n"
00469       ;
00470     decomp_sys_handler().print_update_decomposition( algo, s, out, L + "  " );
00471     out
00472       << L << "end update decomposition\n"
00473       << L << "if ( (decomp_sys_testing==DST_TEST)\n"
00474       << L << "  or (decomp_sys_testing==DST_DEFAULT and check_results==true)\n"
00475       << L << "  ) then\n"
00476       << L << "  check properties for Z_k, Y_k, R_k, Uz_k and Uy_k\n"
00477       << L << "end\n"
00478       ;
00479   }
00480   else {
00481     out 
00482       << L << "Z_k = eye(space_x)\n";
00483   }
00484   if(m) {
00485     out
00486       << L << "end\n";
00487   }
00488   out
00489     << L << "Gf_k = Gf(x_k) <: space_x\n"
00490     << L << "if m > 0 and c_k is not updated c_k = c(x_k) <: space_c\n"
00491     << L << "if f_k is not updated f_k = f(x_k) <: REAL\n"
00492     << L << "if ( (fd_deriv_testing==FD_TEST)\n"
00493     << L << "  or (fd_deriv_testing==FD_DEFAULT and check_results==true)\n"
00494     << L << "  ) then\n"
00495     << L << "  check Gc_k (if m > 0) and Gf_k by finite differences.\n"
00496     << L << "end\n"
00497     ;
00498 }
00499 
00500 } // end namespace MoochoPack

Generated on Wed May 12 21:32:12 2010 for MoochoPack : Framework for Large-Scale Optimization Algorithms by  doxygen 1.4.7