MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MoochoPack_MeritFunc_PenaltyParamUpdateMultFree_AddedStep.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #include <math.h>
43 
44 #include <ostream>
45 #include <typeinfo>
46 
51 
52 namespace MoochoPack {
53 
55  value_type small_mu
56  ,value_type mult_factor
57  ,value_type kkt_near_sol
58  )
59  :MeritFunc_PenaltyParamUpdateGuts_AddedStep(small_mu,mult_factor,kkt_near_sol)
60 {}
61 
62 // Overridden from MeritFunc_PenaltyParamUpdateGuts_AddedStep
63 
65  NLPAlgoState& s, value_type* min_mu
66  ) const
67 {
69 
70  IterQuantityAccess<VectorMutable>
71  &Gf_iq = s.Gf(),
72  &nu_iq = s.nu(),
73  &Ypy_iq = s.Ypy(),
74  &c_iq = s.c();
75  if ( Gf_iq.updated_k(0) && nu_iq.updated_k(0) && Ypy_iq.updated_k(0) && c_iq.updated_k(0) ) {
76  // min_mu = abs((Gf_k+nu_k)'*Ypy_k) / norm(c_k,1)
77  const value_type
78  dot_Gf_Ypy = dot( Gf_iq.get_k(0), Ypy_iq.get_k(0) ),
79  dot_nu_Ypy = dot( nu_iq.get_k(0), Ypy_iq.get_k(0) ),
80  nrm_c = c_iq.get_k(0).norm_1(),
82  *min_mu = ::fabs( dot_Gf_Ypy + dot_nu_Ypy ) / ( nrm_c + small_num );
83  return true;
84  }
85  return false;
86 }
87 
89  std::ostream& out, const std::string& L ) const
90 {
91  out
92  << L << "if Gf_k, nu_k, Ypy_k and c_k are updated then\n"
93  << L << " min_mu = abs((Gf_k+nu_k)'*Ypy_k) / ( norm(c_k,1) + small_num )\n"
94  << L << " update_mu = true\n"
95  << L << "else\n"
96  << L << " update_mu = false\n"
97  << L << "endif\n"
98  ;
99 }
100 
101 } // end namespace MoochoPack
MeritFunc_PenaltyParamUpdateMultFree_AddedStep(value_type small_mu=1e-6, value_type mult_factor=1e-4, value_type kkt_near_sol=1.0)
Reduced space SQP state encapsulation interface.
std::ostream * out
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
AbstractLinAlgPack::value_type value_type
Updates the penalty parameter for a merit function as: mu_k = max( mu_km1, min_mu )...