/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/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 Common Public License.
00004 //
00005 // $Id: IpAlgStrategy.hpp 798 2006-10-13 19:58:22Z 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 
00016 namespace Ipopt
00017 {
00018 
00033   class AlgorithmStrategyObject : public ReferencedObject
00034   {
00035   public:
00039     AlgorithmStrategyObject()
00040         :
00041         initialize_called_(false)
00042     {}
00043 
00045     virtual ~AlgorithmStrategyObject()
00046     {}
00048 
00064     bool Initialize(const Journalist& jnlst,
00065                     IpoptNLP& ip_nlp,
00066                     IpoptData& ip_data,
00067                     IpoptCalculatedQuantities& ip_cq,
00068                     const OptionsList& options,
00069                     const std::string& prefix)
00070     {
00071       initialize_called_ = true;
00072       // Copy the pointers for the problem defining objects
00073       jnlst_ = &jnlst;
00074       ip_nlp_ = &ip_nlp;
00075       ip_data_ = &ip_data;
00076       ip_cq_ = &ip_cq;
00077 
00078       bool retval = InitializeImpl(options, prefix);
00079       if (!retval) {
00080         initialize_called_ = false;
00081       }
00082 
00083       return retval;
00084     }
00085 
00090     bool ReducedInitialize(const Journalist& jnlst,
00091                            const OptionsList& options,
00092                            const std::string& prefix)
00093     {
00094       initialize_called_ = true;
00095       // Copy the pointers for the problem defining objects
00096       jnlst_ = &jnlst;
00097       ip_nlp_ = NULL;
00098       ip_data_ = NULL;
00099       ip_cq_ = NULL;
00100 
00101       bool retval = InitializeImpl(options, prefix);
00102       if (!retval) {
00103         initialize_called_ = false;
00104       }
00105 
00106       return retval;
00107     }
00108 
00109   protected:
00112     virtual bool InitializeImpl(const OptionsList& options,
00113                                 const std::string& prefix)=0;
00114 
00118     const Journalist& Jnlst() const
00119     {
00120       DBG_ASSERT(initialize_called_);
00121       return *jnlst_;
00122     }
00123     IpoptNLP& IpNLP() const
00124     {
00125       DBG_ASSERT(initialize_called_);
00126       DBG_ASSERT(IsValid(ip_nlp_));
00127       return *ip_nlp_;
00128     }
00129     IpoptData& IpData() const
00130     {
00131       DBG_ASSERT(initialize_called_);
00132       DBG_ASSERT(IsValid(ip_data_));
00133       return *ip_data_;
00134     }
00135     IpoptCalculatedQuantities& IpCq() const
00136     {
00137       DBG_ASSERT(initialize_called_);
00138       DBG_ASSERT(IsValid(ip_cq_));
00139       return *ip_cq_;
00140     }
00141     bool HaveIpData() const
00142     {
00143       return IsValid(ip_data_);
00144     }
00146 
00147   private:
00157     //AlgorithmStrategyObject();
00158 
00159 
00161     AlgorithmStrategyObject(const AlgorithmStrategyObject&);
00162 
00164     void operator=(const AlgorithmStrategyObject&);
00166 
00170     SmartPtr<const Journalist> jnlst_;
00171     SmartPtr<IpoptNLP> ip_nlp_;
00172     SmartPtr<IpoptData> ip_data_;
00173     SmartPtr<IpoptCalculatedQuantities> ip_cq_;
00175 
00178     bool initialize_called_;
00179   };
00180 
00181 } // namespace Ipopt
00182 
00183 #endif

Generated on Sun Nov 14 14:06:34 2010 for Coin-All by  doxygen 1.4.7