- Main Page
- Classes
- Files

- File List
- File Members

# src/Algorithm/IpAlgStrategy.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2004, 2006 International Business Machines and others.
    00002 // All Rights Reserved.
    00003 // This code is published under the Eclipse Public License.
    00004 //
    00005 // $Id: IpAlgStrategy.hpp 1861 2010-12-21 21:34:47Z andreasw $
    00006 //
    00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
    00008
    00009 #ifndef __IPALGSTRATEGY_HPP__
    00010 #define __IPALGSTRATEGY_HPP__
    00011
    00012 #include "IpOptionsList.hpp"
    00013 #include "IpJournalist.hpp"
    00014 #include "IpIpoptCalculatedQuantities.hpp"
    00015 #include "IpIpoptNLP.hpp"
    00016 #include "IpIpoptData.hpp"
    00017
    00018 namespace Ipopt
    00019 {
    00020
    00035   class AlgorithmStrategyObject : public ReferencedObject
    00036   {
    00037   public:
    00041     AlgorithmStrategyObject()
    00042         :
    00043         initialize_called_(false)
    00044     {}
    00045
    00047     virtual ~AlgorithmStrategyObject()
    00048     {}
    00050
    00066     bool Initialize(const Journalist& jnlst,
    00067                     IpoptNLP& ip_nlp,
    00068                     IpoptData& ip_data,
    00069                     IpoptCalculatedQuantities& ip_cq,
    00070                     const OptionsList& options,
    00071                     const std::string& prefix)
    00072     {
    00073       initialize_called_ = true;
    00074       // Copy the pointers for the problem defining objects
    00075       jnlst_ = &jnlst;
    00076       ip_nlp_ = &ip_nlp;
    00077       ip_data_ = &ip_data;
    00078       ip_cq_ = &ip_cq;
    00079
    00080       bool retval = InitializeImpl(options, prefix);
    00081       if (!retval) {
    00082         initialize_called_ = false;
    00083       }
    00084
    00085       return retval;
    00086     }
    00087
    00092     bool ReducedInitialize(const Journalist& jnlst,
    00093                            const OptionsList& options,
    00094                            const std::string& prefix)
    00095     {
    00096       initialize_called_ = true;
    00097       // Copy the pointers for the problem defining objects
    00098       jnlst_ = &jnlst;
    00099       ip_nlp_ = NULL;
    00100       ip_data_ = NULL;
    00101       ip_cq_ = NULL;
    00102
    00103       bool retval = InitializeImpl(options, prefix);
    00104       if (!retval) {
    00105         initialize_called_ = false;
    00106       }
    00107
    00108       return retval;
    00109     }
    00110
    00111   protected:
    00114     virtual bool InitializeImpl(const OptionsList& options,
    00115                                 const std::string& prefix)=0;
    00116
    00120     const Journalist& Jnlst() const
    00121     {
    00122       DBG_ASSERT(initialize_called_);
    00123       return *jnlst_;
    00124     }
    00125     IpoptNLP& IpNLP() const
    00126     {
    00127       DBG_ASSERT(initialize_called_);
    00128       DBG_ASSERT(IsValid(ip_nlp_));
    00129       return *ip_nlp_;
    00130     }
    00131     IpoptData& IpData() const
    00132     {
    00133       DBG_ASSERT(initialize_called_);
    00134       DBG_ASSERT(IsValid(ip_data_));
    00135       return *ip_data_;
    00136     }
    00137     IpoptCalculatedQuantities& IpCq() const
    00138     {
    00139       DBG_ASSERT(initialize_called_);
    00140       DBG_ASSERT(IsValid(ip_cq_));
    00141       return *ip_cq_;
    00142     }
    00143     bool HaveIpData() const
    00144     {
    00145       return IsValid(ip_data_);
    00146     }
    00148
    00149   private:
    00159     //AlgorithmStrategyObject();
    00160
    00161
    00163     AlgorithmStrategyObject(const AlgorithmStrategyObject&);
    00164
    00166     void operator=(const AlgorithmStrategyObject&);
    00168
    00172     SmartPtr<const Journalist> jnlst_;
    00173     SmartPtr<IpoptNLP> ip_nlp_;
    00174     SmartPtr<IpoptData> ip_data_;
    00175     SmartPtr<IpoptCalculatedQuantities> ip_cq_;
    00177
    00180     bool initialize_called_;
    00181   };
    00182
    00183 } // namespace Ipopt
    00184
    00185 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines