Bonmin  1.8.8
BonIpoptWarmStart.hpp
Go to the documentation of this file.
1 // (C) Copyright International Business Machines Corporation, Carnegie Mellon University 2006
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors :
6 // Pierre Bonami, Carnegie Mellon University,
7 // Andreas Waechter, International Business Machines Corporation
8 //
9 // Date : 02/15/2006
10 
11 
12 #ifndef IpoptWarmStart_HPP
13 #define IpoptWarmStart_HPP
14 #include "CoinWarmStartBasis.hpp"
15 #include "CoinWarmStartPrimalDual.hpp"
17 
18 
19 namespace Bonmin
20 {
21  class TMINLP2TNLP;
22 
47  public virtual CoinWarmStartPrimalDual, public virtual CoinWarmStartBasis
48  {
49  public:
50 
52  IpoptWarmStart(bool empty = 1, int numvars = 0, int numcont = 0);
54  IpoptWarmStart(const Ipopt::SmartPtr<TMINLP2TNLP> tnlp,
55  Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter);
57  IpoptWarmStart(int primal_size, int dual_size,
58  const double * primal, const double * dual);
60  IpoptWarmStart( const IpoptWarmStart &other, bool ownValues = 1);
62  IpoptWarmStart(const CoinWarmStartPrimalDual& pdws);
64  virtual ~IpoptWarmStart();
65 
67  virtual CoinWarmStart *clone() const
68  {
69  return new IpoptWarmStart(*this,1);
70  }
71 
73  virtual CoinWarmStartDiff*
74  generateDiff(const CoinWarmStart *const oldCWS) const;
78  virtual void
79  applyDiff (const CoinWarmStartDiff *const cwsdDiff);
80 
82  Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter() const
83  {
84  return warm_starter_;
85  }
86 
88  void flushPoint();
89 
91  bool empty() const
92  {
93  return empty_;
94  }
95  private:
97  mutable Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter_;
99  bool empty_;
100  };
101 
102  //###########################################################################
103 
109  class IpoptWarmStartDiff : public CoinWarmStartPrimalDualDiff
110  {
111  public:
112  friend class IpoptWarmStart;
114  IpoptWarmStartDiff(CoinWarmStartPrimalDualDiff * diff,
115  Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter):
116  CoinWarmStartPrimalDualDiff(),
117  warm_starter_(NULL)//(warm_starter)
118  {
119  CoinWarmStartPrimalDualDiff::swap(*diff);
120  }
123  CoinWarmStartPrimalDualDiff(other),
124  warm_starter_(NULL /*other.warm_starter_*/) {}
125 
127  virtual ~IpoptWarmStartDiff() {}
128 
130  virtual CoinWarmStartDiff *clone() const
131  {
132  return new IpoptWarmStartDiff(*this);
133  }
134 
136  Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter() const
137  {
138  return warm_starter_;
139  }
140  void flushPoint();
141  private:
142 
144  Ipopt::SmartPtr<IpoptInteriorWarmStarter> warm_starter_;
145  };
146 
147 }
148 #endif
IpoptWarmStartDiff(const IpoptWarmStartDiff &other)
Copy constructor.
Ipopt::SmartPtr< IpoptInteriorWarmStarter > warm_starter_
warm start information object
Class for storing warm start informations for Ipopt.
virtual void applyDiff(const CoinWarmStartDiff *const cwsdDiff)
Apply &#39;differences&#39; to an Ipopt warm start.
Ipopt::SmartPtr< IpoptInteriorWarmStarter > warm_starter() const
Accessor to warm start information obecjt.
virtual CoinWarmStartDiff * generateDiff(const CoinWarmStart *const oldCWS) const
Generate the &quot;differences&quot; between two IpoptWarmStart.
virtual CoinWarmStartDiff * clone() const
`Virtual constructor&#39;
virtual CoinWarmStart * clone() const
`Virtual constructor&#39;
virtual ~IpoptWarmStart()
Abstract destructor.
Ipopt::SmartPtr< IpoptInteriorWarmStarter > warm_starter() const
Accessor to warm start information obecjt.
Ipopt::SmartPtr< IpoptInteriorWarmStarter > warm_starter_
warm start information object
virtual ~IpoptWarmStartDiff()
Abstract destructor.
bool empty_
Say if warm start is empty.
Diff class for IpoptWarmStart.
IpoptWarmStartDiff(CoinWarmStartPrimalDualDiff *diff, Ipopt::SmartPtr< IpoptInteriorWarmStarter > warm_starter)
Useful constructor; takes over the data in diff.
IpoptWarmStart(bool empty=1, int numvars=0, int numcont=0)
Default constructor.
bool empty() const
Is this an empty warm start?
void flushPoint()
flush the starting point