Ipopt 3.12.10

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IpFilter.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 // $Id: IpFilter.hpp 1861 2010-12-21 21:34:47Z andreasw $
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8
9 #ifndef __IPFILTER_HPP__
10 #define __IPFILTER_HPP__
11
12 #include "IpJournalist.hpp"
13 #include "IpDebug.hpp"
14 #include <list>
15 #include <vector>
16
17 namespace Ipopt
18 {
19
21 class FilterEntry
22 {
23 public:
27 FilterEntry(std::vector<Number> vals, Index iter);
28
30 ~FilterEntry();
32
36 bool Acceptable(std::vector<Number> vals) const
37 {
38 Index ncoor = (Index)vals_.size();
39 DBG_ASSERT((Index)vals.size() == ncoor);
40
41 // ToDo decide if we need Compare_le
42 bool retval = false;
43 for (Index i=0; i<ncoor; i++) {
44 if (vals[i] <= vals_[i]) {
45 retval = true;
46 break;
47 }
48 }
49
50 return retval;
51 }
52
56 bool Dominated(std::vector<Number> vals) const
57 {
58 Index ncoor = (Index)vals_.size();
59 DBG_ASSERT((Index)vals.size() == ncoor);
60
61 bool retval = true;
62 for (Index i=0; i<ncoor; i++) {
63 if (vals[i] > vals_[i]) {
64 retval = false;
65 break;
66 }
67 }
68
69 return retval;
70 }
71
74 Number val(Index i) const
75 {
76 return vals_[i];
77 }
78 Index iter() const
79 {
80 return iter_;
81 }
83
84 private:
94 FilterEntry();
96 FilterEntry(const FilterEntry&);
97
99 void operator=(const FilterEntry&);
101
103 std::vector<Number> vals_;
105 const Index iter_;
106 };
107
111 class Filter
112 {
113 public:
117 Filter(Index dim);
119 ~Filter()
120 {
121 //ToDo figure out if that here is necessary
122 Clear();
123 }
125
129 bool Acceptable(std::vector<Number> vals) const;
130
133 void AddEntry(std::vector<Number> vals, Index iteration);
134
137 bool Acceptable(Number val1, Number val2) const
138 {
139 std::vector<Number> vals(2);
140 vals[0] = val1;
141 vals[1] = val2;
142
143 return Acceptable(vals);
144 }
145
146 void AddEntry(Number val1, Number val2, Index iteration)
147 {
148 std::vector<Number> vals(2);
149 vals[0] = val1;
150 vals[1] = val2;
151
152 AddEntry(vals, iteration);
153 }
155
157 void Clear();
158
160 void Print(const Journalist& jnlst);
161
162 private:
172 Filter();
174 Filter(const Filter&);
175
177 void operator=(const Filter&);
179
181 Index dim_;
182
184 mutable std::list<FilterEntry*> filter_list_;
185 };
186
187 } // namespace Ipopt
188
189 #endif
Ipopt::FilterEntry::Acceptable
bool Acceptable(std::vector< Number > vals) const
Check acceptability of pair (phi,theta) with respect to this filter entry.
Definition: IpFilter.hpp:36
Ipopt::Filter::AddEntry
void AddEntry(Number val1, Number val2, Index iteration)
Definition: IpFilter.hpp:146
Ipopt::FilterEntry::val
Number val(Index i) const
Definition: IpFilter.hpp:74
Ipopt::FilterEntry::FilterEntry
FilterEntry()
Default Constructor.
Ipopt::Filter::Filter
Filter()
Default Constructor.
Ipopt::Filter::filter_list_
std::list< FilterEntry * > filter_list_
List storing the filter entries.
Definition: IpFilter.hpp:184
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Filter::Acceptable
bool Acceptable(std::vector< Number > vals) const
Check acceptability of given coordinates with respect to the filter.
Ipopt::FilterEntry::~FilterEntry
~FilterEntry()
Default Destructor.
Ipopt::Filter::Acceptable
bool Acceptable(Number val1, Number val2) const
Definition: IpFilter.hpp:137
Ipopt::Filter::dim_
Index dim_
Dimension of the filter (number of coordinates per entry)
Definition: IpFilter.hpp:181
Ipopt::Filter::Clear
void Clear()
Delete all filter entries.
Ipopt::Filter::Print
void Print(const Journalist &jnlst)
Print current filter entries.
Ipopt::FilterEntry::iter
Index iter() const
Definition: IpFilter.hpp:78
IpDebug.hpp
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
DBG_ASSERT
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:38
Ipopt::FilterEntry::Dominated
bool Dominated(std::vector< Number > vals) const
Check if this entry is dominated by given coordinates.
Definition: IpFilter.hpp:56
Ipopt::Filter::AddEntry
void AddEntry(std::vector< Number > vals, Index iteration)
Add filter entry for given coordinates.
Ipopt::FilterEntry::iter_
const Index iter_
iteration number in which this entry was added to filter
Definition: IpFilter.hpp:105
IpJournalist.hpp
Ipopt::FilterEntry
Class for one filter entry.
Definition: IpFilter.hpp:21
Ipopt::Filter::~Filter
~Filter()
Default Destructor.
Definition: IpFilter.hpp:119
Ipopt::Journalist
Class responsible for all message output.
Definition: IpJournalist.hpp:134
Ipopt::Filter
Class for the filter.
Definition: IpFilter.hpp:111
Ipopt::FilterEntry::operator=
void operator=(const FilterEntry &)
Overloaded Equals Operator.
Ipopt::FilterEntry::vals_
std::vector< Number > vals_
values defining the coordinates of the entry
Definition: IpFilter.hpp:103
Ipopt::Filter::operator=
void operator=(const Filter &)
Overloaded Equals Operator.