# IpIterativeSolverTerminationTester.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2008 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Eclipse Public License.
    00004 //
    00005 // $Id: IpIterativeSolverTerminationTester.hpp 1861 2010-12-21 21:34:47Z andreasw $
    00006 //
    00007 // Authors:  Andreas Waechter            IBM    2008-09-19
    00008
    00009 #ifndef __IPITERATIVESOLVERTERMINATIONTESTER_HPP__
    00010 #define __IPITERATIVESOLVERTERMINATIONTESTER_HPP__
    00011
    00012 #include "IpAlgStrategy.hpp"
    00013 #include "IpInexactCq.hpp"
    00014
    00015 namespace Ipopt
    00016 {
    00017
    00021   class IterativeSolverTerminationTester: public AlgorithmStrategyObject
    00022   {
    00023   public:
    00025     enum ETerminationTest {
    00027       CONTINUE,
    00029       TEST_1_SATISFIED,
    00031       TEST_2_SATISFIED,
    00033       TEST_3_SATISFIED,
    00035       MODIFY_HESSIAN,
    00037       OTHER_SATISFIED
    00038     };
    00039
    00044     IterativeSolverTerminationTester()
    00045     {}
    00046
    00048     virtual ~IterativeSolverTerminationTester()
    00049     {}
    00051
    00052     /* overloaded from AlgorithmStrategyObject */
    00053     virtual bool InitializeImpl(const OptionsList& options,
    00054                                 const std::string& prefix) = 0;
    00055
    00056
    00059     virtual bool InitializeSolve() = 0;
    00060
    00067     virtual ETerminationTest TestTermination(Index ndim, const Number* sol,
    00068         const Number* resid, Index iter,
    00069         Number norm2_rhs) = 0;
    00070
    00073     virtual void Clear() = 0;
    00074
    00076     const Journalist& GetJnlst() const
    00077     {
    00078       return Jnlst();
    00079     }
    00080
    00083     virtual Index GetSolverIterations() const = 0;
    00084
    00085   protected:
    00088     void GetVectors(Index ndim, const Number* array,
    00089                     SmartPtr<const Vector>& comp_x,
    00090                     SmartPtr<const Vector>& comp_s,
    00091                     SmartPtr<const Vector>& comp_c,
    00092                     SmartPtr<const Vector>& comp_d);
    00093
    00095     InexactData& InexData()
    00096     {
    00097       InexactData& inexact_data =
    00098         static_cast<InexactData&>(IpData().AdditionalData());
    00099       DBG_ASSERT(dynamic_cast<InexactData*>(&IpData().AdditionalData()));
    00100       return inexact_data;
    00101     }
    00102
    00104     InexactCq& InexCq()
    00105     {
    00106       InexactCq& inexact_cq =
    00107         static_cast<InexactCq&>(IpCq().AdditionalCq());
    00108       DBG_ASSERT(dynamic_cast<InexactCq*>(&IpCq().AdditionalCq()));
    00109       return inexact_cq;
    00110     }
    00111
    00112   private:
    00113
    00123     IterativeSolverTerminationTester& operator=(const IterativeSolverTerminationTester&);
    00125   };
    00126
    00127 } // namespace Ipopt
    00128
    00129 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines