MoochoPack : Framework for Large-Scale Optimization Algorithms  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MoochoPack_EvalNewPointStd_Step.cpp
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 <ostream>
43 #include <typeinfo>
44 
45 #include "MoochoPack_EvalNewPointStd_Step.hpp"
46 #include "MoochoPack_Exceptions.hpp"
47 #include "MoochoPack_moocho_algo_conversion.hpp"
48 #include "IterationPack_print_algorithm_step.hpp"
49 #include "NLPInterfacePack_NLPFirstOrder.hpp"
50 #include "ConstrainedOptPack_DecompositionSystemVarReduct.hpp"
51 #include "AbstractLinAlgPack_MatrixSymIdent.hpp"
52 #include "AbstractLinAlgPack_PermutationOut.hpp"
53 #include "AbstractLinAlgPack_MatrixOpNonsing.hpp"
54 #include "AbstractLinAlgPack_MatrixOpOut.hpp"
55 #include "AbstractLinAlgPack_VectorMutable.hpp"
56 #include "AbstractLinAlgPack_VectorStdOps.hpp"
57 #include "AbstractLinAlgPack_VectorOut.hpp"
58 #include "AbstractLinAlgPack_assert_print_nan_inf.hpp"
59 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
60 #include "Teuchos_dyn_cast.hpp"
61 #include "Teuchos_Assert.hpp"
62 
63 #ifdef TEUCHOS_DEBUG
64 #include "DenseLinAlgPack_PermVecMat.hpp"
65 #endif
66 
67 namespace MoochoPack {
68 
69 EvalNewPointStd_Step::EvalNewPointStd_Step(
70  const decomp_sys_handler_ptr_t &decomp_sys_handler
71  ,const deriv_tester_ptr_t &deriv_tester
72  ,const bounds_tester_ptr_t &bounds_tester
73  ,const decomp_sys_tester_ptr_t &decomp_sys_tester
74  ,EFDDerivTesting fd_deriv_testing
76  ,DecompositionSystemHandler_Strategy::EDecompSysPrintLevel decomp_sys_testing_print_level
77  )
78  :decomp_sys_handler_(decomp_sys_handler)
79  ,deriv_tester_(deriv_tester)
80  ,bounds_tester_(bounds_tester)
81  ,decomp_sys_tester_(decomp_sys_tester)
82  ,fd_deriv_testing_(fd_deriv_testing)
83  ,decomp_sys_testing_(decomp_sys_testing)
84  ,decomp_sys_testing_print_level_(decomp_sys_testing_print_level)
85 {}
86 
88  Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
89  ,poss_type assoc_step_poss
90  )
91 {
92  using Teuchos::rcp;
93  using Teuchos::dyn_cast;
94  using AbstractLinAlgPack::assert_print_nan_inf;
95  using IterationPack::print_algorithm_step;
97 
98  NLPAlgo &algo = rsqp_algo(_algo);
99  NLPAlgoState &s = algo.rsqp_state();
100  NLPFirstOrder &nlp = dyn_cast<NLPFirstOrder>(algo.nlp());
101 
102  EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
103  EJournalOutputLevel ns_olevel = algo.algo_cntr().null_space_journal_output_level();
104  std::ostream& out = algo.track().journal_out();
105 
106  // print step header.
107  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
108  using IterationPack::print_algorithm_step;
109  print_algorithm_step( algo, step_poss, type, assoc_step_poss, out );
110  }
111 
112  if(!nlp.is_initialized())
113  nlp.initialize(algo.algo_cntr().check_results());
114 
116  nlpOutputTempState(rcp(&nlp,false),Teuchos::getFancyOStream(rcp(&out,false)),convertToVerbLevel(olevel));
117 
118  const size_type
119  n = nlp.n(),
120  nb = nlp.num_bounded_x(),
121  m = nlp.m();
122  size_type
123  r = 0;
124 
125  // Get the iteration quantity container objects
126  IterQuantityAccess<value_type>
127  &f_iq = s.f();
128  IterQuantityAccess<VectorMutable>
129  &x_iq = s.x(),
130  *c_iq = m > 0 ? &s.c() : NULL,
131  &Gf_iq = s.Gf();
132  IterQuantityAccess<MatrixOp>
133  *Gc_iq = m > 0 ? &s.Gc() : NULL,
134  *Z_iq = NULL,
135  *Y_iq = NULL,
136  *Uz_iq = NULL,
137  *Uy_iq = NULL;
138  IterQuantityAccess<MatrixOpNonsing>
139  *R_iq = NULL;
140 
141  MatrixOp::EMatNormType mat_nrm_inf = MatrixOp::MAT_NORM_INF;
142  const bool calc_matrix_norms = algo.algo_cntr().calc_matrix_norms();
143  const bool calc_matrix_info_null_space_only = algo.algo_cntr().calc_matrix_info_null_space_only();
144 
145  if( x_iq.last_updated() == IterQuantity::NONE_UPDATED ) {
146  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
147  out << "\nx is not updated for any k so set x_k = nlp.xinit() ...\n";
148  }
149  x_iq.set_k(0) = nlp.xinit();
150  }
151 
152  // Validate x
153  if( nb && algo.algo_cntr().check_results() ) {
154  assert_print_nan_inf(
155  x_iq.get_k(0), "x_k", true
156  , int(olevel) >= int(PRINT_ALGORITHM_STEPS) ? &out : NULL
157  );
158  if( nlp.num_bounded_x() > 0 ) {
159  if(!bounds_tester().check_in_bounds(
160  int(olevel) >= int(PRINT_ALGORITHM_STEPS) ? &out : NULL
161  ,int(olevel) >= int(PRINT_VECTORS) // print_all_warnings
162  ,int(olevel) >= int(PRINT_ITERATION_QUANTITIES) // print_vectors
163  ,nlp.xl(), "xl"
164  ,nlp.xu(), "xu"
165  ,x_iq.get_k(0), "x_k"
166  ))
167  {
169  true, TestFailed
170  ,"EvalNewPointStd_Step::do_step(...) : Error, "
171  "the variables bounds xl <= x_k <= xu where violated!" );
172  }
173  }
174  }
175 
176  Vector &x = x_iq.get_k(0);
177 
178  Range1D var_dep(Range1D::INVALID), var_indep(Range1D::INVALID);
179  if( s.get_decomp_sys().get() ) {
181  *decomp_sys_vr = dynamic_cast<ConstrainedOptPack::DecompositionSystemVarReduct*>(&s.decomp_sys());
182  if(decomp_sys_vr) {
183  var_dep = decomp_sys_vr->var_dep();
184  var_indep = decomp_sys_vr->var_indep();
185  }
186  s.var_dep(var_dep);
187  s.var_indep(var_indep);
188  }
189 
190  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
191  out << "\n||x_k||inf = " << x.norm_inf();
192  if( var_dep.size() )
193  out << "\n||x(var_dep)_k||inf = " << x.sub_view(var_dep)->norm_inf();
194  if( var_indep.size() )
195  out << "\n||x(var_indep)_k||inf = " << x.sub_view(var_indep)->norm_inf();
196  out << std::endl;
197  }
198  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
199  out << "\nx_k = \n" << x;
200  if( var_dep.size() )
201  out << "\nx(var_dep)_k = \n" << *x.sub_view(var_dep);
202  }
203  if( static_cast<int>(ns_olevel) >= static_cast<int>(PRINT_VECTORS) ) {
204  if( var_indep.size() )
205  out << "\nx(var_indep)_k = \n" << *x.sub_view(var_indep);
206  }
207 
208  // Set the references to the current point's quantities to be updated
209  const bool f_k_updated = f_iq.updated_k(0);
210  const bool Gf_k_updated = Gf_iq.updated_k(0);
211  const bool c_k_updated = m > 0 ? c_iq->updated_k(0) : false;
212  const bool Gc_k_updated = m > 0 ? Gc_iq->updated_k(0) : false;
213  nlp.unset_quantities();
214  if(!f_k_updated) nlp.set_f( &f_iq.set_k(0) );
215  if(!Gf_k_updated) nlp.set_Gf( &Gf_iq.set_k(0) );
216  if( m > 0 ) {
217  if(!c_k_updated) nlp.set_c( &c_iq->set_k(0) );
218  if(!Gc_k_updated) nlp.set_Gc( &Gc_iq->set_k(0) );
219  }
220 
221  // Calculate Gc at x_k
222  bool new_point = true;
223  if(m > 0) {
224  if(!Gc_k_updated) nlp.calc_Gc( x, new_point );
225  new_point = false;
226  }
227 
228  //
229  // Update (or select a new) range/null decomposition
230  //
231  bool new_decomp_selected = false;
232  if( m > 0 ) {
233 
234  // Update the range/null decomposition
235  decomp_sys_handler().update_decomposition(
236  algo, s, nlp, decomp_sys_testing(), decomp_sys_testing_print_level()
237  ,&new_decomp_selected
238  );
239 
240  r = s.equ_decomp().size();
241 
242  Z_iq = ( n > m && r > 0 ) ? &s.Z() : NULL;
243  Y_iq = ( r > 0 ) ? &s.Y() : NULL;
244  Uz_iq = ( m > 0 && m > r ) ? &s.Uz() : NULL;
245  Uy_iq = ( m > 0 && m > r ) ? &s.Uy() : NULL;
246  R_iq = ( m > 0 ) ? &s.R() : NULL;
247 
248  // Determine if we will test the decomp_sys or not
249  const DecompositionSystem::ERunTests
250  ds_test_what = ( ( decomp_sys_testing() == DecompositionSystemHandler_Strategy::DST_TEST
251  || ( decomp_sys_testing() == DecompositionSystemHandler_Strategy::DST_DEFAULT
252  && algo.algo_cntr().check_results() ) )
253  ? DecompositionSystem::RUN_TESTS
254  : DecompositionSystem::NO_TESTS );
255 
256  // Determine the output level for decomp_sys
257  DecompositionSystem::EOutputLevel ds_olevel;
258  switch(olevel) {
259  case PRINT_NOTHING:
260  case PRINT_BASIC_ALGORITHM_INFO:
261  ds_olevel = DecompositionSystem::PRINT_NONE;
262  break;
263  case PRINT_ALGORITHM_STEPS:
264  case PRINT_ACTIVE_SET:
265  ds_olevel = DecompositionSystem::PRINT_BASIC_INFO;
266  break;
267  case PRINT_VECTORS:
268  ds_olevel = DecompositionSystem::PRINT_VECTORS;
269  break;
270  case PRINT_ITERATION_QUANTITIES:
271  ds_olevel = DecompositionSystem::PRINT_EVERY_THING;
272  break;
273  default:
274  TEUCHOS_TEST_FOR_EXCEPT(true); // Should not get here!
275  };
276 
277  // Test the decomposition system
278  if( ds_test_what == DecompositionSystem::RUN_TESTS ) {
279  // Set the output level
280  if( decomp_sys_tester().print_tests() == DecompositionSystemTester::PRINT_NOT_SELECTED ) {
281  DecompositionSystemTester::EPrintTestLevel ds_olevel;
282  switch(olevel) {
283  case PRINT_NOTHING:
284  case PRINT_BASIC_ALGORITHM_INFO:
285  ds_olevel = DecompositionSystemTester::PRINT_NONE;
286  break;
287  case PRINT_ALGORITHM_STEPS:
288  case PRINT_ACTIVE_SET:
289  ds_olevel = DecompositionSystemTester::PRINT_BASIC;
290  break;
291  case PRINT_VECTORS:
292  ds_olevel = DecompositionSystemTester::PRINT_MORE;
293  break;
294  case PRINT_ITERATION_QUANTITIES:
295  ds_olevel = DecompositionSystemTester::PRINT_ALL;
296  break;
297  default:
298  TEUCHOS_TEST_FOR_EXCEPT(true); // Should not get here!
299  }
300  decomp_sys_tester().print_tests(ds_olevel);
301  decomp_sys_tester().dump_all( olevel == PRINT_ITERATION_QUANTITIES );
302  }
303  // Run the tests
304  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
305  out << "\nTesting the range/null decompostion ...\n";
306  }
307  const bool
308  decomp_sys_passed = decomp_sys_tester().test_decomp_system(
309  s.decomp_sys()
310  ,Gc_iq->get_k(0) // Gc
311  ,Z_iq ? &Z_iq->get_k(0) : NULL // Z
312  ,&Y_iq->get_k(0) // Y
313  ,&R_iq->get_k(0) // R
314  ,m > r ? &Uz_iq->get_k(0) : NULL // Uz
315  ,m > r ? &Uy_iq->get_k(0) : NULL // Uy
316  ,( olevel >= PRINT_ALGORITHM_STEPS ) ? &out : NULL
317  );
319  !decomp_sys_passed, TestFailed
320  ,"EvalNewPointStd_Step::do_step(...) : Error, "
321  "the tests of the decomposition system failed!" );
322  }
323  }
324  else {
325  // Unconstrained problem
326  Z_iq = &s.Z();
327  dyn_cast<MatrixSymIdent>(Z_iq->set_k(0)).initialize( nlp.space_x() );
328  s.equ_decomp(Range1D::Invalid);
329  s.equ_undecomp(Range1D::Invalid);
330  }
331 
332  // Calculate the rest of the quantities. If decomp_sys is a variable
333  // reduction decomposition system object, then nlp will be hip to the
334  // basis selection and will permute these quantities to that basis.
335  // Note that x will already be permuted to the current basis.
336  if(!Gf_k_updated) { nlp.calc_Gf( x, new_point ); new_point = false; }
337  if( m && (!c_k_updated || new_decomp_selected ) ) {
338  if(c_k_updated) nlp.set_c( &c_iq->set_k(0) ); // This was not set earlier!
339  nlp.calc_c( x, false);
340  }
341  if(!f_k_updated) {
342  nlp.calc_f( x, false);
343  }
344  nlp.unset_quantities();
345 
346  // Check for NaN and Inf
347  assert_print_nan_inf(f_iq.get_k(0),"f_k",true,&out);
348  if(m)
349  assert_print_nan_inf(c_iq->get_k(0),"c_k",true,&out);
350  assert_print_nan_inf(Gf_iq.get_k(0),"Gf_k",true,&out);
351 
352  // Print the iteration quantities before we test the derivatives for debugging
353 
354  // Update the selection of dependent and independent variables
355  if( s.get_decomp_sys().get() ) {
357  *decomp_sys_vr = dynamic_cast<ConstrainedOptPack::DecompositionSystemVarReduct*>(&s.decomp_sys());
358  if(decomp_sys_vr) {
359  var_dep = decomp_sys_vr->var_dep();
360  var_indep = decomp_sys_vr->var_indep();
361  }
362  }
363 
364  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
365  out << "\nPrinting the updated iteration quantities ...\n";
366  }
367 
368  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
369  out << "\nf_k = " << f_iq.get_k(0);
370  out << "\n||Gf_k||inf = " << Gf_iq.get_k(0).norm_inf();
371  if( var_dep.size() )
372  out << "\n||Gf_k(var_dep)_k||inf = " << Gf_iq.get_k(0).sub_view(var_dep)->norm_inf();
373  if( var_indep.size() )
374  out << "\n||Gf_k(var_indep)_k||inf = " << Gf_iq.get_k(0).sub_view(var_indep)->norm_inf();
375  if(m) {
376  out << "\n||c_k||inf = " << c_iq->get_k(0).norm_inf();
377  if( calc_matrix_norms && !calc_matrix_info_null_space_only )
378  out << "\n||Gc_k||inf = " << Gc_iq->get_k(0).calc_norm(mat_nrm_inf).value;
379  if( n > r && calc_matrix_norms && !calc_matrix_info_null_space_only )
380  out << "\n||Z||inf = " << Z_iq->get_k(0).calc_norm(mat_nrm_inf).value;
381  if( r && calc_matrix_norms && !calc_matrix_info_null_space_only )
382  out << "\n||Y||inf = " << Y_iq->get_k(0).calc_norm(mat_nrm_inf).value;
383  if( r && calc_matrix_norms && !calc_matrix_info_null_space_only )
384  out << "\n||R||inf = " << R_iq->get_k(0).calc_norm(mat_nrm_inf).value;
385  if( algo.algo_cntr().calc_conditioning() && !calc_matrix_info_null_space_only ) {
386  out << "\ncond_inf(R) = " << R_iq->get_k(0).calc_cond_num(mat_nrm_inf).value;
387  }
388  if( m > r && calc_matrix_norms && !calc_matrix_info_null_space_only ) {
389  out << "\n||Uz_k||inf = " << Uz_iq->get_k(0).calc_norm(mat_nrm_inf).value;
390  out << "\n||Uy_k||inf = " << Uy_iq->get_k(0).calc_norm(mat_nrm_inf).value;
391  }
392  }
393  out << std::endl;
394  }
395 
396  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ITERATION_QUANTITIES) ) {
397  if(m)
398  out << "\nGc_k =\n" << Gc_iq->get_k(0);
399  if( n > r )
400  out << "\nZ_k =\n" << Z_iq->get_k(0);
401  if(r) {
402  out << "\nY_k =\n" << Y_iq->get_k(0);
403  out << "\nR_k =\n" << R_iq->get_k(0);
404  }
405  if( m > r ) {
406  out << "\nUz_k =\n" << Uz_iq->get_k(0);
407  out << "\nUy_k =\n" << Uy_iq->get_k(0);
408  }
409  }
410  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
411  out << "\nGf_k =\n" << Gf_iq.get_k(0);
412  if( var_dep.size() )
413  out << "\nGf(var_dep)_k =\n " << *Gf_iq.get_k(0).sub_view(var_dep);
414  }
415  if( static_cast<int>(ns_olevel) >= static_cast<int>(PRINT_VECTORS) ) {
416  if( var_indep.size() )
417  out << "\nGf(var_indep)_k =\n" << *Gf_iq.get_k(0).sub_view(var_indep);
418  }
419  if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
420  if(m)
421  out << "\nc_k = \n" << c_iq->get_k(0);
422  }
423 
424  // Check the derivatives if we are checking the results
425  if( fd_deriv_testing() == FD_TEST
426  || ( fd_deriv_testing() == FD_DEFAULT && algo.algo_cntr().check_results() ) )
427  {
428 
429  if( olevel >= PRINT_ALGORITHM_STEPS ) {
430  out << "\n*** Checking derivatives by finite differences\n";
431  }
432 
433  const bool
434  nlp_passed = deriv_tester().finite_diff_check(
435  &nlp
436  ,x
437  ,nb ? &nlp.xl() : NULL
438  ,nb ? &nlp.xu() : NULL
439  ,m ? &Gc_iq->get_k(0) : NULL
440  ,&Gf_iq.get_k(0)
441  ,olevel >= PRINT_VECTORS
442  ,( olevel >= PRINT_ALGORITHM_STEPS ) ? &out : NULL
443  );
445  !nlp_passed, TestFailed
446  ,"EvalNewPointStd_Step::do_step(...) : Error, "
447  "the tests of the nlp derivatives failed!" );
448  }
449 
450  return true;
451 }
452 
454  const Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
455  ,poss_type assoc_step_poss, std::ostream& out, const std::string& L
456  ) const
457 {
458  const NLPAlgo &algo = rsqp_algo(_algo);
459  const NLPAlgoState &s = algo.rsqp_state();
460  const NLP &nlp = algo.nlp();
461  const size_type
462  m = nlp.m();
463  out
464  << L << "*** Evaluate the new point and update the range/null decomposition\n"
465  << L << "if nlp is not initialized then initialize the nlp\n"
466  << L << "if x is not updated for any k then set x_k = xinit\n";
467  if(m) {
468  out
469  << L << "if Gc_k is not updated Gc_k = Gc(x_k) <: space_x|space_c\n"
470  << L << "For Gc_k = [ Gc_k(:,equ_decomp), Gc_k(:,equ_undecomp) ] where:\n"
471  << L << " Gc_k(:,equ_decomp) <: space_x|space_c(equ_decomp) has full column rank r\n"
472  << L << "Find:\n"
473  << L << " Z_k <: space_x|space_null s.t. Gc_k(:,equ_decomp)' * Z_k = 0\n"
474  << L << " Y_k <: space_x|space_range s.t. [Z_k Y_k] is nonsigular \n"
475  << L << " R_k <: space_c(equ_decomp)|space_range\n"
476  << L << " s.t. R_k = Gc_k(:,equ_decomp)' * Y_k\n"
477  << L << " if m > r : Uz_k <: space_c(equ_undecomp)|space_null\n"
478  << L << " s.t. Uz_k = Gc_k(:,equ_undecomp)' * Z_k\n"
479  << L << " if m > r : Uy_k <: space_c(equ_undecomp)|space_range\n"
480  << L << " s.t. Uy_k = Gc_k(:,equ_undecomp)' * Y_k\n"
481  << L << "begin update decomposition (class \'" << typeName(decomp_sys_handler()) << "\')\n"
482  ;
483  decomp_sys_handler().print_update_decomposition( algo, s, out, L + " " );
484  out
485  << L << "end update decomposition\n"
486  << L << "if ( (decomp_sys_testing==DST_TEST)\n"
487  << L << " or (decomp_sys_testing==DST_DEFAULT and check_results==true)\n"
488  << L << " ) then\n"
489  << L << " check properties for Z_k, Y_k, R_k, Uz_k and Uy_k\n"
490  << L << "end\n"
491  ;
492  }
493  else {
494  out
495  << L << "Z_k = eye(space_x)\n";
496  }
497  if(m) {
498  out
499  << L << "end\n";
500  }
501  out
502  << L << "Gf_k = Gf(x_k) <: space_x\n"
503  << L << "if m > 0 and c_k is not updated c_k = c(x_k) <: space_c\n"
504  << L << "if f_k is not updated f_k = f(x_k) <: REAL\n"
505  << L << "if ( (fd_deriv_testing==FD_TEST)\n"
506  << L << " or (fd_deriv_testing==FD_DEFAULT and check_results==true)\n"
507  << L << " ) then\n"
508  << L << " check Gc_k (if m > 0) and Gf_k by finite differences.\n"
509  << L << "end\n"
510  ;
511 }
512 
513 } // end namespace MoochoPack
void print_step(const Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss, std::ostream &out, const std::string &leading_str) const
Thrown if a runtime test failed.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
T_To & dyn_cast(T_From &from)
rSQP Algorithm control class.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual std::ostream & journal_out() const
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
Reduced space SQP state encapsulation interface.
size_t size_type
AlgorithmTracker & track()
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
std::string typeName(const T &t)