The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
cLinearConstrainFix.h
Go to the documentation of this file.
1
/**
2
* @file cLinearConstrainFix
3
* file name: cLinearConstrainFix.h
4
* @author Betti Oesterholz
5
* @date 08.06.2010
6
* @mail webmaster@BioKom.info
7
*
8
* System: C++
9
*
10
* This header specifies a class for a linear constrain.
11
* Copyright (C) @c GPL3 2010 Betti Oesterholz
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License (GPL) as
15
* published by the Free Software Foundation, either version 3 of the
16
* License, or any later version.
17
*
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU Lesser General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
*
26
*
27
* This header specifies a class for a linear constrain.
28
* The number of factors are fixed in this inequiations.
29
* This constrain has the implicite form:
30
* vecBounderyFactors[0] * yu_0 + ... + vecBounderyFactors[uiNumberOfDataPoints-1] * yu_{uiNumberOfDataPoints-1}
31
* (bGreaterEqual ? <= : =>)
32
* constant + vecFactors[0] * x_0 + ... + vecFactors[uiNumberOfFactors-1] * x_[uiNumberOfFactors-1}
33
* (bGreaterEqual ? <= : =>)
34
* vecBounderyFactors[0] * yo_0 + ... + vecBounderyFactors[uiNumberOfDataPoints-1] * yo_{uiNumberOfDataPoints-1}
35
*
36
* Wher:
37
* - yu_i: are the lower bounderies for the y variables
38
* - yo_i: are the upper bounderies for the y variables
39
* - vecBounderyFactors[i]: is the factor for the lower and upper y factors
40
* - bGreaterEqual: is a boolean, if the inequiation sign is greater equal "<="
41
* ( if bGreaterEqual == true ) or lower equal ">=" ( if bGreaterEqual == false )
42
* - constant: is a constant factor for the linear inequiation
43
* - vecFactors[k]: are the factors for the x variables
44
*
45
* The x and the y variables are not given. (In the common case they
46
* should be evalued with the help of this constrain.)
47
*
48
* The y bounderies are for example implemented in @see cDataPointRange.
49
* This linear constrain can represent a formular for the y values with
50
* linear dependent factors. (like (yu <= f(x) <= yo ) with
51
* (f(x)= a_0 * g_0(x) + ... + a_n * g_n(x)) and g_i(x) formulars that
52
* only depend on x)
53
*
54
* This class is for easily handling this formulars.
55
*
56
*/
57
/*
58
History:
59
08.06.2010 Oesterholz created
60
*/
61
62
#ifndef ___C_LINEAR_CONSTRAIN_FIX_H__
63
#define ___C_LINEAR_CONSTRAIN_FIX_H__
64
65
#include "version.h"
66
67
#include <vector>
68
#include <ostream>
69
70
using namespace
std;
71
72
73
namespace
fib{
74
75
namespace
algorithms{
76
77
namespace
nLinearInequation{
78
79
80
template
<
class
tFactors>
81
class
cLinearConstrainFix
{
82
public
:
83
84
/**
85
* The number of factors vecFactors in the linear formular.
86
*
87
* @see vecFactors
88
*/
89
unsigned
long
ulNumberOfFactors
;
90
91
/**
92
* The number of constrain/ bounderie factors vecBounderyFactors that
93
* constrain the linear formular.
94
*
95
* @see vecBounderyFactors
96
*/
97
unsigned
long
ulNumberOfConstrainFactors
;
98
99
100
/*vecBounderyFactors[0] * yu_0 + ... + vecBounderyFactors[uiNumberOfDataPoints] * yu_{uiNumberOfDataPoints}
101
(bGreaterEqual ? <= : =>)
102
constant + vecFactors[0] * a_0 + ... + vecFactors[uiNumberOfFactors] * a_[uiNumberOfFactors}
103
(bGreaterEqual ? <= : =>)
104
vecBounderyFactors[0] * yo_0 + ... + vecBounderyFactors[uiNumberOfDataPoints] * yo_{uiNumberOfDataPoints}*/
105
106
/**
107
* If true the sign betwean the lower bound y factors (yu) constrain
108
* and the linear formular is an greater equal sign "<=", else it's
109
* an lower equal sign ">=" . (as seen from the linear formular)
110
*/
111
bool
bGreaterEqual
;
112
113
/**
114
* The factors for the linear formular.
115
*
116
* @see ulNumberOfFactors
117
*/
118
vector< tFactors >
vecFactors
;
119
120
/**
121
* The constant for the linear formular.
122
*/
123
tFactors
constant
;
124
125
/**
126
* The constrain/ bounderie factors for the constrain of the linear
127
* formular.
128
*
129
* @see ulNumberOfConstrainFactors
130
*/
131
vector< tFactors >
vecBounderyFactors
;
132
133
134
/**
135
* standardconstructor for a linear inequiation
136
*
137
* @param uiInNumberOfFactors The number of factors @see vecFactors in the
138
* linear formular. @see ulNumberOfFactors
139
* @param uiInNumberOfConstrainFactors The number of constrain/ bounderie
140
* factors @see vecBounderyFactors that constrain the linear formular.
141
* @see ulNumberOfConstrainFactors
142
*/
143
cLinearConstrainFix
(
unsigned
int
uiInNumberOfFactors = 1,
144
unsigned
int
uiInNumberOfConstrainFactors = 1 );
145
146
/**
147
* This operator adds the given linear inequiation to this inequiation.
148
* If the inequiation sign (@see bGreaterEqual) is equal in both, all
149
* correspondending factors and the constant will be added, else they
150
* will be subtracted.
151
*
152
* @see operator+=()
153
* @param linInequiation the inequiation to add to this inequiation
154
* @return a reference to this inequiation
155
*/
156
cLinearConstrainFix
& operator+(
const
cLinearConstrainFix
& linInequiation );
157
158
/**
159
* This operator adds the given linear inequiation to this inequiation.
160
* If the inequiation sign (@see bGreaterEqual) is equal in both, all
161
* correspondending factors and the constant will be added, else they
162
* will be subtracted.
163
*
164
* @see operator+()
165
* @param linInequiation the inequiation to add to this inequiation
166
*/
167
void
operator+=(
const
cLinearConstrainFix
& linInequiation );
168
169
/**
170
* This method multiplies the inequiation with the given factor.
171
* If the factor is negativ the inequiation sign (@see bGreaterEqual)
172
* will be switcht ( bGreaterEqual = ! bGreaterEqual ).
173
*
174
* @param dValue the value, with which to multiply this inequiation
175
* @return a reference to this inequiation
176
*/
177
cLinearConstrainFix
& mult( tFactors dValue );
178
179
/**
180
* This method print the inequiation in a readebel form to the given
181
* output stream outputSream.
182
*
183
* @param outputSream the stream wher to print this inequiation to
184
*/
185
void
print( ostream & outputSream );
186
187
};
188
189
190
};
//end namespace nLinearInequation
191
};
//end namespace algorithms
192
};
//end namespace fib
193
194
195
//include template implementation
196
#include "../src/cLinearConstrainFix.cpp"
197
198
199
#endif //___C_LINEAR_CONSTRAIN_FIX_H__
fib.algorithms
nLinearInequation
incl
cLinearConstrainFix.h
Generated on Thu Feb 14 2013 14:06:56 for The Fib multimedia system by
1.8.1