Bonmin
1.7
|
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 "CoinWarmStartPrimalDual.hpp" 00016 #include "BonIpoptInteriorWarmStarter.hpp" 00017 00018 00019 namespace Bonmin 00020 { 00021 class TMINLP2TNLP; 00022 00046 class IpoptWarmStart : 00047 public virtual CoinWarmStartPrimalDual, public virtual CoinWarmStartBasis 00048 { 00049 public: 00050 00052 IpoptWarmStart(bool empty = 1, int numvars = 0, int numcont = 0); 00054 IpoptWarmStart(const Ipopt::SmartPtr<TMINLP2TNLP> tnlp, 00055 Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter); 00057 IpoptWarmStart(int primal_size, int dual_size, 00058 const double * primal, const double * dual); 00060 IpoptWarmStart( const IpoptWarmStart &other, bool ownValues = 1); 00062 IpoptWarmStart(const CoinWarmStartPrimalDual& pdws); 00064 virtual ~IpoptWarmStart(); 00065 00067 virtual CoinWarmStart *clone() const 00068 { 00069 return new IpoptWarmStart(*this,1); 00070 } 00071 00073 virtual CoinWarmStartDiff* 00074 generateDiff(const CoinWarmStart *const oldCWS) const; 00078 virtual void 00079 applyDiff (const CoinWarmStartDiff *const cwsdDiff); 00080 00082 Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter() const 00083 { 00084 return warm_starter_; 00085 } 00086 00088 void flushPoint(); 00089 00091 bool empty() const 00092 { 00093 return empty_; 00094 } 00095 private: 00097 mutable Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter_; 00099 bool empty_; 00100 }; 00101 00102 //########################################################################### 00103 00109 class IpoptWarmStartDiff : public CoinWarmStartPrimalDualDiff 00110 { 00111 public: 00112 friend class IpoptWarmStart; 00114 IpoptWarmStartDiff(CoinWarmStartPrimalDualDiff * diff, 00115 Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter): 00116 CoinWarmStartPrimalDualDiff(), 00117 warm_starter_(NULL)//(warm_starter) 00118 { 00119 CoinWarmStartPrimalDualDiff::swap(*diff); 00120 } 00122 IpoptWarmStartDiff(const IpoptWarmStartDiff &other): 00123 CoinWarmStartPrimalDualDiff(other), 00124 warm_starter_(NULL /*other.warm_starter_*/) {} 00125 00127 virtual ~IpoptWarmStartDiff() {} 00128 00130 virtual CoinWarmStartDiff *clone() const 00131 { 00132 return new IpoptWarmStartDiff(*this); 00133 } 00134 00136 Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter() const 00137 { 00138 return warm_starter_; 00139 } 00140 void flushPoint(); 00141 private: 00142 00144 Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter_; 00145 }; 00146 00147 } 00148 #endif