IpoptWarmStart.hpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation, Carnegie Mellon University 2006
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, Carnegie Mellon University,
00007 // Andreas Waechter, International Business Machines Corporation
00008 //
00009 // Date : 02/15/2006
00010 
00011 
00012 #ifndef IpoptWarmStart_HPP
00013 #define IpoptWarmStart_HPP
00014 #include "CoinWarmStartBasis.hpp"
00015 #include "CoinPackedVector.hpp"
00016 #include "IpoptInteriorWarmStarter.hpp"
00017 
00018 class IpoptInterface;
00019 
00025 class IpoptWarmStart : public CoinWarmStartBasis
00026 {
00027 public:
00028 
00030   IpoptWarmStart(bool empty = 1, int numvars = 0, int numcont = 0);
00032   IpoptWarmStart(const IpoptInterface &ipopt,
00033       SmartPtr<IpoptInteriorWarmStarter> warm_starter);
00035   IpoptWarmStart( const IpoptWarmStart &other, bool ownValues = 1);
00037   virtual ~IpoptWarmStart();
00038 
00040   virtual CoinWarmStart *clone() const
00041   {
00042     return new IpoptWarmStart(*this,1);
00043   }
00044 
00046   virtual CoinWarmStartDiff*
00047   generateDiff(const CoinWarmStart *const oldCWS) const;
00051   virtual void
00052   applyDiff (const CoinWarmStartDiff *const cwsdDiff);
00054   const CoinPackedVector * values() const
00055   {
00056     if(tempValues_)
00057       return tempValues_;
00058     else
00059       return &values_;
00060   }
00062   SmartPtr<IpoptInteriorWarmStarter> warm_starter() const
00063   {
00064     return warm_starter_;
00065   }
00066 
00068   void flushPoint();
00069 
00071   bool empty() const
00072   {
00073     return empty_;
00074   }
00075 private:
00084   mutable CoinPackedVector values_;
00086   mutable CoinPackedVector * tempValues_;
00088   mutable SmartPtr<IpoptInteriorWarmStarter> warm_starter_;
00090   bool empty_;
00091 };
00092 
00098 class IpoptWarmStartDiff : public CoinWarmStartBasisDiff
00099 {
00100 public:
00101   friend class IpoptWarmStart;
00103   IpoptWarmStartDiff(CoinWarmStartBasisDiff * diff, const CoinPackedVector &values,
00104       SmartPtr<IpoptInteriorWarmStarter> warm_starter):
00105       CoinWarmStartBasisDiff(*diff),
00106       diffValues_(NULL),
00107       warm_starter_(NULL)//(warm_starter)
00108   {
00109     if(values.getNumElements()>0)
00110       diffValues_ = new CoinPackedVector(values);
00111   }
00113   IpoptWarmStartDiff(const IpoptWarmStartDiff &other):
00114       CoinWarmStartBasisDiff(other),
00115       diffValues_(NULL),
00116       warm_starter_(NULL)//other.warm_starter_)
00117   {
00118     if(other.diffValues_)
00119       diffValues_ = new CoinPackedVector(*other.diffValues_);
00120   }
00121 
00123   virtual ~IpoptWarmStartDiff()
00124   {
00125     delete diffValues_;
00126   }
00127 
00129   virtual CoinWarmStartDiff *clone() const
00130   {
00131     return new IpoptWarmStartDiff(*this);
00132   }
00133 
00135   SmartPtr<IpoptInteriorWarmStarter> warm_starter() const
00136   {
00137     return warm_starter_;
00138   }
00139   void flushPoint();
00140 private:
00142   CoinPackedVector * diffValues_;
00143 
00145   SmartPtr<IpoptInteriorWarmStarter> warm_starter_;
00146 };
00147 #endif

Generated on Fri May 16 21:06:00 2008 for Bonmin by  doxygen 1.4.7