Ipopt Documentation  
 
Loading...
Searching...
No Matches
IpAlgStrategy.hpp
Go to the documentation of this file.
1// Copyright (C) 2004, 2006 International Business Machines and others.
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6
7#ifndef __IPALGSTRATEGY_HPP__
8#define __IPALGSTRATEGY_HPP__
9
10#include "IpOptionsList.hpp"
11#include "IpJournalist.hpp"
13#include "IpIpoptNLP.hpp"
14#include "IpIpoptData.hpp"
15
16namespace Ipopt
17{
18
35{
36public:
39
41 : initialize_called_(false)
42 { }
43
46 { }
48
67 const Journalist& jnlst,
68 IpoptNLP& ip_nlp,
69 IpoptData& ip_data,
71 const OptionsList& options,
72 const std::string& prefix
73 )
74 {
75 initialize_called_ = true;
76 // Copy the pointers for the problem defining objects
77 jnlst_ = &jnlst;
78 ip_nlp_ = &ip_nlp;
79 ip_data_ = &ip_data;
80 ip_cq_ = &ip_cq;
81
82 bool retval = InitializeImpl(options, prefix);
83 if( !retval )
84 {
85 initialize_called_ = false;
86 }
87
88 return retval;
89 }
90
98 const Journalist& jnlst,
99 const OptionsList& options,
100 const std::string& prefix
101 )
102 {
103 initialize_called_ = true;
104 // Copy the pointers for the problem defining objects
105 jnlst_ = &jnlst;
106 ip_nlp_ = NULL;
107 ip_data_ = NULL;
108 ip_cq_ = NULL;
109
110 bool retval = InitializeImpl(options, prefix);
111 if( !retval )
112 {
113 initialize_called_ = false;
114 }
115
116 return retval;
117 }
118
119protected:
123 virtual bool InitializeImpl(
124 const OptionsList& options,
125 const std::string& prefix
126 ) = 0;
127
133 const Journalist& Jnlst() const
134 {
135 DBG_ASSERT(initialize_called_);
136 return *jnlst_;
137 }
139 {
140 DBG_ASSERT(initialize_called_);
141 DBG_ASSERT(IsValid(ip_nlp_));
142 return *ip_nlp_;
143 }
145 {
146 DBG_ASSERT(initialize_called_);
147 DBG_ASSERT(IsValid(ip_data_));
148 return *ip_data_;
149 }
151 {
152 DBG_ASSERT(initialize_called_);
153 DBG_ASSERT(IsValid(ip_cq_));
154 return *ip_cq_;
155 }
156 bool HaveIpData() const
157 {
158 return IsValid(ip_data_);
159 }
161
162private:
173
174 //AlgorithmStrategyObject();
175
179 );
180
184 );
186
194
197};
198
199} // namespace Ipopt
200
201#endif
#define DBG_ASSERT(test)
Definition IpDebug.hpp:27
This is the base class for all algorithm strategy objects.
SmartPtr< IpoptCalculatedQuantities > ip_cq_
SmartPtr< IpoptData > ip_data_
void operator=(const AlgorithmStrategyObject &)
Default Assignment Operator.
AlgorithmStrategyObject(const AlgorithmStrategyObject &)
Default Constructor.
virtual bool InitializeImpl(const OptionsList &options, const std::string &prefix)=0
Implementation of the initialization method that has to be overloaded by for each derived class.
bool initialize_called_
flag indicating if Initialize method has been called (for debugging)
IpoptCalculatedQuantities & IpCq() const
bool Initialize(const Journalist &jnlst, IpoptNLP &ip_nlp, IpoptData &ip_data, IpoptCalculatedQuantities &ip_cq, const OptionsList &options, const std::string &prefix)
This method is called every time the algorithm starts again - it is used to reset any internal state.
bool ReducedInitialize(const Journalist &jnlst, const OptionsList &options, const std::string &prefix)
Reduced version of the Initialize method, which does not require special Ipopt information.
SmartPtr< const Journalist > jnlst_
const Journalist & Jnlst() const
virtual ~AlgorithmStrategyObject()
Destructor.
AlgorithmStrategyObject()
Default Constructor.
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
This is the abstract base class for classes that map the traditional NLP into something that is more ...
Class responsible for all message output.
This class stores a list of user set options.
Storing the reference count of all the smart pointers that currently reference it.
Template class for Smart Pointers.
#define IPOPTLIB_EXPORT
This file contains a base class for all exceptions and a set of macros to help with exceptions.
bool IsValid(const SmartPtr< U > &smart_ptr)