| Trees | Indices | Help |
|
|---|
|
|
1 ###############################################################################
2 # #
3 # Copyright (C) 2003-2013 Edward d'Auvergne #
4 # #
5 # This file is part of the minfx optimisation library, #
6 # https://sourceforge.net/projects/minfx #
7 # #
8 # This program is free software: you can redistribute it and/or modify #
9 # it under the terms of the GNU General Public License as published by #
10 # the Free Software Foundation, either version 3 of the License, or #
11 # (at your option) any later version. #
12 # #
13 # This program is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
17 # #
18 # You should have received a copy of the GNU General Public License #
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 # #
21 ###############################################################################
22
23 # Module docstring.
24 """Linear inequality constraint functions and gradients.
25
26 The constraints are in the form::
27
28 A.x >= b
29
30 This file is part of the U{minfx optimisation library<https://sourceforge.net/projects/minfx>}.
31 """
32
33 # Python module imports.
34 from numpy import dot
35
36
39 """Class for the creation of linear inequality constraint functions and gradients.
40
41 The constraints are in the form::
42
43 A.x >= b
44
45 where:
46
47 - A is an m*n matrix where the rows are the transposed vectors, ai, of length n. The elements of ai are the coefficients of the model parameters.
48 - x is the vector of model parameters of dimension n.
49 - b is the vector of scalars of dimension m.
50 - m is the number of constraints.
51 - n is the number of model parameters.
52
53 E.g. if 0 <= q <= 1, q >= 1 - 2r, and 0 <= r, then::
54
55 | 1 0 | | 0 |
56 | | | |
57 |-1 0 | | q | | -1 |
58 | | . | | >= | |
59 | 1 2 | | r | | 1 |
60 | | | |
61 | 0 1 | | 2 |
62 """
63
64 # Initialise arguments.
65 self.A = A
66 self.b = b
67
68
70 """The constraint function.
71
72 A vector containing the constraint values is returned.
73 """
74
75 return dot(self.A, x) - self.b
76
77
85
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Nov 26 19:05:24 2013 | http://epydoc.sourceforge.net |