1 // Copyright (C) 2008 International Business Machines and others. 2 // All Rights Reserved. 3 // This code is published under the Eclipse Public License. 4 // 5 // $Id$ 6 // 7 // Authors: Andreas Waechter IBM 2008-09-19 8 9 #ifndef __IPINEXACTNORMALTERMINATIONTESTER_HPP__ 10 #define __IPINEXACTNORMALTERMINATIONTESTER_HPP__ 11 12 #include "IpIterativeSolverTerminationTester.hpp" 13 14 namespace Ipopt 15 { 16 17 /** This class implements the termination tests for the primal-dual 18 * system. 19 */ 20 class InexactNormalTerminationTester: public IterativeSolverTerminationTester 21 { 22 public: 23 /** @name /Destructor */ 24 //@{ 25 /** Default constructor 26 */ 27 InexactNormalTerminationTester(); 28 29 /** Default destructor */ 30 virtual ~InexactNormalTerminationTester(); 31 //@} 32 33 /* overloaded from AlgorithmStrategyObject */ 34 virtual bool InitializeImpl(const OptionsList& options, 35 const std::string& prefix); 36 37 /** Methods for IpoptType */ 38 //@{ 39 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 40 //@} 41 42 /** Method for initializing for the next iterative solve. This 43 * must be call before the test methods are called. */ 44 virtual bool InitializeSolve(); 45 46 /** This method checks if the current soltion of the iterative 47 * linear solver is good enough (by returning the corresponding 48 * satisfied termination test), or if the Hessian should be 49 * modified. The input is the dimension of the augmented system, 50 * the current solution vector of the augmented system, the 51 * current residual vector. */ 52 virtual ETerminationTest TestTermination(Index ndim, const Number* sol, 53 const Number* resid, Index iter, 54 Number norm2_rhs); 55 56 /** This method can be called after the Solve is over and we can 57 * delete anything that has been allocated to free memory. */ 58 virtual void Clear(); 59 60 61 /** Return the number of iterative solver iteration from the most 62 * recent solve */ GetSolverIterations() const63 virtual Index GetSolverIterations() const 64 { 65 return last_iter_; 66 } 67 68 /** Method for setting the normal problem objective function value 69 * at the Cauchy step. This must be called by the Dogleg 70 * object. */ Set_c_Avc_norm_cauchy(Number c_Avc_norm_cauchy)71 void Set_c_Avc_norm_cauchy(Number c_Avc_norm_cauchy) 72 { 73 c_Avc_norm_cauchy_ = c_Avc_norm_cauchy; 74 } 75 76 private: 77 /**@name Default Compiler Generated Methods 78 * (Hidden to avoid implicit creation/calling). 79 * These methods are not implemented and 80 * we do not want the compiler to implement 81 * them for us, so we declare them private 82 * and do not define them. This ensures that 83 * they will not be implicitly created/called. */ 84 //@{ 85 /** Overloaded Equals Operator */ 86 InexactNormalTerminationTester& operator=(const InexactNormalTerminationTester&); 87 //@} 88 89 /** @name Algorithmic options */ 90 //@{ 91 /** Desired reduction of residual */ 92 Number inexact_normal_tol_; 93 /** Maximal number of iterative solve iterations */ 94 Index inexact_normal_max_iter_; 95 /** Is set to true if the linear system is scaled via slacks. */ 96 bool requires_scaling_; 97 //@} 98 99 /** Value of normal problem objective function achived by the 100 * Cauchy step. This must be set by the Dogleg step object. */ 101 Number c_Avc_norm_cauchy_; 102 103 /** Last iterative solver iteration counter */ 104 Index last_iter_; 105 }; 106 107 } // namespace Ipopt 108 109 #endif 110