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