| 1 |
// (C) Copyright International Business Machines Corporation 2006 |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// $Id$ |
| 6 |
// |
| 7 |
// Authors: Andreas Waechter IBM 2006-03-02 |
| 8 |
|
| 9 |
#ifndef __IPOPTINTERIORWARMSTARTER_HPP__ |
| 10 |
#define __IPOPTINTERIORWARMSTARTER_HPP__ |
| 11 |
|
| 12 |
#include "IpSmartPtr.hpp" |
| 13 |
#include "IpNLP.hpp" |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
namespace Bonmin |
| 17 |
{ |
| 18 |
class IpoptInteriorWarmStarter : public Ipopt::ReferencedObject |
| 19 |
{ |
| 20 |
public: |
| 21 |
/**@name Constructors/Destructors */ |
| 22 |
//@{ |
| 23 |
/** Constructor. We give it the values of the current bounds so that |
| 24 |
* it can figure out which variables are fixed for this NLP. */ |
| 25 |
IpoptInteriorWarmStarter(Ipopt::Index n, const Ipopt::Number* x_L, const Ipopt::Number* x_u, |
| 26 |
Ipopt::Number nlp_lower_bound_inf, |
| 27 |
Ipopt::Number nlp_upper_bound_inf, |
| 28 |
bool store_several_iterates); |
| 29 |
|
| 30 |
/** Default destructor */ |
| 31 |
~IpoptInteriorWarmStarter(); |
| 32 |
//@} |
| 33 |
|
| 34 |
/** Method for possibly storing another iterate during the current |
| 35 |
* optimizatin for possible use for a warm start for a new |
| 36 |
* problem */ |
| 37 |
bool UpdateStoredIterates(Ipopt::AlgorithmMode mode, |
| 38 |
const Ipopt::IpoptData& ip_data, |
| 39 |
Ipopt::IpoptCalculatedQuantities& ip_cq); |
| 40 |
|
| 41 |
/** Method for doing whatever needs to be done after the parent NLP |
| 42 |
* has been solved */ |
| 43 |
bool Finalize(); |
| 44 |
|
| 45 |
/** Method for computing the initial point based on the stored |
| 46 |
* information */ |
| 47 |
bool WarmStartIterate(Ipopt::Index n, const Ipopt::Number* x_l_new, const Ipopt::Number* x_u_new, |
| 48 |
Ipopt::IteratesVector& warm_start_iterate); |
| 49 |
|
| 50 |
private: |
| 51 |
/**@name Default Compiler Generated Methods |
| 52 |
* (Hidden to avoid implicit creation/calling). |
| 53 |
* These methods are not implemented and |
| 54 |
* we do not want the compiler to implement |
| 55 |
* them for us, so we declare them private |
| 56 |
* and do not define them. This ensures that |
| 57 |
* they will not be implicitly created/called. */ |
| 58 |
//@{ |
| 59 |
/** Default constructor. */ |
| 60 |
IpoptInteriorWarmStarter(); |
| 61 |
|
| 62 |
/** Copy Constructor */ |
| 63 |
IpoptInteriorWarmStarter(const IpoptInteriorWarmStarter&); |
| 64 |
|
| 65 |
/** Overloaded Equals Operator */ |
| 66 |
void operator=(const IpoptInteriorWarmStarter&); |
| 67 |
//@} |
| 68 |
|
| 69 |
//@{ |
| 70 |
/** Value for a lower bound that denotes -infinity */ |
| 71 |
Ipopt::Number nlp_lower_bound_inf_; |
| 72 |
/** Value for a upper bound that denotes infinity */ |
| 73 |
Ipopt::Number nlp_upper_bound_inf_; |
| 74 |
/** Flag indicating whether more than one iterate is to be |
| 75 |
* stored. */ |
| 76 |
bool store_several_iterates_; |
| 77 |
//@} |
| 78 |
|
| 79 |
/** @name Copy of the bounds for the previously solved NLP. This is |
| 80 |
* required to find out the remapping for fixed variables, and it |
| 81 |
* might also help to see how large the perturbation of the new |
| 82 |
* problem is. */ |
| 83 |
//@{ |
| 84 |
Ipopt::Index n_; |
| 85 |
Ipopt::Number* x_l_prev_; |
| 86 |
Ipopt::Number* x_u_prev_; |
| 87 |
//@} |
| 88 |
|
| 89 |
/** @name Selected Iterates and quantities from the previous |
| 90 |
* optimization */ |
| 91 |
//@{ |
| 92 |
Ipopt::Index n_stored_iterates_; |
| 93 |
std::vector<Ipopt::Index> stored_iter_; |
| 94 |
std::vector<Ipopt::SmartPtr<const Ipopt::IteratesVector> > stored_iterates_; |
| 95 |
std::vector<Ipopt::Number> stored_mu_; |
| 96 |
std::vector<Ipopt::Number> stored_nlp_error_; |
| 97 |
std::vector<Ipopt::Number> stored_primal_inf_; |
| 98 |
std::vector<Ipopt::Number> stored_dual_inf_; |
| 99 |
std::vector<Ipopt::Number> stored_compl_; |
| 100 |
//@} |
| 101 |
}; |
| 102 |
} |
| 103 |
#endif |