Package minfx :: Module constraint_linear :: Class Constraint_linear
[hide private]
[frames] | no frames]

Class Constraint_linear

source code

Instance Methods [hide private]
 
__init__(self, A=None, b=None)
Class for the creation of linear inequality constraint functions and gradients.
source code
 
func(self, x)
The constraint function.
source code
 
dfunc(self, x)
The constraint gradient.
source code
Method Details [hide private]

__init__(self, A=None, b=None)
(Constructor)

source code 

Class for the creation of linear inequality constraint functions and gradients.

The constraints are in the form:

   A.x >= b

where:

  • 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.
  • x is the vector of model parameters of dimension n.
  • b is the vector of scalars of dimension m.
  • m is the number of constraints.
  • n is the number of model parameters.

E.g. if 0 <= q <= 1, q >= 1 - 2r, and 0 <= r, then:

   | 1  0 |            |  0 |
   |      |            |    |
   |-1  0 |   | q |    | -1 |
   |      | . |   | >= |    |
   | 1  2 |   | r |    |  1 |
   |      |            |    |
   | 0  1 |            |  2 |

func(self, x)

source code 

The constraint function.

A vector containing the constraint values is returned.

dfunc(self, x)

source code 

The constraint gradient.

As the inequality constraints are linear, the gradient matrix is constant and equal to the coefficient matrix A. Therefore this function simply returns the matrix.