|
MoochoPack : Framework for Large-Scale Optimization Algorithms Version of the Day
|
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 <assert.h> 00030 00031 #include <sstream> 00032 #include <typeinfo> 00033 #include <iostream> 00034 00035 #include "MoochoPack_NLPAlgoConfigIP.hpp" 00036 #include "NLPInterfacePack_NLPBarrier.hpp" 00037 #include "MoochoPack_NLPAlgo.hpp" 00038 #include "MoochoPack_IpState.hpp" 00039 #include "MoochoPack_NLPAlgoContainer.hpp" 00040 #include "AbstractLinAlgPack_MatrixSymPosDefCholFactor.hpp" // rHL 00041 //#include "ConstrainedOptPack_MatrixSymPosDefInvCholFactor.hpp" // . 00042 #include "ConstrainedOptPack_MatrixSymPosDefLBFGS.hpp" // . 00043 //#include "ConstrainedOptPack_MatrixHessianSuperBasicInitDiagonal.hpp/ | rHL (super basics) 00044 #include "AbstractLinAlgPack_MatrixSymDiagStd.hpp" // | 00045 00046 #include "NLPInterfacePack_NLPDirect.hpp" 00047 #include "NLPInterfacePack_NLPVarReductPerm.hpp" 00048 #include "NLPInterfacePack_CalcFiniteDiffProd.hpp" 00049 00050 // line search 00051 #include "ConstrainedOptPack_DirectLineSearchArmQuad_Strategy.hpp" 00052 #include "ConstrainedOptPack_DirectLineSearchArmQuad_StrategySetOptions.hpp" 00053 #include "ConstrainedOptPack_MeritFuncNLPL1.hpp" 00054 #include "ConstrainedOptPack_MeritFuncNLPModL1.hpp" 00055 00056 // Basis permutations and direct sparse solvers 00057 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS 00058 #include "ConstrainedOptPack_DecompositionSystemVarReductPerm.hpp" 00059 #endif 00060 00061 #include "MoochoPack_MoochoAlgorithmStepNames.hpp" 00062 00063 #include "MoochoPack_UpdateBarrierParameter_Step.hpp" 00064 00065 #include "MoochoPack_PreEvalNewPointBarrier_Step.hpp" 00066 #include "MoochoPack_PostEvalNewPointBarrier_Step.hpp" 00067 #include "MoochoPack_ReducedGradientStd_Step.hpp" 00068 //#include "MoochoPack_InitFinDiffReducedHessian_Step.hpp" 00069 //#include "MoochoPack_InitFinDiffReducedHessian_StepSetOptions.hpp" 00070 #include "MoochoPack_ReducedHessianSecantUpdateStd_Step.hpp" 00071 #include "MoochoPack_ReducedHessianSecantUpdateBFGSFull_Strategy.hpp" 00072 //#include "MoochoPack_ReducedHessianSecantUpdateBFGSProjected_Strategy.hpp" 00073 //#include "MoochoPack_ReducedHessianSecantUpdateBFGSProjected_StrategySetOptions.hpp" 00074 //#include "MoochoPack_ReducedHessianSecantUpdateLPBFGS_Strategy.hpp" 00075 //#include "MoochoPack_ReducedHessianSecantUpdateLPBFGS_StrategySetOptions.hpp" 00076 #include "MoochoPack_BFGSUpdate_Strategy.hpp" 00077 #include "MoochoPack_BFGSUpdate_StrategySetOptions.hpp" 00078 #include "MoochoPack_QuasiNormalStepStd_Step.hpp" 00079 #include "MoochoPack_CheckDescentQuasiNormalStep_Step.hpp" 00080 #include "MoochoPack_CheckDecompositionFromPy_Step.hpp" 00081 #include "MoochoPack_CheckDecompositionFromRPy_Step.hpp" 00082 #include "MoochoPack_TangentialStepIP_Step.hpp" 00083 //#include "MoochoPack_TangentialStepWithoutBounds_Step.hpp" 00084 //#include "MoochoPack_TangentialStepWithInequStd_Step.hpp" 00085 //#include "MoochoPack_TangentialStepWithInequStd_StepSetOptions.hpp" 00086 //#include "MoochoPack_SetDBoundsStd_AddedStep.hpp" 00087 #include "MoochoPack_QPFailureReinitReducedHessian_Step.hpp" 00088 #include "MoochoPack_CalcDFromYPYZPZ_Step.hpp" 00089 #include "MoochoPack_CalcD_vStep_Step.hpp" 00090 00091 #include "MoochoPack_PreProcessBarrierLineSearch_Step.hpp" 00092 #include "MoochoPack_PostProcessBarrierLineSearch_Step.hpp" 00093 #include "MoochoPack_LineSearchFailureNewDecompositionSelection_Step.hpp" 00094 #include "MoochoPack_LineSearchFilter_Step.hpp" 00095 #include "MoochoPack_LineSearchFilter_StepSetOptions.hpp" 00096 #include "MoochoPack_LineSearchFullStep_Step.hpp" 00097 #include "MoochoPack_LineSearchDirect_Step.hpp" 00098 //#include "MoochoPack_LineSearch2ndOrderCorrect_Step.hpp" 00099 //#include "MoochoPack_LineSearch2ndOrderCorrect_StepSetOptions.hpp" 00100 //#include "MoochoPack_FeasibilityStepReducedStd_Strategy.hpp" 00101 //#include "MoochoPack_FeasibilityStepReducedStd_StrategySetOptions.hpp" 00102 //#include "MoochoPack_QuasiRangeSpaceStepStd_Strategy.hpp" 00103 //#include "MoochoPack_QuasiRangeSpaceStepTailoredApproach_Strategy.hpp" 00104 //#include "MoochoPack_LineSearchWatchDog_Step.hpp" 00105 //#include "MoochoPack_LineSearchWatchDog_StepSetOptions.hpp" 00106 //#include "MoochoPack_LineSearchFullStepAfterKIter_Step.hpp" 00107 //#include "MoochoPack_CalcLambdaIndepStd_AddedStep.hpp" 00108 #include "MoochoPack_CalcReducedGradLagrangianStd_AddedStep.hpp" 00109 #include "MoochoPack_CheckConvergenceStd_AddedStep.hpp" 00110 #include "MoochoPack_CheckConvergenceIP_Strategy.hpp" 00111 #include "MoochoPack_CheckSkipBFGSUpdateStd_StepSetOptions.hpp" 00112 #include "MoochoPack_MeritFunc_PenaltyParamUpdate_AddedStepSetOptions.hpp" 00113 #include "MoochoPack_MeritFunc_PenaltyParamUpdateMultFree_AddedStep.hpp" 00114 //#include "MoochoPack_MeritFunc_PenaltyParamUpdateWithMult_AddedStep.hpp" 00115 //#include "MoochoPack_MeritFunc_PenaltyParamsUpdateWithMult_AddedStep.hpp" 00116 //#include "MoochoPack_MeritFunc_ModifiedL1LargerSteps_AddedStep.hpp" 00117 //#include "MoochoPack_MeritFunc_ModifiedL1LargerSteps_AddedStepSetOptions.hpp" 00118 //#include "MoochoPack_ActSetStats_AddedStep.hpp" 00119 //#include "MoochoPack_NumFixedDepIndep_AddedStep.hpp" 00120 #include "MoochoPack_UpdateReducedSigma_Step.hpp" 00121 00122 #include "MoochoPack_quasi_newton_stats.hpp" 00123 00124 // Misc utilities 00125 #include "Teuchos_AbstractFactoryStd.hpp" 00126 #include "Teuchos_dyn_cast.hpp" 00127 #include "ReleaseResource_ref_count_ptr.hpp" 00128 #include "Teuchos_TestForException.hpp" 00129 00130 // Stuff to read in options 00131 #include "OptionsFromStreamPack_StringToIntMap.hpp" 00132 #include "OptionsFromStreamPack_StringToBool.hpp" 00133 00134 // Stuff for exact reduced hessian 00135 //#include "MoochoPack_ReducedHessianExactStd_Step.hpp" 00136 //#include "MoochoPack_CrossTermExactStd_Step.hpp" 00137 //#include "MoochoPack_DampenCrossTermStd_Step.hpp" 00138 00139 namespace { 00140 const double INF_BASIS_COND_CHANGE_FRAC = 1e+20; 00141 } 00142 00143 namespace MoochoPack { 00144 00145 // 00146 // Here is where we define the default values for the algorithm. These 00147 // should agree with what are in the Moocho.opt.NLPAlgoConfigIP file. 00148 // 00149 NLPAlgoConfigIP::SOptionValues::SOptionValues() 00150 :max_basis_cond_change_frac_(-1.0) 00151 ,exact_reduced_hessian_(false) 00152 ,quasi_newton_(QN_AUTO) 00153 ,num_lbfgs_updates_stored_(-1) 00154 ,lbfgs_auto_scaling_(true) 00155 ,hessian_initialization_(INIT_HESS_AUTO) 00156 ,qp_solver_type_(QP_AUTO) 00157 ,reinit_hessian_on_qp_fail_(true) 00158 ,line_search_method_(LINE_SEARCH_AUTO) 00159 ,merit_function_type_(MERIT_FUNC_AUTO) 00160 ,l1_penalty_param_update_(L1_PENALTY_PARAM_AUTO) 00161 ,full_steps_after_k_(-1) 00162 {} 00163 00164 NLPAlgoConfigIP::NLPAlgoConfigIP() 00165 {} 00166 00167 NLPAlgoConfigIP::~NLPAlgoConfigIP() 00168 {} 00169 00170 // overridden from NLPAlgoConfig 00171 00172 void NLPAlgoConfigIP::set_options( const options_ptr_t& options ) 00173 { 00174 options_ = options; 00175 decomp_sys_step_builder_.set_options(options); 00176 } 00177 00178 const NLPAlgoConfig::options_ptr_t& 00179 NLPAlgoConfigIP::get_options() const 00180 { 00181 return options_; 00182 } 00183 00184 void NLPAlgoConfigIP::config_algo_cntr( 00185 NLPAlgoContainer *algo_cntr 00186 ,std::ostream *trase_out 00187 ) 00188 { 00189 00190 using Teuchos::RCP; 00191 using Teuchos::dyn_cast; 00192 using Teuchos::dyn_cast; 00193 00194 if(trase_out) { 00195 *trase_out 00196 << std::endl 00197 << "*****************************************************************\n" 00198 << "*** NLPAlgoConfigIP configuration ***\n" 00199 << "*** ***\n" 00200 << "*** Here, summary information about how the algorithm is ***\n" 00201 << "*** configured is printed so that the user can see how the ***\n" 00202 << "*** properties of the NLP and the set options influence ***\n" 00203 << "*** how an algorithm is configured. ***\n" 00204 << "*****************************************************************\n"; 00205 } 00206 00207 // //////////////////////////////////////////////////////////// 00208 // A. ??? 00209 00210 // ///////////////////////////////////////////////////////////////////////// 00211 // B. Create an algo object, give to algo_cntr, then give algo_cntr to algo 00212 00213 if(trase_out) 00214 *trase_out << "\n*** Creating the NLPAlgo algo object ...\n"; 00215 00216 typedef Teuchos::RCP<NLPAlgo> algo_ptr_t; 00217 algo_ptr_t algo = Teuchos::rcp(new NLPAlgo); 00218 TEST_FOR_EXCEPT( !( algo.get() ) ); 00219 algo_cntr->set_algo(algo); 00220 algo->set_algo_cntr(algo_cntr); 00221 00222 // ///////////////////////////////////////////// 00223 // C. Configure algo 00224 00225 // ///////////////////////////////////////////////////// 00226 // C.0 Set the nlp and track objects 00227 00228 if(trase_out) 00229 *trase_out << "\n*** Setting the NLP and track objects to the algo object ...\n"; 00230 00231 algo->set_nlp( algo_cntr->get_nlp().get() ); 00232 algo->set_track( algo_cntr->get_track() ); 00233 00234 // //////////////////////////////////////////////// 00235 // Determine what the options are: 00236 00237 // Readin the options 00238 if(options_.get()) { 00239 readin_options( *options_, &uov_, trase_out ); 00240 } 00241 else { 00242 if(trase_out) { 00243 *trase_out 00244 << "\n*** Warning, no OptionsFromStream object was set so a default set" 00245 " of options will be used!\n"; 00246 } 00247 } 00248 00249 NLP &nlp = algo->nlp(); 00250 nlp.initialize(algo->algo_cntr().check_results()); 00251 // Get the dimensions of the NLP 00252 const size_type 00253 n = nlp.n(), 00254 m = nlp.m(), 00255 r = m, // ToDo: Compute this for real! 00256 //dof = n - r, 00257 nb = nlp.num_bounded_x(); 00258 00259 // Process the NLP 00260 NLPFirstOrder *nlp_foi = NULL; 00261 NLPSecondOrder *nlp_soi = NULL; 00262 NLPDirect *nlp_fod = NULL; 00263 bool tailored_approach = false; 00264 decomp_sys_step_builder_.process_nlp_and_options( 00265 trase_out, nlp 00266 ,&nlp_foi, &nlp_soi, &nlp_fod, &tailored_approach 00267 ); 00268 00269 const int max_dof_quasi_newton_dense 00270 = decomp_sys_step_builder_.current_option_values().max_dof_quasi_newton_dense_; 00271 00272 // Make sure that we can handle this type of NLP currently 00273 TEST_FOR_EXCEPTION( 00274 m == 0, std::logic_error 00275 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 00276 "can not currently solve an unconstrained NLP!" ); 00277 TEST_FOR_EXCEPTION( 00278 n == m, std::logic_error 00279 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 00280 "can not currently solve a square system of equations!" ); 00281 00282 // ////////////////////////////////////////////////////// 00283 // C.1. Sort out the options 00284 00285 if(trase_out) 00286 *trase_out 00287 << "\n*** Sorting out some of the options given input options ...\n"; 00288 00289 if( tailored_approach ) { 00290 // Change the options for the tailored approach. 00291 if(trase_out) { 00292 *trase_out 00293 << "\nThis is a tailored approach NLP (NLPDirect) which forces the following options:\n" 00294 << "merit_function_type = L1;\n" 00295 << "l1_penalty_parameter_update = MULT_FREE;\n" 00296 << "null_space_matrix = EXPLICIT;\n" 00297 ; 00298 } 00299 cov_.merit_function_type_ 00300 = MERIT_FUNC_L1; 00301 cov_.l1_penalty_param_update_ 00302 = L1_PENALTY_PARAM_MULT_FREE; 00303 decomp_sys_step_builder_.current_option_values().null_space_matrix_type_ 00304 = DecompositionSystemStateStepBuilderStd::NULL_SPACE_MATRIX_EXPLICIT; 00305 } 00306 00307 if( !tailored_approach && uov_.merit_function_type_ != MERIT_FUNC_L1 ) { 00308 if(trase_out) { 00309 *trase_out 00310 << "\nThe only merit function currently supported is:\n" 00311 << "merit_function_type = L1;\n" 00312 ; 00313 } 00314 cov_.merit_function_type_ = MERIT_FUNC_L1; 00315 } 00316 00317 // Decide what type of quasi newton update to use 00318 switch( uov_.quasi_newton_ ) { 00319 case QN_AUTO: { 00320 if(trase_out) 00321 *trase_out 00322 << "\nquasi_newton == AUTO:" 00323 << "\nnlp.num_bounded_x() == " << nlp.num_bounded_x() << ":\n"; 00324 //if( n - r > cov_.max_dof_quasi_newton_dense_ ) { 00325 // if(trase_out) 00326 // *trase_out 00327 // << "n-r = " << n-r << " > max_dof_quasi_newton_dense = " 00328 // << cov_.max_dof_quasi_newton_dense_ << ":\n" 00329 // << "setting quasi_newton == LBFGS\n"; 00330 // cov_.quasi_newton_ = QN_LBFGS; 00331 //} 00332 //else { 00333 if(trase_out) 00334 *trase_out 00335 << "n-r = " << n-r << " <= max_dof_quasi_newton_dense = " 00336 << max_dof_quasi_newton_dense << ":\n" 00337 << "setting quasi_newton == BFGS\n"; 00338 cov_.quasi_newton_ = QN_BFGS; 00339 //} 00340 break; 00341 } 00342 case QN_BFGS: 00343 case QN_PBFGS: 00344 case QN_LBFGS: 00345 case QN_LPBFGS: 00346 cov_.quasi_newton_ = uov_.quasi_newton_; 00347 break; 00348 default: 00349 TEST_FOR_EXCEPT(true); // Invalid option! 00350 } 00351 00352 // ToDo: Sort out the rest of the options! 00353 00354 // Set the default options that where not already set yet 00355 set_default_options(uov_,&cov_,trase_out); 00356 00357 // ToDo: Implement the 2nd order correction linesearch 00358 if( cov_.line_search_method_ == LINE_SEARCH_2ND_ORDER_CORRECT ) { 00359 if(trase_out) 00360 *trase_out << 00361 "\nline_search_method == 2ND_ORDER_CORRECT:\n" 00362 "Sorry, the second order corrrection linesearch is not updated yet!\n" 00363 "setting line_search_method = DIRECT ...\n"; 00364 cov_.line_search_method_ = LINE_SEARCH_DIRECT; 00365 } 00366 if( cov_.line_search_method_ == LINE_SEARCH_WATCHDOG ) { 00367 if(trase_out) 00368 *trase_out << 00369 "\nline_search_method ==WATCHDOG:\n" 00370 "Sorry, the watchdog linesearch is not updated yet!\n" 00371 "setting line_search_method = DIRECT ...\n"; 00372 cov_.line_search_method_ = LINE_SEARCH_DIRECT; 00373 } 00374 00375 // ///////////////////////////////////////////////////// 00376 // C.1. Create the decomposition system object 00377 00378 typedef RCP<DecompositionSystem> decomp_sys_ptr_t; 00379 decomp_sys_ptr_t decomp_sys; 00380 decomp_sys_step_builder_.create_decomp_sys( 00381 trase_out, nlp, nlp_foi, nlp_soi, nlp_fod, tailored_approach 00382 ,&decomp_sys 00383 ); 00384 00385 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS 00386 RCP<DecompositionSystemVarReductPerm> 00387 decomp_sys_perm = Teuchos::rcp_dynamic_cast<DecompositionSystemVarReductPerm>(decomp_sys); 00388 #endif 00389 00390 // ///////////////////////////////////////////////////// 00391 // C.2. Create and set the state object 00392 00393 if(trase_out) 00394 *trase_out 00395 << "\n*** Creating the state object and setting up iteration quantity objects ...\n"; 00396 00397 { 00398 // 00399 // Create the state object with the vector spaces 00400 // 00401 00402 typedef RCP<IpState> state_ptr_t; 00403 state_ptr_t 00404 state = Teuchos::rcp( 00405 new IpState( 00406 decomp_sys 00407 ,nlp.space_x() 00408 ,nlp.space_c() 00409 ,( tailored_approach 00410 ? ( nlp_fod->var_dep().size() 00411 ? nlp.space_x()->sub_space(nlp_fod->var_dep())->clone() 00412 : Teuchos::null ) 00413 : decomp_sys->space_range() // could be NULL for BasisSystemPerm 00414 ) 00415 ,( tailored_approach 00416 ?( nlp_fod->var_indep().size() 00417 ? nlp.space_x()->sub_space(nlp_fod->var_indep())->clone() 00418 : Teuchos::null ) 00419 : decomp_sys->space_null() // could be NULL for BasisSystemPerm 00420 ) 00421 ) 00422 ); 00423 00424 // 00425 // Set the iteration quantities for the NLP matrix objects 00426 // 00427 00428 decomp_sys_step_builder_.add_iter_quantities( 00429 trase_out, nlp, nlp_foi, nlp_soi, nlp_fod, tailored_approach, decomp_sys 00430 ,state 00431 ); 00432 00434 // Set the iteration quantities for the barrier terms 00436 state->set_iter_quant( 00437 Vu_name 00438 ,Teuchos::rcp( 00439 new IterQuantityAccessContiguous<MatrixSymDiagStd>( 00440 1, 00441 Vu_name, 00442 Teuchos::rcp( new Teuchos::AbstractFactoryStd<MatrixSymDiagStd,MatrixSymDiagStd, 00443 MatrixSymDiagStd::PostMod>( nlp.space_x() ) 00444 ) 00445 ) 00446 ) 00447 ); 00448 00449 state->set_iter_quant( 00450 Vl_name 00451 ,Teuchos::rcp( 00452 new IterQuantityAccessContiguous<MatrixSymDiagStd>( 00453 1, 00454 Vl_name, 00455 Teuchos::rcp( new Teuchos::AbstractFactoryStd<MatrixSymDiagStd,MatrixSymDiagStd, 00456 MatrixSymDiagStd::PostMod>( nlp.space_x() ) 00457 ) 00458 ) 00459 ) 00460 ); 00461 00462 state->set_iter_quant( 00463 invXu_name 00464 ,Teuchos::rcp( 00465 new IterQuantityAccessContiguous<MatrixSymDiagStd>( 00466 1, 00467 invXu_name, 00468 Teuchos::rcp( new Teuchos::AbstractFactoryStd<MatrixSymDiagStd,MatrixSymDiagStd, 00469 MatrixSymDiagStd::PostMod>( nlp.space_x() ) 00470 ) 00471 ) 00472 ) 00473 ); 00474 00475 state->set_iter_quant( 00476 invXl_name 00477 ,Teuchos::rcp( 00478 new IterQuantityAccessContiguous<MatrixSymDiagStd>( 00479 1, 00480 invXl_name, 00481 Teuchos::rcp( new Teuchos::AbstractFactoryStd<MatrixSymDiagStd,MatrixSymDiagStd, 00482 MatrixSymDiagStd::PostMod>( nlp.space_x() ) 00483 ) 00484 ) 00485 ) 00486 ); 00487 00488 state->set_iter_quant( 00489 rHB_name 00490 ,Teuchos::rcp( 00491 new IterQuantityAccessContiguous<MatrixSymOp>( 00492 1, 00493 rHB_name, 00494 Teuchos::rcp( 00495 new Teuchos::AbstractFactoryStd<MatrixSymOp,MatrixSymPosDefCholFactor,MatrixSymPosDefCholFactor::PostMod>( 00496 MatrixSymPosDefCholFactor::PostMod( 00497 true // maintain_original 00498 ,false // maintain_factor 00499 ,true // allow_factor (always!) 00500 ) 00501 ) 00502 ) 00503 ) 00504 ) 00505 ); 00506 00507 state->set_iter_quant( 00508 B_name 00509 ,Teuchos::rcp( 00510 new IterQuantityAccessContiguous<MatrixSymOp>( 00511 1, 00512 B_name, 00513 Teuchos::rcp( 00514 new Teuchos::AbstractFactoryStd<MatrixSymOp,MatrixSymPosDefCholFactor,MatrixSymPosDefCholFactor::PostMod>( 00515 MatrixSymPosDefCholFactor::PostMod( 00516 true // maintain_original 00517 ,false // maintain_factor 00518 ,true // allow_factor (always!) 00519 ) 00520 ) 00521 ) 00522 ) 00523 ) 00524 ); 00525 00526 state->set_iter_quant( 00527 Sigma_name 00528 ,Teuchos::rcp( 00529 new IterQuantityAccessContiguous<MatrixSymDiagStd>( 00530 1, 00531 Sigma_name, 00532 Teuchos::rcp( new Teuchos::AbstractFactoryStd<MatrixSymDiagStd,MatrixSymDiagStd, 00533 MatrixSymDiagStd::PostMod>( nlp.space_x() ) 00534 ) 00535 ) 00536 ) 00537 ); 00538 00539 // These iteration quantities are defined in IpState, 00540 // force their creation and resize them 00541 dyn_cast< IterQuantityAccessContiguous<value_type> >(state->barrier_obj()).resize(2); 00542 dyn_cast< IterQuantityAccessContiguous<VectorMutable> >(state->grad_barrier_obj()).resize(2); 00543 00544 // Add reduced Hessian of the Lagrangian 00545 00546 if( !cov_.exact_reduced_hessian_ ) { 00547 RCP<Teuchos::AbstractFactory<MatrixSymOp> > 00548 abstract_factory_rHL = Teuchos::rcp( 00549 new Teuchos::AbstractFactoryStd<MatrixSymOp,MatrixSymPosDefCholFactor,MatrixSymPosDefCholFactor::PostMod>( 00550 MatrixSymPosDefCholFactor::PostMod( 00551 true // maintain_original 00552 ,false // maintain_factor 00553 ,true // allow_factor (always!) 00554 ) 00555 ) 00556 ); 00557 state->set_iter_quant( 00558 rHL_name 00559 ,Teuchos::rcp( 00560 new IterQuantityAccessContiguous<MatrixSymOp>( 00561 1 00562 ,rHL_name 00563 ,abstract_factory_rHL 00564 ) 00565 ) 00566 ); 00567 } 00568 else { 00569 TEST_FOR_EXCEPT(true); // ToDo: Add rHL for an exact reduced Hessian! 00570 } 00571 00572 // 00573 // Set the NLP merit function 00574 // 00575 00576 if( cov_.line_search_method_ != LINE_SEARCH_NONE 00577 && cov_.line_search_method_ != LINE_SEARCH_FILTER) { 00578 RCP<Teuchos::AbstractFactory<MeritFuncNLP> > 00579 merit_func_factory = Teuchos::null; 00580 switch( cov_.merit_function_type_ ) { 00581 case MERIT_FUNC_L1: 00582 merit_func_factory = Teuchos::rcp( 00583 new Teuchos::AbstractFactoryStd<MeritFuncNLP,MeritFuncNLPL1>()); 00584 break; 00585 case MERIT_FUNC_MOD_L1: 00586 case MERIT_FUNC_MOD_L1_INCR: 00587 merit_func_factory = Teuchos::rcp( 00588 new Teuchos::AbstractFactoryStd<MeritFuncNLP,MeritFuncNLPModL1>()); 00589 break; 00590 default: 00591 TEST_FOR_EXCEPT(true); // local programming error 00592 } 00593 state->set_iter_quant( 00594 merit_func_nlp_name 00595 ,Teuchos::rcp( 00596 new IterQuantityAccessContiguous<MeritFuncNLP>( 00597 1 00598 ,merit_func_nlp_name 00599 ,merit_func_factory 00600 ) 00601 ) 00602 ); 00603 } 00604 00605 if (cov_.line_search_method_ == LINE_SEARCH_FILTER) 00606 { 00607 // Add the filter iteration quantity 00608 state->set_iter_quant( 00609 FILTER_IQ_STRING 00610 ,Teuchos::rcp( 00611 new IterQuantityAccessContiguous<Filter_T>(1,FILTER_IQ_STRING) 00612 ) 00613 ); 00614 } 00615 00616 // 00617 // Resize the number of storage locations (these can be changed later). 00618 // 00619 // Also, touch all of the value_type, index_type and vector iteration quantities 00620 // that we know about so that when state.dump_iter_quant() is called, all of the 00621 // iteration quantities will be included. 00622 // 00623 00624 typedef IterQuantityAccessContiguous<value_type> IQ_scalar_cngs; 00625 typedef IterQuantityAccessContiguous<VectorMutable> IQ_vector_cngs; 00626 00627 dyn_cast<IQ_vector_cngs>(state->x()).resize(2); 00628 dyn_cast<IQ_scalar_cngs>(state->f()).resize(2); 00629 if(m) dyn_cast<IQ_vector_cngs>(state->c()).resize(2); 00630 dyn_cast<IQ_vector_cngs>(state->Gf()).resize(2); 00631 if(m && nlp_foi) state->Gc(); 00632 00633 if( m 00634 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS 00635 && decomp_sys_perm.get() == NULL 00636 #endif 00637 ) state->py(); 00638 if(m) dyn_cast<IQ_vector_cngs>(state->Ypy()).resize(2); 00639 if( m 00640 #ifndef MOOCHO_NO_BASIS_PERM_DIRECT_SOLVERS 00641 && decomp_sys_perm.get() == NULL 00642 #endif 00643 ) state->pz(); 00644 if(m) dyn_cast<IQ_vector_cngs>(state->Zpz()).resize(2); 00645 dyn_cast<IQ_vector_cngs>(state->d()).resize(2); 00646 00647 if( n > m ) { 00648 dyn_cast<IQ_vector_cngs>(state->rGf()).resize(2); 00649 state->w(); 00650 state->zeta(); 00651 state->qp_grad(); 00652 } 00653 state->eta(); 00654 00655 dyn_cast<IQ_scalar_cngs>(state->barrier_parameter()).resize(2); 00656 00657 dyn_cast<IQ_scalar_cngs>(state->alpha()).resize(2); 00658 dyn_cast<IQ_scalar_cngs>(state->mu()).resize(2); 00659 dyn_cast<IQ_scalar_cngs>(state->phi()).resize(2); 00660 00661 dyn_cast<IQ_scalar_cngs>(state->opt_kkt_err()).resize(2); 00662 dyn_cast<IQ_scalar_cngs>(state->feas_kkt_err()).resize(2); 00663 if( n > m ) { 00664 dyn_cast<IQ_vector_cngs>(state->rGL()).resize(2); 00665 } 00666 if(m) dyn_cast<IQ_vector_cngs>(state->lambda()).resize(2); 00667 dyn_cast<IQ_vector_cngs>(state->nu()).resize(2); 00668 00669 // Set the state object 00670 algo->set_state( state ); 00671 } 00672 00673 // ///////////////////////////////////////////////////// 00674 // C.3 Create and set the step objects 00675 00676 if(trase_out) 00677 *trase_out << "\n*** Creating and setting the step objects ...\n"; 00678 00679 { 00680 00681 // 00682 // Create some standard step objects that will be used by many different 00683 // specific algorithms 00684 // 00685 00686 typedef RCP<AlgorithmStep> algo_step_ptr_t; 00687 00688 // Create the EvalNewPoint step and associated objects 00689 algo_step_ptr_t eval_new_point_step = Teuchos::null; 00690 RCP<CalcFiniteDiffProd> calc_fd_prod = Teuchos::null; 00691 RCP<VariableBoundsTester> bounds_tester = Teuchos::null; 00692 RCP<NewDecompositionSelection_Strategy> new_decomp_selection_strategy = Teuchos::null; 00693 decomp_sys_step_builder_.create_eval_new_point( 00694 trase_out, nlp, nlp_foi, nlp_soi, nlp_fod, tailored_approach, decomp_sys 00695 ,&eval_new_point_step, &calc_fd_prod, &bounds_tester, &new_decomp_selection_strategy 00696 ); 00697 00698 // UpdateBarrierParameter_Step 00699 Teuchos::RCP<UpdateBarrierParameter_Step> updateBarrierParameter_step = Teuchos::null; 00700 updateBarrierParameter_step = Teuchos::rcp(new UpdateBarrierParameter_Step()); 00701 if(options_.get()) 00702 { 00703 UpdateBarrierParameter_StepSetOptions options_setter(updateBarrierParameter_step.get()); 00704 options_setter.set_options(*options_); 00705 } 00706 00707 // PreEvalNewPointBarrier_Step 00708 Teuchos::RCP<PreEvalNewPointBarrier_Step> preEvalNewPointBarrier_step = Teuchos::null; 00709 preEvalNewPointBarrier_step = Teuchos::rcp(new PreEvalNewPointBarrier_Step()); 00710 if(options_.get()) 00711 { 00712 PreEvalNewPointBarrier_StepSetOptions 00713 options_setter(preEvalNewPointBarrier_step.get()); 00714 options_setter.set_options(*options_); 00715 } 00716 00717 // PostEvalNewPointBarrier_Step 00718 algo_step_ptr_t postEvalNewPointBarrier_step = Teuchos::rcp(new PostEvalNewPointBarrier_Step()); 00719 00720 // ReducedGradient_Step 00721 algo_step_ptr_t reduced_gradient_step = Teuchos::null; 00722 if( !tailored_approach ) { 00723 reduced_gradient_step = Teuchos::rcp(new ReducedGradientStd_Step()); 00724 } 00725 00726 // RangeSpace_Step 00727 algo_step_ptr_t quasi_normal_step_step = Teuchos::null; 00728 if( !tailored_approach ) { 00729 quasi_normal_step_step = Teuchos::rcp(new QuasiNormalStepStd_Step()); 00730 } 00731 00732 // Check and change decomposition 00733 algo_step_ptr_t check_decomp_from_py_step = Teuchos::null; 00734 algo_step_ptr_t check_decomp_from_Rpy_step = Teuchos::null; 00735 if( new_decomp_selection_strategy.get() && cov_.max_basis_cond_change_frac_ < INF_BASIS_COND_CHANGE_FRAC ) { 00736 check_decomp_from_py_step = Teuchos::rcp( 00737 new CheckDecompositionFromPy_Step( 00738 new_decomp_selection_strategy 00739 ,cov_.max_basis_cond_change_frac_ 00740 ) ); 00741 check_decomp_from_Rpy_step = Teuchos::rcp( 00742 new CheckDecompositionFromRPy_Step( 00743 new_decomp_selection_strategy 00744 ,cov_.max_basis_cond_change_frac_ 00745 ) ); 00746 } 00747 00748 // CheckDescentQuasiNormalStep 00749 algo_step_ptr_t check_descent_quasi_normal_step_step = Teuchos::null; 00750 if( algo->algo_cntr().check_results() ) { 00751 check_descent_quasi_normal_step_step = Teuchos::rcp(new CheckDescentQuasiNormalStep_Step(calc_fd_prod)); 00752 } 00753 00754 // ReducedGradient_Step 00755 //algo_step_ptr_t reduced_gradient_step = Teuchos::null; 00756 //if( !tailored_approach ) { 00757 // reduced_gradient_step = Teuchos::rcp(new ReducedGradientStd_Step()); 00758 //} 00759 00760 // CheckSkipBFGSUpdate 00761 algo_step_ptr_t check_skip_bfgs_update_step = Teuchos::null; 00762 if(!cov_.exact_reduced_hessian_) { 00763 RCP<CheckSkipBFGSUpdateStd_Step> 00764 step = Teuchos::rcp(new CheckSkipBFGSUpdateStd_Step()); 00765 if(options_.get()) { 00766 CheckSkipBFGSUpdateStd_StepSetOptions 00767 opt_setter( step.get() ); 00768 opt_setter.set_options( *options_ ); 00769 } 00770 check_skip_bfgs_update_step = step; 00771 } 00772 00773 // ReducedHessian_Step 00774 algo_step_ptr_t reduced_hessian_step = Teuchos::null; 00775 { 00776 // Get the strategy object that will perform the actual secant update. 00777 RCP<ReducedHessianSecantUpdate_Strategy> 00778 secant_update_strategy = Teuchos::null; 00779 switch( cov_.quasi_newton_ ) 00780 { 00781 case QN_BFGS: 00782 case QN_PBFGS: 00783 case QN_LBFGS: 00784 case QN_LPBFGS: 00785 { 00786 // create and setup the actual BFGS strategy object 00787 typedef RCP<BFGSUpdate_Strategy> bfgs_strategy_ptr_t; 00788 bfgs_strategy_ptr_t 00789 bfgs_strategy = Teuchos::rcp(new BFGSUpdate_Strategy); 00790 if(options_.get()) { 00791 BFGSUpdate_StrategySetOptions 00792 opt_setter( bfgs_strategy.get() ); 00793 opt_setter.set_options( *options_ ); 00794 } 00795 switch( cov_.quasi_newton_ ) { 00796 case QN_BFGS: 00797 case QN_LBFGS: 00798 { 00799 secant_update_strategy = Teuchos::rcp(new ReducedHessianSecantUpdateBFGSFull_Strategy(bfgs_strategy)); 00800 break; 00801 } 00802 case QN_PBFGS: 00803 case QN_LPBFGS: 00804 { 00805 TEST_FOR_EXCEPTION( 00806 true, std::logic_error 00807 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 00808 "The quansi_newton options of PBFGS and LPBFGS have not been updated yet!" ); 00809 break; 00810 } 00811 } 00812 break; 00813 } 00814 default: 00815 TEST_FOR_EXCEPT(true); 00816 } 00817 00818 // Finally build the step object 00819 reduced_hessian_step = Teuchos::rcp( 00820 new ReducedHessianSecantUpdateStd_Step( secant_update_strategy ) ); 00821 // Add the QuasiNewtonStats iteration quantity 00822 algo->state().set_iter_quant( 00823 quasi_newton_stats_name 00824 ,Teuchos::rcp(new IterQuantityAccessContiguous<QuasiNewtonStats>( 00825 1 00826 ,quasi_newton_stats_name 00827 #ifdef _MIPS_CXX 00828 ,Teuchos::RCP<Teuchos::AbstractFactoryStd<QuasiNewtonStats,QuasiNewtonStats> >( 00829 new Teuchos::AbstractFactoryStd<QuasiNewtonStats,QuasiNewtonStats>()) 00830 #endif 00831 ) 00832 )); 00833 } 00834 00835 // UpdateReducedSigma_Step 00836 Teuchos::RCP<UpdateReducedSigma_Step> updateReducedSigma_step = Teuchos::null; 00837 updateReducedSigma_step = Teuchos::rcp(new UpdateReducedSigma_Step()); 00838 if(options_.get()) 00839 { 00840 UpdateReducedSigma_StepSetOptions 00841 options_setter(updateReducedSigma_step.get()); 00842 options_setter.set_options(*options_); 00843 } 00844 00845 // NullSpace_Step 00846 algo_step_ptr_t tangential_step = Teuchos::rcp(new TangentialStepIP_Step()); 00847 /* algo_step_ptr_t set_d_bounds_step = Teuchos::null; 00848 algo_step_ptr_t tangential_step_step = Teuchos::null; 00849 if( nb == 0 ) { 00850 tangential_step_step = Teuchos::rcp(new TangentialStepWithoutBounds_Step()); 00851 } 00852 else { 00853 // Step object that sets bounds for QP subproblem 00854 set_d_bounds_step = Teuchos::rcp(new SetDBoundsStd_AddedStep()); 00855 // QP Solver object 00856 Teuchos::RCP<QPSolverRelaxed> qp_solver = Teuchos::null; 00857 // ToDo: Create the QP solver! 00858 // QP solver tester 00859 Teuchos::RCP<QPSolverRelaxedTester> 00860 qp_solver_tester = Teuchos::rcp(new QPSolverRelaxedTester()); 00861 if(options_.get()) { 00862 QPSolverRelaxedTesterSetOptions 00863 opt_setter( qp_solver_tester.get() ); 00864 opt_setter.set_options( *options_ ); 00865 } 00866 // The null-space step 00867 Teuchos::RCP<TangentialStepWithInequStd_Step> 00868 tangential_step_with_inequ_step = Teuchos::rcp( 00869 new TangentialStepWithInequStd_Step( 00870 qp_solver, qp_solver_tester ) ); 00871 if(options_.get()) { 00872 TangentialStepWithInequStd_StepSetOptions 00873 opt_setter( tangential_step_with_inequ_step.get() ); 00874 opt_setter.set_options( *options_ ); 00875 } 00876 tangential_step_step = tangential_step_with_inequ_step; 00877 // Step for reinitialization reduced Hessian on QP failure 00878 tangential_step_step = Teuchos::rcp( 00879 new QPFailureReinitReducedHessian_Step(tangential_step_step) 00880 ); 00881 }*/ 00882 00883 // CalcDFromYPYZPZ_Step 00884 algo_step_ptr_t calc_d_from_Ypy_Zpy_step = Teuchos::null; 00885 { 00886 calc_d_from_Ypy_Zpy_step = Teuchos::rcp(new CalcDFromYPYZPZ_Step()); 00887 } 00888 00889 // CalcD_vStep_Step 00890 algo_step_ptr_t calc_d_v_step_step = Teuchos::rcp(new CalcD_vStep_Step()); 00891 00892 // build the barrier nlp decorator to be used by the line search 00893 Teuchos::RCP<NLPInterfacePack::NLPBarrier> barrier_nlp = Teuchos::rcp(new NLPInterfacePack::NLPBarrier()); 00894 barrier_nlp->InitializeFromNLP( algo_cntr->get_nlp() ); 00895 00896 // PreProcessBarrierLineSearch_Step 00897 algo_step_ptr_t preprocess_barrier_linesearch_step = Teuchos::rcp(new PreProcessBarrierLineSearch_Step(barrier_nlp)); 00898 00899 // PostProcessBarrierLineSearch_Step 00900 algo_step_ptr_t postprocess_barrier_linesearch_step = Teuchos::rcp(new PostProcessBarrierLineSearch_Step(barrier_nlp)); 00901 00902 // CalcReducedGradLagrangianStd_AddedStep 00903 algo_step_ptr_t calc_reduced_grad_lagr_step = Teuchos::null; 00904 { 00905 calc_reduced_grad_lagr_step = Teuchos::rcp( 00906 new CalcReducedGradLagrangianStd_AddedStep() ); 00907 } 00908 00909 // CheckConvergence_Step 00910 algo_step_ptr_t check_convergence_step = Teuchos::null; 00911 { 00912 // Create the strategy object 00913 RCP<CheckConvergenceIP_Strategy> 00914 check_convergence_strategy = Teuchos::rcp(new CheckConvergenceIP_Strategy()); 00915 00916 if(options_.get()) 00917 { 00918 CheckConvergence_StrategySetOptions 00919 opt_setter( check_convergence_strategy.get() ); 00920 opt_setter.set_options( *options_ ); 00921 } 00922 00923 RCP<CheckConvergenceStd_AddedStep> 00924 _check_convergence_step = Teuchos::rcp(new CheckConvergenceStd_AddedStep(check_convergence_strategy)); 00925 00926 check_convergence_step = _check_convergence_step; 00927 } 00928 00929 // MeritFuncPenaltyParamUpdate_Step 00930 algo_step_ptr_t merit_func_penalty_param_update_step = Teuchos::null; 00931 if( cov_.line_search_method_ == LINE_SEARCH_FILTER ) { 00932 // We don't need to update a penalty parameter for the filter method :-) 00933 } 00934 else if( cov_.line_search_method_ != LINE_SEARCH_NONE ) { 00935 RCP<MeritFunc_PenaltyParamUpdate_AddedStep> 00936 param_update_step = Teuchos::null; 00937 switch( cov_.merit_function_type_ ) { 00938 case MERIT_FUNC_L1: { 00939 switch(cov_.l1_penalty_param_update_) { 00940 case L1_PENALTY_PARAM_WITH_MULT: 00941 // param_update_step 00942 // = Teuchos::rcp(new MeritFunc_PenaltyParamUpdateWithMult_AddedStep()); 00943 TEST_FOR_EXCEPTION( 00944 true, std::logic_error 00945 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 00946 "The l1_penalty_parameter_update option of MULT_FREE has not been updated yet!" ); 00947 break; 00948 case L1_PENALTY_PARAM_MULT_FREE: 00949 param_update_step 00950 = Teuchos::rcp(new MeritFunc_PenaltyParamUpdateMultFree_AddedStep()); 00951 break; 00952 default: 00953 TEST_FOR_EXCEPT(true); 00954 } 00955 break; 00956 } 00957 case MERIT_FUNC_MOD_L1: 00958 case MERIT_FUNC_MOD_L1_INCR: 00959 // param_update_step = new MeritFunc_PenaltyParamsUpdateWithMult_AddedStep( 00960 // Teuchos::rcp_implicit_cast<MeritFuncNLP>(merit_func) ); 00961 TEST_FOR_EXCEPTION( 00962 true, std::logic_error 00963 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 00964 "The merit_function_type options of MODIFIED_L1 and MODIFIED_L1_INCR have not been updated yet!" ); 00965 break; 00966 default: 00967 TEST_FOR_EXCEPT(true); // local programming error 00968 } 00969 if(options_.get()) { 00970 MeritFunc_PenaltyParamUpdate_AddedStepSetOptions 00971 ppu_options_setter( param_update_step.get() ); 00972 ppu_options_setter.set_options( *options_ ); 00973 } 00974 merit_func_penalty_param_update_step = param_update_step; 00975 } 00976 00977 // LineSearch_Step 00978 algo_step_ptr_t line_search_full_step_step = Teuchos::null; 00979 { 00980 line_search_full_step_step = Teuchos::rcp(new LineSearchFullStep_Step(bounds_tester)); 00981 } 00982 00983 // LineSearch_Step 00984 algo_step_ptr_t line_search_step = Teuchos::null; 00985 if( cov_.line_search_method_ != LINE_SEARCH_NONE ) { 00986 RCP<DirectLineSearchArmQuad_Strategy> 00987 direct_line_search = Teuchos::rcp(new DirectLineSearchArmQuad_Strategy()); 00988 if(options_.get()) { 00989 ConstrainedOptPack::DirectLineSearchArmQuad_StrategySetOptions 00990 ls_options_setter( direct_line_search.get(), "DirectLineSearchArmQuadSQPStep" ); 00991 ls_options_setter.set_options( *options_ ); 00992 } 00993 switch( cov_.line_search_method_ ) { 00994 case LINE_SEARCH_DIRECT: { 00995 line_search_step = Teuchos::rcp(new LineSearchDirect_Step(direct_line_search)); 00996 break; 00997 } 00998 case LINE_SEARCH_2ND_ORDER_CORRECT: { 00999 TEST_FOR_EXCEPTION( 01000 true, std::logic_error 01001 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 01002 "The line_search_method option of 2ND_ORDER_CORRECT has not been updated yet!" ); 01003 break; 01004 } 01005 case LINE_SEARCH_WATCHDOG: { 01006 TEST_FOR_EXCEPTION( 01007 true, std::logic_error 01008 ,"NLPAlgoConfigIP::config_algo_cntr(...) : Error, " 01009 "The line_search_method option of WATCHDOG has not been updated yet!" ); 01010 break; 01011 } 01012 case LINE_SEARCH_FILTER: 01013 { 01014 Teuchos::RCP<LineSearchFilter_Step> 01015 line_search_filter_step = Teuchos::rcp(new LineSearchFilter_Step(barrier_nlp, barrier_obj_name, grad_barrier_obj_name)); 01016 01017 if(options_.get()) 01018 { 01019 LineSearchFilter_StepSetOptions options_setter(line_search_filter_step.get()); 01020 options_setter.set_options(*options_); 01021 } 01022 01023 line_search_step = line_search_filter_step; 01024 break; 01025 } 01026 } 01027 } 01028 01029 // LineSearchFailure 01030 if( new_decomp_selection_strategy.get() ) { 01031 line_search_step = Teuchos::rcp( 01032 new LineSearchFailureNewDecompositionSelection_Step( 01033 line_search_step 01034 ,new_decomp_selection_strategy 01035 ) 01036 ); 01037 } 01038 01039 // 01040 // Create the algorithm depending on the type of NLP we are trying to solve. 01041 // 01042 01043 if( m == 0 ) { 01044 if( nb == 0 ) { 01045 // 01046 // Unconstrained NLP (m == 0, num_bounded_x == 0) 01047 // 01048 if(trase_out) 01049 *trase_out 01050 << "\nConfiguring an algorithm for an unconstrained " 01051 << "NLP (m == 0, num_bounded_x == 0) ...\n"; 01052 TEST_FOR_EXCEPTION( 01053 m == 0 && nb == 0, std::logic_error 01054 ,"NLPAlgoConfigIP::config_alg_cntr(...) : Error, " 01055 "Unconstrained NLPs are not supported yet!" ); 01056 } 01057 else { 01058 // 01059 // Simple bound constrained NLP (m == 0, num_bounded_x > 0) 01060 // 01061 if(trase_out) 01062 *trase_out 01063 << "\nConfiguring an algorithm for a simple bound constrained " 01064 << "NLP (m == 0, num_bounded_x > 0) ...\n"; 01065 TEST_FOR_EXCEPTION( 01066 m == 0 && nb == 0, std::logic_error 01067 ,"NLPAlgoConfigIP::config_alg_cntr(...) : Error, " 01068 "Bound constrained NLPs are not supported yet!" ); 01069 } 01070 } 01071 else if( n == m ) { 01072 // 01073 // System of Nonlinear equations (n == m) 01074 // 01075 if(trase_out) 01076 *trase_out 01077 << "\nConfiguring an algorithm for a system of nonlinear equations " 01078 << "NLP (n == m) ...\n"; 01079 TEST_FOR_EXCEPTION( 01080 n == m, std::logic_error 01081 ,"NLPAlgoConfigIP::config_alg_cntr(...) : Error, " 01082 "Nonlinear equation (NLE) problems are not supported yet!" ); 01083 TEST_FOR_EXCEPT(true); // ToDo: add the step objects for this algorithm 01084 } 01085 else if ( m > 0 || nb > 0 ) { 01086 // 01087 // General nonlinear NLP ( m > 0 ) 01088 // 01089 if( nb == 0 ) { 01090 // 01091 // Nonlinear equality constrained NLP ( m > 0 && num_bounded_x == 0 ) 01092 // 01093 if(trase_out) 01094 *trase_out 01095 << "\nConfiguring an algorithm for a nonlinear equality constrained " 01096 << "NLP ( m > 0 && num_bounded_x == 0) ...\n"; 01097 } 01098 else { 01099 // 01100 // Nonlinear inequality constrained NLP ( num_bounded_x > 0 ) 01101 // 01102 if(trase_out) 01103 *trase_out 01104 << "\nConfiguring an algorithm for a nonlinear generally constrained " 01105 << "NLP ( num_bounded_x > 0 ) ...\n"; 01106 } 01107 01108 01109 01111 // Add all the steps to the algorithm 01113 01114 int step_num = 0; 01115 int assoc_step_num = 0; 01116 01117 // UpdateBarrierParameter 01118 //algo->insert_step( ++step_num, "UpdateBarrierParameter", updateBarrierParameter_step ); 01119 01120 // EvalNewPoint 01121 algo->insert_step( ++step_num, EvalNewPoint_name, eval_new_point_step ); 01122 01123 //* EvalNewPoint pre steps 01124 // PreEvalNewPointBarrier 01125 algo->insert_assoc_step( step_num, IterationPack::PRE_STEP, 1, "PreEvalNewPointBarrier", preEvalNewPointBarrier_step); 01126 01127 //* EvalNewPoint post steps 01128 if( check_descent_quasi_normal_step_step.get() && tailored_approach && algo->algo_cntr().check_results() ) 01129 { 01130 algo->insert_assoc_step( 01131 step_num 01132 ,IterationPack::POST_STEP 01133 ,++assoc_step_num 01134 ,"CheckDescentQuasiNormalStep" 01135 ,check_descent_quasi_normal_step_step 01136 ); 01137 } 01138 01139 // PostEvalNewPointBarrier 01140 algo->insert_assoc_step( step_num, IterationPack::POST_STEP, ++assoc_step_num, "PostEvalNewPointBarrier", postEvalNewPointBarrier_step); 01141 assoc_step_num = 0; 01142 01143 // ReducedGradient 01144 if( !tailored_approach ) { 01145 algo->insert_step( ++step_num, ReducedGradient_name, reduced_gradient_step ); 01146 } 01147 01148 // CalcReducedGradLagrangian 01149 algo->insert_step( ++step_num, CalcReducedGradLagrangian_name, calc_reduced_grad_lagr_step ); 01150 01151 // CalcLagrangeMultDecomposed 01152 // Compute these here so that in case we converge we can report them 01153 if( !tailored_approach ) { 01154 // ToDo: Insert this step 01155 } 01156 01157 // CheckConvergence 01158 algo->insert_step( ++step_num, CheckConvergence_name, check_convergence_step ); 01159 01160 //} 01161 01162 // UpdateBarrierParameter 01163 algo->insert_step( ++step_num, "UpdateBarrierParameter", updateBarrierParameter_step ); 01164 01165 // QuasiNormalStep 01166 if( !tailored_approach ) { 01167 algo->insert_step( ++step_num, QuasiNormalStep_name, quasi_normal_step_step ); 01168 assoc_step_num = 0; 01169 if( check_decomp_from_py_step.get() ) 01170 algo->insert_assoc_step( 01171 step_num 01172 ,IterationPack::POST_STEP 01173 ,++assoc_step_num 01174 ,"CheckDecompositionFromPy" 01175 ,check_decomp_from_py_step 01176 ); 01177 if( check_decomp_from_Rpy_step.get() ) 01178 algo->insert_assoc_step( 01179 step_num 01180 ,IterationPack::POST_STEP 01181 ,++assoc_step_num 01182 ,"CheckDecompositionFromRPy" 01183 ,check_decomp_from_Rpy_step 01184 ); 01185 if( check_descent_quasi_normal_step_step.get() ) 01186 algo->insert_assoc_step( 01187 step_num 01188 ,IterationPack::POST_STEP 01189 ,++assoc_step_num 01190 ,"CheckDescentQuasiNormalStep" 01191 ,check_descent_quasi_normal_step_step 01192 ); 01193 } 01194 01195 // ReducedHessian 01196 algo->insert_step( ++step_num, ReducedHessian_name, reduced_hessian_step ); 01197 01198 // UpdateReducedSigma_Step 01199 algo->insert_step( ++step_num, "UpdateReducedSigma", updateReducedSigma_step); 01200 01201 // TangentialStep 01202 algo->insert_step( ++step_num, "TangentialStepIP", tangential_step); 01203 // CalcDFromYPYZPZ 01204 algo->insert_step( ++step_num, CalcDFromYPYZPZ_name, calc_d_from_Ypy_Zpy_step ); 01205 01206 // CalcD_vStep_Step 01207 algo->insert_step( ++step_num, "CalcD_vStep_Step", calc_d_v_step_step ); 01208 01209 // PreProcessBarrierLineSearch_Step 01210 algo->insert_step( ++step_num, "PreProcessBarrierLineSearch_Step", preprocess_barrier_linesearch_step ); 01211 01212 // LineSearch 01213 if( cov_.line_search_method_ == LINE_SEARCH_NONE ) { 01214 algo->insert_step( ++step_num, LineSearch_name, line_search_full_step_step ); 01215 } 01216 else { 01217 // Main line search step 01218 algo->insert_step( ++step_num, LineSearch_name, line_search_step ); 01219 // Insert presteps 01220 Algorithm::poss_type 01221 pre_step_i = 0; 01222 // (.-?) LineSearchFullStep 01223 //algo->insert_assoc_step( 01224 // step_num 01225 // ,IterationPack::PRE_STEP 01226 // ,++pre_step_i 01227 // ,"LineSearchFullStep" 01228 // ,line_search_full_step_step 01229 // ); 01230 // (.-?) MeritFunc_PenaltyPramUpdate 01231 if(merit_func_penalty_param_update_step.get()) { 01232 algo->insert_assoc_step( 01233 step_num 01234 ,IterationPack::PRE_STEP 01235 ,++pre_step_i 01236 ,"MeritFunc_PenaltyParamUpdate" 01237 ,merit_func_penalty_param_update_step 01238 ); 01239 } 01240 } 01241 01242 // PostProcessBarrierLineSearch_Step 01243 algo->insert_step( ++step_num, "PostProcessBarrierLineSearch_Step", postprocess_barrier_linesearch_step ); 01244 01245 // CheckConvergence 01246 //algo->insert_step( ++step_num, CheckConvergence_name, check_convergence_step ); 01247 01248 } 01249 else { 01250 TEST_FOR_EXCEPT(true); // Error, this should not ever be called! 01251 } 01252 } 01253 01254 } 01255 01256 void NLPAlgoConfigIP::init_algo(NLPAlgoInterface* _algo) 01257 { 01258 using Teuchos::dyn_cast; 01259 01260 TEST_FOR_EXCEPTION( 01261 _algo == NULL, std::invalid_argument 01262 ,"NLPAlgoConfigIP::init_algo(_algo) : Error, " 01263 "_algo can not be NULL" ); 01264 01265 NLPAlgo &algo = dyn_cast<NLPAlgo>(*_algo); 01266 NLPAlgoState &state = algo.rsqp_state(); 01267 NLP &nlp = algo.nlp(); 01268 01269 algo.max_iter( algo.algo_cntr().max_iter() ); 01270 algo.max_run_time( algo.algo_cntr().max_run_time() ); 01271 01272 // Reset the iteration count to zero 01273 state.k(0); 01274 01275 // Get organized output of vectors and matrices even if setw is not used by Step objects. 01276 algo.track().journal_out() 01277 << std::setprecision(algo.algo_cntr().journal_print_digits()) 01278 << std::scientific; 01279 01280 // set the first step 01281 algo.do_step_first(1); 01282 01283 // The rest of the algorithm should initialize itself 01284 } 01285 01286 // private 01287 01288 void NLPAlgoConfigIP::readin_options( 01289 const OptionsFromStreamPack::OptionsFromStream &options 01290 , SOptionValues *ov 01291 , std::ostream *trase_out 01292 ) 01293 { 01294 namespace ofsp = OptionsFromStreamPack; 01295 using ofsp::OptionsFromStream; 01296 typedef OptionsFromStream::options_group_t options_group_t; 01297 using ofsp::StringToIntMap; 01298 using ofsp::StringToBool; 01299 01300 TEST_FOR_EXCEPT( !( ov ) ); // only a local class error 01301 01302 // Get the options group for "NLPAlgoConfigIP" 01303 const std::string opt_grp_name = "NLPAlgoConfigIP"; 01304 const OptionsFromStream::options_group_t optgrp = options.options_group( opt_grp_name ); 01305 if( OptionsFromStream::options_group_exists( optgrp ) ) { 01306 01307 // Define map for options group "IpConfig". 01308 const int num_opts = 11; 01309 enum EIpConfig { 01310 MAX_BASIS_COND_CHANGE_FRAC 01311 ,EXACT_REDUCED_HESSIAN 01312 ,QUASI_NEWTON 01313 ,NUM_LBFGS_UPDATES_STORED 01314 ,LBFGS_AUTO_SCALING 01315 ,HESSIAN_INITIALIZATION 01316 ,QP_SOLVER 01317 ,REINIT_HESSIAN_ON_QP_FAIL 01318 ,LINE_SEARCH_METHOD 01319 ,MERIT_FUNCTION_TYPE 01320 ,L1_PENALTY_PARAM_UPDATE 01321 }; 01322 const char* SIpConfig[num_opts] = { 01323 "max_basis_cond_change_frac" 01324 ,"exact_reduced_hessian" 01325 ,"quasi_newton" 01326 ,"num_lbfgs_updates_stored" 01327 ,"lbfgs_auto_scaling" 01328 ,"hessian_initialization" 01329 ,"qp_solver" 01330 ,"reinit_hessian_on_qp_fail" 01331 ,"line_search_method" 01332 ,"merit_function_type" 01333 ,"l1_penalty_parameter_update" 01334 }; 01335 StringToIntMap map( opt_grp_name, num_opts, SIpConfig ); 01336 01337 options_group_t::const_iterator itr = optgrp.begin(); 01338 for( ; itr != optgrp.end(); ++itr ) { 01339 switch( (EIpConfig)map( ofsp::option_name(itr) ) ) { 01340 case MAX_BASIS_COND_CHANGE_FRAC: 01341 ov->max_basis_cond_change_frac_ = std::atof( ofsp::option_value(itr).c_str() ); 01342 break; 01343 case EXACT_REDUCED_HESSIAN: 01344 ov->exact_reduced_hessian_ = StringToBool( "exact_reduced_hessian", ofsp::option_value(itr).c_str() ); 01345 break; 01346 case QUASI_NEWTON: 01347 { 01348 const std::string &opt_val = ofsp::option_value(itr); 01349 if( opt_val == "AUTO" ) 01350 ov->quasi_newton_ = QN_AUTO; 01351 else if( opt_val == "BFGS" ) 01352 ov->quasi_newton_ = QN_BFGS; 01353 else if( opt_val == "PBFGS" ) 01354 ov->quasi_newton_ = QN_PBFGS; 01355 else if( opt_val == "LBFGS" ) 01356 ov->quasi_newton_ = QN_LBFGS; 01357 else if( opt_val == "LPBFGS" ) 01358 ov->quasi_newton_ = QN_LPBFGS; 01359 else 01360 TEST_FOR_EXCEPTION( 01361 true, std::invalid_argument 01362 ,"NLPAlgoConfigIP::readin_options(...) : " 01363 "Error, incorrect value for \"quasi_newton\" " 01364 ", Only options of BFGS, PBFGS" 01365 ", LBFGS, LPBFGS and AUTO are avalible." 01366 ); 01367 break; 01368 } 01369 case NUM_LBFGS_UPDATES_STORED: 01370 ov->num_lbfgs_updates_stored_ = std::atoi( ofsp::option_value(itr).c_str() ); 01371 break; 01372 case LBFGS_AUTO_SCALING: 01373 ov->lbfgs_auto_scaling_ 01374 = StringToBool( "lbfgs_auto_scaling", ofsp::option_value(itr).c_str() ); 01375 break; 01376 case HESSIAN_INITIALIZATION: 01377 { 01378 const std::string &opt_val = ofsp::option_value(itr); 01379 if( opt_val == "IDENTITY" ) 01380 ov->hessian_initialization_ = INIT_HESS_IDENTITY; 01381 else if( opt_val == "FINITE_DIFF_SCALE_IDENTITY" ) 01382 ov->hessian_initialization_ = INIT_HESS_FIN_DIFF_SCALE_IDENTITY; 01383 else if( opt_val == "FINITE_DIFF_DIAGONAL" ) 01384 ov->hessian_initialization_ = INIT_HESS_FIN_DIFF_SCALE_DIAGONAL; 01385 else if( opt_val == "FINITE_DIFF_DIAGONAL_ABS" ) 01386 ov->hessian_initialization_ = INIT_HESS_FIN_DIFF_SCALE_DIAGONAL_ABS; 01387 else if( opt_val == "AUTO" ) 01388 ov->hessian_initialization_ = INIT_HESS_AUTO; 01389 else 01390 TEST_FOR_EXCEPTION( 01391 true, std::invalid_argument 01392 ,"NLPAlgoConfigIP::readin_options(...) : " 01393 "Error, incorrect value for \"hessian_initialization\" " 01394 ", Only options of IDENTITY, FINITE_DIFF_SCALE_IDENTITY," 01395 " FINITE_DIFF_DIAGONAL, FINITE_DIFF_DIAGONAL_ABS and AUTO" 01396 " are available" ); 01397 break; 01398 } 01399 case QP_SOLVER: 01400 { 01401 const std::string &qp_solver = ofsp::option_value(itr); 01402 if( qp_solver == "AUTO" ) { 01403 ov->qp_solver_type_ = QP_AUTO; 01404 } else if( qp_solver == "QPSOL" ) { 01405 ov->qp_solver_type_ = QP_QPSOL; 01406 } else if( qp_solver == "QPOPT" ) { 01407 #ifdef CONSTRAINED_OPTIMIZATION_PACK_USE_QPOPT 01408 ov->qp_solver_type_ = QP_QPOPT; 01409 #else 01410 TEST_FOR_EXCEPTION( 01411 true, std::invalid_argument 01412 ,"NLPAlgoConfigIP::readin_options(...) : QPOPT is not supported," 01413 " must define CONSTRAINED_OPTIMIZATION_PACK_USE_QPOPT!" ); 01414 #endif 01415 } else if( qp_solver == "QPKWIK" ) { 01416 ov->qp_solver_type_ = QP_QPKWIK; 01417 } else if( qp_solver == "QPSCHUR" ) { 01418 ov->qp_solver_type_ = QP_QPSCHUR; 01419 } else { 01420 TEST_FOR_EXCEPTION( 01421 true, std::invalid_argument 01422 ,"NLPAlgoConfigIP::readin_options(...) : " 01423 "Error, incorrect value for \"qp_solver\" " 01424 "Only qp solvers QPOPT, QPSOL, QPKWIK, QPSCHUR and AUTO are avalible." ); 01425 } 01426 break; 01427 } 01428 case REINIT_HESSIAN_ON_QP_FAIL: 01429 ov->reinit_hessian_on_qp_fail_ = StringToBool( "reinit_hessian_on_qp_fail", ofsp::option_value(itr).c_str() ); 01430 break; 01431 case LINE_SEARCH_METHOD: 01432 { 01433 const std::string &option = ofsp::option_value(itr); 01434 if( option == "NONE" ) { 01435 ov->line_search_method_ = LINE_SEARCH_NONE; 01436 } else if( option == "DIRECT" ) { 01437 ov->line_search_method_ = LINE_SEARCH_DIRECT; 01438 } else if( option == "2ND_ORDER_CORRECT" ) { 01439 ov->line_search_method_ = LINE_SEARCH_2ND_ORDER_CORRECT; 01440 } else if( option == "WATCHDOG" ) { 01441 ov->line_search_method_ = LINE_SEARCH_WATCHDOG; 01442 } else if( option == "AUTO" ) { 01443 ov->line_search_method_ = LINE_SEARCH_AUTO; 01444 } else if( option == "FILTER" ) { 01445 ov->line_search_method_ = LINE_SEARCH_FILTER; 01446 } else { 01447 TEST_FOR_EXCEPTION( 01448 true, std::invalid_argument 01449 ,"NLPAlgoConfigIP::readin_options(...) : " 01450 "Error, incorrect value for \"line_search_method\".\n" 01451 "Only the options NONE, DIRECT, 2ND_ORDER_CORRECT, FILTER, WATCHDOG " 01452 "and AUTO are avalible." ); 01453 } 01454 break; 01455 } 01456 case MERIT_FUNCTION_TYPE: 01457 { 01458 const std::string &option = ofsp::option_value(itr); 01459 if( option == "L1" ) 01460 ov->merit_function_type_ = MERIT_FUNC_L1; 01461 else if( option == "MODIFIED_L1" ) 01462 ov->merit_function_type_ = MERIT_FUNC_MOD_L1; 01463 else if( option == "MODIFIED_L1_INCR" ) 01464 ov->merit_function_type_ = MERIT_FUNC_MOD_L1_INCR; 01465 else if( option == "AUTO" ) 01466 ov->merit_function_type_ = MERIT_FUNC_AUTO; 01467 else 01468 TEST_FOR_EXCEPTION( 01469 true, std::invalid_argument 01470 ,"NLPAlgoConfigIP::readin_options(...) : " 01471 "Error, incorrect value for \"merit_function_type\".\n" 01472 "Only the options L1, MODIFIED_L1, MODIFIED_L1_INCR " 01473 "and AUTO are avalible." ); 01474 break; 01475 } 01476 case L1_PENALTY_PARAM_UPDATE: 01477 { 01478 const std::string &option = ofsp::option_value(itr); 01479 if( option == "WITH_MULT" ) 01480 ov->l1_penalty_param_update_ 01481 = L1_PENALTY_PARAM_WITH_MULT; 01482 else if( option == "MULT_FREE" ) 01483 ov->l1_penalty_param_update_ 01484 = L1_PENALTY_PARAM_MULT_FREE; 01485 else if( option == "AUTO" ) 01486 ov->l1_penalty_param_update_ 01487 = L1_PENALTY_PARAM_AUTO; 01488 else 01489 TEST_FOR_EXCEPTION( 01490 true, std::invalid_argument 01491 ,"NLPAlgoConfigIP::readin_options(...) : " 01492 "Error, incorrect value for \"l1_penalty_param_update\".\n" 01493 "Only the options WITH_MULT, MULT_FREE and AUTO" 01494 "are avalible." ); 01495 break; 01496 } 01497 default: 01498 TEST_FOR_EXCEPT(true); // this would be a local programming error only. 01499 } 01500 } 01501 } 01502 else { 01503 if(trase_out) 01504 *trase_out 01505 << "\n\n*** Warning! The options group \"NLPAlgoConfigIP\" was not found.\n" 01506 << "Using a default set of options instead ... \n"; 01507 } 01508 } 01509 01510 // 01511 // This is where some of the default options are set and the user is alerted to what their 01512 // value is. 01513 // 01514 void NLPAlgoConfigIP::set_default_options( 01515 const SOptionValues &uov 01516 ,SOptionValues *cov 01517 ,std::ostream *trase_out 01518 ) 01519 { 01520 if(trase_out) 01521 *trase_out 01522 << "\n*** Setting option defaults for options not set by the user or determined some other way ...\n"; 01523 01524 if( cov->max_basis_cond_change_frac_ < 0.0 && uov.max_basis_cond_change_frac_ < 0.0 ) { 01525 if(trase_out) 01526 *trase_out 01527 << "\nmax_basis_cond_change_frac < 0 : setting max_basis_cond_change_frac = 1e+4 \n"; 01528 cov->max_basis_cond_change_frac_ = 1e+4; 01529 } 01530 else { 01531 cov->max_basis_cond_change_frac_ = uov.max_basis_cond_change_frac_; 01532 } 01533 cov->exact_reduced_hessian_ = uov.exact_reduced_hessian_; 01534 if( cov->quasi_newton_ == QN_AUTO && uov.quasi_newton_ == QN_AUTO ) { 01535 if(trase_out) 01536 *trase_out 01537 << "\nquasi_newton == AUTO: setting quasi_newton = BFGS\n"; 01538 cov->quasi_newton_ = QN_BFGS; 01539 } 01540 else if(cov->quasi_newton_ == QN_AUTO) { 01541 cov->quasi_newton_ = uov.quasi_newton_; 01542 } 01543 if( cov->num_lbfgs_updates_stored_ < 0 && uov.num_lbfgs_updates_stored_ < 0 ) { 01544 if(trase_out) 01545 *trase_out 01546 << "\nnum_lbfgs_updates_stored < 0 : setting num_lbfgs_updates_stored = 10\n"; 01547 cov->num_lbfgs_updates_stored_ = 10; 01548 } 01549 else if(cov->num_lbfgs_updates_stored_ < 0) { 01550 cov->num_lbfgs_updates_stored_ = uov.num_lbfgs_updates_stored_; 01551 } 01552 cov->lbfgs_auto_scaling_ = uov.lbfgs_auto_scaling_; 01553 if( cov->hessian_initialization_ == INIT_HESS_AUTO && uov.hessian_initialization_ == INIT_HESS_AUTO ) { 01554 if(trase_out) 01555 *trase_out 01556 << "\nhessian_initialization == AUTO: setting hessian_initialization = FINITE_DIFF_DIAGONAL_ABS\n"; 01557 cov->hessian_initialization_ = INIT_HESS_FIN_DIFF_SCALE_DIAGONAL_ABS; 01558 } 01559 else if(cov->hessian_initialization_ == INIT_HESS_AUTO) { 01560 cov->hessian_initialization_ = uov.hessian_initialization_; 01561 } 01562 if( cov->qp_solver_type_ == QP_AUTO && uov.qp_solver_type_ == QP_AUTO ) { 01563 if(trase_out) 01564 *trase_out 01565 << "\nqp_solver_type == AUTO: setting qp_solver_type = QPSCHUR\n"; 01566 cov->qp_solver_type_ = QP_QPSCHUR; 01567 } 01568 else if(cov->qp_solver_type_ == QP_AUTO) { 01569 cov->qp_solver_type_ = uov.qp_solver_type_; 01570 } 01571 cov->reinit_hessian_on_qp_fail_ = uov.reinit_hessian_on_qp_fail_; 01572 if( cov->line_search_method_ == LINE_SEARCH_AUTO && uov.line_search_method_ == LINE_SEARCH_AUTO ) { 01573 if(trase_out) 01574 *trase_out 01575 << "\nline_search_method == AUTO: setting line_search_method = FILTER\n"; 01576 cov->line_search_method_ = LINE_SEARCH_FILTER; 01577 } 01578 else if(cov->line_search_method_ == LINE_SEARCH_AUTO) { 01579 cov->line_search_method_ = uov.line_search_method_; 01580 } 01581 if( cov->merit_function_type_ == MERIT_FUNC_AUTO && uov.merit_function_type_ == MERIT_FUNC_AUTO ) { 01582 if(trase_out) 01583 *trase_out 01584 << "\nmerit_function_type == AUTO: setting merit_function_type = MODIFIED_L1_INCR\n"; 01585 cov->merit_function_type_ = MERIT_FUNC_MOD_L1_INCR; 01586 } 01587 else if(cov->merit_function_type_ == MERIT_FUNC_AUTO) { 01588 cov->merit_function_type_ = uov.merit_function_type_; 01589 } 01590 if( cov->l1_penalty_param_update_ == L1_PENALTY_PARAM_AUTO && uov.l1_penalty_param_update_ == L1_PENALTY_PARAM_AUTO ) { 01591 if(trase_out) 01592 *trase_out 01593 << "\nl1_penalty_param_update == AUTO: setting l1_penalty_param_update = MULT_FREE\n"; 01594 cov->l1_penalty_param_update_ = L1_PENALTY_PARAM_MULT_FREE; 01595 } 01596 else if(cov->l1_penalty_param_update_ == L1_PENALTY_PARAM_AUTO) { 01597 cov->l1_penalty_param_update_ = uov.l1_penalty_param_update_; 01598 } 01599 if( cov->full_steps_after_k_ < 0 && uov.full_steps_after_k_ < 0 ) { 01600 if(trase_out) 01601 *trase_out 01602 << "\nfull_steps_after_k < 0 : the line search will never be turned off after so many iterations\n"; 01603 } 01604 else { 01605 cov->full_steps_after_k_ = uov.full_steps_after_k_; 01606 } 01607 if(trase_out) 01608 *trase_out 01609 << "\n*** End setting default options\n"; 01610 } 01611 01612 } // end namespace MoochoPack
1.7.4