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   }
00174 
00175   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00176     out << "\n||x_k||inf            = " << x.norm_inf();
00177     if( var_dep.size() )
00178       out << "\n||x(var_dep)_k||inf   = " << x.sub_view(var_dep)->norm_inf();
00179     if( var_indep.size() )
00180       out << "\n||x(var_indep)_k||inf = " << x.sub_view(var_indep)->norm_inf();
00181     out << std::endl;
00182   }
00183   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00184     out << "\nx_k = \n" << x;
00185     if( var_dep.size() )
00186       out << "\nx(var_dep)_k = \n" << *x.sub_view(var_dep);
00187   }
00188   if( static_cast<int>(ns_olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00189     if( var_indep.size() )
00190       out << "\nx(var_indep)_k = \n" << *x.sub_view(var_indep);
00191   }
00192 
00193   // Set the references to the current point's quantities to be updated
00194   const bool f_k_updated  = f_iq.updated_k(0);
00195   const bool Gf_k_updated = Gf_iq.updated_k(0);
00196   const bool c_k_updated  = m  > 0 ? c_iq->updated_k(0)  : false;
00197   const bool Gc_k_updated = m  > 0 ? Gc_iq->updated_k(0) : false;
00198   nlp.unset_quantities();
00199   if(!f_k_updated) nlp.set_f( &f_iq.set_k(0) );
00200   if(!Gf_k_updated) nlp.set_Gf( &Gf_iq.set_k(0) );
00201   if( m > 0 ) {
00202     if(!c_k_updated) nlp.set_c( &c_iq->set_k(0) );
00203     if(!Gc_k_updated) nlp.set_Gc( &Gc_iq->set_k(0) );
00204   }
00205 
00206   // Calculate Gc at x_k
00207   bool new_point = true;
00208   if(m > 0) {
00209     if(!Gc_k_updated) nlp.calc_Gc( x, new_point );
00210     new_point = false;
00211   }
00212 
00213   //
00214   // Update (or select a new) range/null decomposition
00215   //
00216   bool new_decomp_selected = false;
00217   if( m > 0 ) {
00218     
00219     // Update the range/null decomposition
00220     decomp_sys_handler().update_decomposition(
00221       algo, s, nlp, decomp_sys_testing(), decomp_sys_testing_print_level()
00222       ,&new_decomp_selected
00223       );
00224 
00225     r  = s.equ_decomp().size();
00226 
00227     Z_iq   = ( n > m && r > 0 )      ? &s.Z()  : NULL;
00228     Y_iq   = ( r > 0 )               ? &s.Y()  : NULL;
00229     Uz_iq  = ( m  > 0 && m  > r )    ? &s.Uz() : NULL;
00230     Uy_iq  = ( m  > 0 && m  > r )    ? &s.Uy() : NULL;
00231     R_iq   = ( m > 0 )               ? &s.R()  : NULL;
00232 
00233     // Determine if we will test the decomp_sys or not
00234     const DecompositionSystem::ERunTests
00235       ds_test_what = ( ( decomp_sys_testing() == DecompositionSystemHandler_Strategy::DST_TEST
00236                  || ( decomp_sys_testing() == DecompositionSystemHandler_Strategy::DST_DEFAULT
00237                   && algo.algo_cntr().check_results() ) )
00238                ? DecompositionSystem::RUN_TESTS
00239                : DecompositionSystem::NO_TESTS );
00240     
00241     // Determine the output level for decomp_sys        
00242     DecompositionSystem::EOutputLevel ds_olevel;
00243     switch(olevel) {
00244       case PRINT_NOTHING:
00245       case PRINT_BASIC_ALGORITHM_INFO:
00246         ds_olevel = DecompositionSystem::PRINT_NONE;
00247         break;
00248       case PRINT_ALGORITHM_STEPS:
00249       case PRINT_ACTIVE_SET:
00250         ds_olevel = DecompositionSystem::PRINT_BASIC_INFO;
00251         break;
00252       case PRINT_VECTORS:
00253         ds_olevel = DecompositionSystem::PRINT_VECTORS;
00254         break;
00255       case PRINT_ITERATION_QUANTITIES:
00256         ds_olevel = DecompositionSystem::PRINT_EVERY_THING;
00257         break;
00258       default:
00259         TEST_FOR_EXCEPT(true); // Should not get here!
00260     };
00261 
00262     // Test the decomposition system
00263     if( ds_test_what == DecompositionSystem::RUN_TESTS ) {
00264       // Set the output level
00265       if( decomp_sys_tester().print_tests() == DecompositionSystemTester::PRINT_NOT_SELECTED ) {
00266         DecompositionSystemTester::EPrintTestLevel  ds_olevel;
00267         switch(olevel) {
00268           case PRINT_NOTHING:
00269           case PRINT_BASIC_ALGORITHM_INFO:
00270             ds_olevel = DecompositionSystemTester::PRINT_NONE;
00271             break;
00272           case PRINT_ALGORITHM_STEPS:
00273           case PRINT_ACTIVE_SET:
00274             ds_olevel = DecompositionSystemTester::PRINT_BASIC;
00275             break;
00276           case PRINT_VECTORS:
00277             ds_olevel = DecompositionSystemTester::PRINT_MORE;
00278             break;
00279           case PRINT_ITERATION_QUANTITIES:
00280             ds_olevel = DecompositionSystemTester::PRINT_ALL;
00281             break;
00282           default:
00283             TEST_FOR_EXCEPT(true); // Should not get here!
00284         }
00285         decomp_sys_tester().print_tests(ds_olevel);
00286         decomp_sys_tester().dump_all( olevel == PRINT_ITERATION_QUANTITIES );
00287       }
00288       // Run the tests
00289       if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00290         out << "\nTesting the range/null decompostion ...\n";
00291       }
00292       const bool
00293         decomp_sys_passed = decomp_sys_tester().test_decomp_system(
00294           s.decomp_sys()
00295           ,Gc_iq->get_k(0)                   // Gc
00296           ,Z_iq ? &Z_iq->get_k(0) : NULL     // Z
00297           ,&Y_iq->get_k(0)                   // Y
00298           ,&R_iq->get_k(0)                   // R
00299           ,m > r  ? &Uz_iq->get_k(0) : NULL  // Uz
00300           ,m > r  ? &Uy_iq->get_k(0) : NULL  // Uy
00301           ,( olevel >= PRINT_ALGORITHM_STEPS ) ? &out : NULL
00302           );
00303       TEST_FOR_EXCEPTION(
00304         !decomp_sys_passed, TestFailed
00305         ,"EvalNewPointStd_Step::do_step(...) : Error, "
00306         "the tests of the decomposition system failed!" );
00307     }
00308   }
00309   else {
00310     // Unconstrained problem
00311     Z_iq = &s.Z();
00312     dyn_cast<MatrixSymIdent>(Z_iq->set_k(0)).initialize( nlp.space_x() );
00313     s.equ_decomp(Range1D::Invalid);
00314     s.equ_undecomp(Range1D::Invalid);
00315   }
00316 
00317   // Calculate the rest of the quantities.  If decomp_sys is a variable
00318   // reduction decomposition system object, then nlp will be hip to the
00319   // basis selection and will permute these quantities to that basis.
00320   // Note that x will already be permuted to the current basis.
00321   if(!Gf_k_updated) { nlp.calc_Gf( x, new_point ); new_point = false; }
00322   if( m && (!c_k_updated || new_decomp_selected ) ) {
00323     if(c_k_updated) nlp.set_c( &c_iq->set_k(0) ); // This was not set earlier!
00324     nlp.calc_c( x, false);
00325   }
00326   if(!f_k_updated) {
00327     nlp.calc_f( x, false);
00328   }
00329   nlp.unset_quantities();
00330   
00331   // Check for NaN and Inf
00332   assert_print_nan_inf(f_iq.get_k(0),"f_k",true,&out); 
00333   if(m)
00334     assert_print_nan_inf(c_iq->get_k(0),"c_k",true,&out); 
00335   assert_print_nan_inf(Gf_iq.get_k(0),"Gf_k",true,&out); 
00336   
00337   // Print the iteration quantities before we test the derivatives for debugging
00338 
00339   // Update the selection of dependent and independent variables
00340   if( s.get_decomp_sys().get() ) {
00341     const ConstrainedOptPack::DecompositionSystemVarReduct
00342       *decomp_sys_vr = dynamic_cast<ConstrainedOptPack::DecompositionSystemVarReduct*>(&s.decomp_sys());
00343     if(decomp_sys_vr) {
00344       var_dep   = decomp_sys_vr->var_dep();
00345       var_indep = decomp_sys_vr->var_indep();
00346     }
00347   }
00348   
00349   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00350     out << "\nPrinting the updated iteration quantities ...\n";
00351   }
00352 
00353   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
00354     out << "\nf_k                      = "     << f_iq.get_k(0);
00355     out << "\n||Gf_k||inf              = "     << Gf_iq.get_k(0).norm_inf();
00356     if( var_dep.size() )
00357       out << "\n||Gf_k(var_dep)_k||inf   = " << Gf_iq.get_k(0).sub_view(var_dep)->norm_inf();
00358     if( var_indep.size() )
00359       out << "\n||Gf_k(var_indep)_k||inf = " << Gf_iq.get_k(0).sub_view(var_indep)->norm_inf();
00360     if(m) {
00361       out << "\n||c_k||inf               = " << c_iq->get_k(0).norm_inf();
00362       if( calc_matrix_norms && !calc_matrix_info_null_space_only )
00363         out << "\n||Gc_k||inf              = " << Gc_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00364       if( n > r && calc_matrix_norms && !calc_matrix_info_null_space_only )
00365         out << "\n||Z||inf                 = " << Z_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00366       if( r && calc_matrix_norms && !calc_matrix_info_null_space_only )
00367         out << "\n||Y||inf                 = " << Y_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||R||inf                 = " << R_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00370       if( algo.algo_cntr().calc_conditioning() && !calc_matrix_info_null_space_only ) {
00371         out << "\ncond_inf(R)              = " << R_iq->get_k(0).calc_cond_num(mat_nrm_inf).value;
00372       }
00373       if( m > r && calc_matrix_norms && !calc_matrix_info_null_space_only ) {
00374         out << "\n||Uz_k||inf              = " << Uz_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00375         out << "\n||Uy_k||inf              = " << Uy_iq->get_k(0).calc_norm(mat_nrm_inf).value;
00376       }
00377     }
00378     out << std::endl;
00379   }
00380 
00381   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ITERATION_QUANTITIES) ) {
00382     if(m)
00383       out << "\nGc_k =\n" << Gc_iq->get_k(0);
00384     if( n > r )
00385       out << "\nZ_k =\n" << Z_iq->get_k(0);
00386     if(r) {
00387       out << "\nY_k =\n" << Y_iq->get_k(0);
00388       out << "\nR_k =\n" << R_iq->get_k(0);
00389     }
00390     if( m > r ) {
00391       out << "\nUz_k =\n" << Uz_iq->get_k(0);
00392       out << "\nUy_k =\n" << Uy_iq->get_k(0);
00393     }
00394   }
00395   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00396     out << "\nGf_k =\n" << Gf_iq.get_k(0);
00397     if( var_dep.size() )
00398       out << "\nGf(var_dep)_k =\n " << *Gf_iq.get_k(0).sub_view(var_dep);
00399   }
00400   if( static_cast<int>(ns_olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00401     if( var_indep.size() )
00402       out << "\nGf(var_indep)_k =\n" << *Gf_iq.get_k(0).sub_view(var_indep);
00403   }
00404   if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
00405     if(m)
00406       out << "\nc_k = \n" << c_iq->get_k(0);
00407   }
00408   
00409   // Check the derivatives if we are checking the results
00410   if(   fd_deriv_testing() == FD_TEST
00411     || ( fd_deriv_testing() == FD_DEFAULT && algo.algo_cntr().check_results() )  )
00412   {
00413     
00414     if( olevel >= PRINT_ALGORITHM_STEPS ) {
00415       out << "\n*** Checking derivatives by finite differences\n";
00416     }
00417 
00418     const bool
00419       nlp_passed = deriv_tester().finite_diff_check(
00420         &nlp
00421         ,x
00422         ,nb ? &nlp.xl() : NULL
00423         ,nb ? &nlp.xu() : NULL
00424         ,m  ? &Gc_iq->get_k(0) : NULL
00425         ,&Gf_iq.get_k(0)
00426         ,olevel >= PRINT_VECTORS
00427         ,( olevel >= PRINT_ALGORITHM_STEPS ) ? &out : NULL
00428         );
00429     TEST_FOR_EXCEPTION(
00430       !nlp_passed, TestFailed
00431       ,"EvalNewPointStd_Step::do_step(...) : Error, "
00432       "the tests of the nlp derivatives failed!" );
00433   }
00434 
00435   return true;
00436 }
00437 
00438 void EvalNewPointStd_Step::print_step(
00439    const Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
00440   ,poss_type assoc_step_poss, std::ostream& out, const std::string& L
00441   ) const
00442 {
00443   const NLPAlgo       &algo = rsqp_algo(_algo);
00444   const NLPAlgoState  &s    = algo.rsqp_state();
00445   const NLP           &nlp  = algo.nlp();
00446   const size_type
00447     m = nlp.m();
00448   out
00449     << L << "*** Evaluate the new point and update the range/null decomposition\n"
00450     << L << "if nlp is not initialized then initialize the nlp\n"
00451     << L << "if x is not updated for any k then set x_k = xinit\n";
00452   if(m) {
00453     out
00454       << L << "if Gc_k is not updated Gc_k = Gc(x_k) <: space_x|space_c\n"
00455       << L << "For Gc_k = [ Gc_k(:,equ_decomp), Gc_k(:,equ_undecomp) ] where:\n"
00456       << L << "  Gc_k(:,equ_decomp) <: space_x|space_c(equ_decomp) has full column rank r\n"
00457       << L << "Find:\n"
00458       << L << "  Z_k  <: space_x|space_null    s.t. Gc_k(:,equ_decomp)' * Z_k = 0\n"
00459       << L << "  Y_k  <: space_x|space_range   s.t. [Z_k Y_k] is nonsigular \n"
00460       << L << "  R_k  <: space_c(equ_decomp)|space_range\n"
00461       << L << "                                s.t. R_k = Gc_k(:,equ_decomp)' * Y_k\n"
00462       << L << "  if m > r : Uz_k <: space_c(equ_undecomp)|space_null\n"
00463       << L << "                                s.t. Uz_k = Gc_k(:,equ_undecomp)' * Z_k\n"
00464       << L << "  if m > r : Uy_k <: space_c(equ_undecomp)|space_range\n"
00465       << L << "                                s.t. Uy_k = Gc_k(:,equ_undecomp)' * Y_k\n"
00466       << L << "begin update decomposition (class \'" << typeid(decomp_sys_handler()).name() << "\')\n"
00467       ;
00468     decomp_sys_handler().print_update_decomposition( algo, s, out, L + "  " );
00469     out
00470       << L << "end update decomposition\n"
00471       << L << "if ( (decomp_sys_testing==DST_TEST)\n"
00472       << L << "  or (decomp_sys_testing==DST_DEFAULT and check_results==true)\n"
00473       << L << "  ) then\n"
00474       << L << "  check properties for Z_k, Y_k, R_k, Uz_k and Uy_k\n"
00475       << L << "end\n"
00476       ;
00477   }
00478   else {
00479     out 
00480       << L << "Z_k = eye(space_x)\n";
00481   }
00482   if(m) {
00483     out
00484       << L << "end\n";
00485   }
00486   out
00487     << L << "Gf_k = Gf(x_k) <: space_x\n"
00488     << L << "if m > 0 and c_k is not updated c_k = c(x_k) <: space_c\n"
00489     << L << "if f_k is not updated f_k = f(x_k) <: REAL\n"
00490     << L << "if ( (fd_deriv_testing==FD_TEST)\n"
00491     << L << "  or (fd_deriv_testing==FD_DEFAULT and check_results==true)\n"
00492     << L << "  ) then\n"
00493     << L << "  check Gc_k (if m > 0) and Gf_k by finite differences.\n"
00494     << L << "end\n"
00495     ;
00496 }
00497 
00498 } // end namespace MoochoPack

Generated on Thu Sep 18 12:34:27 2008 for MoochoPack : Framework for Large-Scale Optimization Algorithms by doxygen 1.3.9.1