Ipopt Documentation  
 
Loading...
Searching...
No Matches
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// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6
7#ifndef __IPFILTER_HPP__
8#define __IPFILTER_HPP__
9
10#include "IpJournalist.hpp"
11#include "IpDebug.hpp"
12#include <list>
13#include <vector>
14
15namespace Ipopt
16{
17
20{
21public:
24
26 const std::vector<Number>& vals,
28 );
29
33
40 std::vector<Number> vals
41 ) const
42 {
43 Index ncoor = (Index) vals_.size();
44 DBG_ASSERT((Index)vals.size() == ncoor);
45
46 // ToDo decide if we need Compare_le
47 bool retval = false;
48 for( Index i = 0; i < ncoor; i++ )
49 {
50 if( vals[i] <= vals_[i] )
51 {
52 retval = true;
53 break;
54 }
55 }
56
57 return retval;
58 }
59
65 std::vector<Number> vals
66 ) const
67 {
68 Index ncoor = (Index) vals_.size();
69 DBG_ASSERT((Index)vals.size() == ncoor);
70
71 bool retval = true;
72 for( Index i = 0; i < ncoor; i++ )
73 {
74 if( vals[i] > vals_[i] )
75 {
76 retval = false;
77 break;
78 }
79 }
80
81 return retval;
82 }
83
87 Index i
88 ) const
89 {
90 return vals_[i];
91 }
92 Index iter() const
93 {
94 return iter_;
95 }
97
98private:
109
113 const FilterEntry&
114 );
115
118 const FilterEntry&
119 );
121
123 std::vector<Number> vals_;
126};
127
135{
136public:
139
141 Index dim
142 );
145 {
146 //ToDo figure out if that here is necessary
147 Clear();
148 }
150
157 std::vector<Number> vals
158 ) const;
159
166 std::vector<Number> vals,
167 Index iteration
168 );
169
173 Number val1,
174 Number val2
175 ) const
176 {
177 std::vector<Number> vals(2);
178 vals[0] = val1;
179 vals[1] = val2;
180
181 return Acceptable(vals);
182 }
183
185 Number val1,
186 Number val2,
187 Index iteration
188 )
189 {
190 std::vector<Number> vals(2);
191 vals[0] = val1;
192 vals[1] = val2;
193
194 AddEntry(vals, iteration);
195 }
197
199 void Clear();
200
202 void Print(
203 const Journalist& jnlst
204 );
205
206private:
217
221 const Filter&
222 );
223
226 const Filter&
227 );
229
232
234 mutable std::list<FilterEntry*> filter_list_;
235};
236
237} // namespace Ipopt
238
239#endif
#define DBG_ASSERT(test)
Definition IpDebug.hpp:27
Class for one filter entry.
Definition IpFilter.hpp:20
~FilterEntry()
Destructor.
FilterEntry(const std::vector< Number > &vals, Index iter)
Constructor with the two components and the current iteration count.
FilterEntry()
Default Constructor.
std::vector< Number > vals_
values defining the coordinates of the entry
Definition IpFilter.hpp:123
Index iter() const
Definition IpFilter.hpp:92
FilterEntry(const FilterEntry &)
Copy Constructor.
const Index iter_
iteration number in which this entry was added to filter
Definition IpFilter.hpp:125
Number val(Index i) const
Definition IpFilter.hpp:86
void operator=(const FilterEntry &)
Default Assignment Operator.
bool Dominated(std::vector< Number > vals) const
Check if this entry is dominated by given coordinates.
Definition IpFilter.hpp:64
bool Acceptable(std::vector< Number > vals) const
Check acceptability of pair (phi,theta) with respect to this filter entry.
Definition IpFilter.hpp:39
Class for the filter.
Definition IpFilter.hpp:135
~Filter()
Destructor.
Definition IpFilter.hpp:144
std::list< FilterEntry * > filter_list_
List storing the filter entries.
Definition IpFilter.hpp:234
void AddEntry(std::vector< Number > vals, Index iteration)
Add filter entry for given coordinates.
Filter()
Default Constructor.
Index dim_
Dimension of the filter (number of coordinates per entry)
Definition IpFilter.hpp:231
bool Acceptable(Number val1, Number val2) const
Definition IpFilter.hpp:172
void Clear()
Delete all filter entries.
Filter(const Filter &)
Copy Constructor.
bool Acceptable(std::vector< Number > vals) const
Check acceptability of given coordinates with respect to the filter.
Filter(Index dim)
Default Constructor.
void AddEntry(Number val1, Number val2, Index iteration)
Definition IpFilter.hpp:184
void Print(const Journalist &jnlst)
Print current filter entries.
void operator=(const Filter &)
Default Assignment Operator.
Class responsible for all message output.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition IpTypes.hpp:17