LinearConstraint.hh 2.25 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
3
4
5
6
7
8
9
10
11
12
13
//=============================================================================
//
//  CLASS NConstraintGmmInterface
//
//=============================================================================


#ifndef COMISO_LINEARCONSTRAINT_HH
#define COMISO_LINEARCONSTRAINT_HH


//== INCLUDES =================================================================

Jan Möbius's avatar
Jan Möbius committed
14
#include <CoMISo/Config/CoMISoDefines.hh>
David Bommes's avatar
David Bommes committed
15
#include "NConstraintInterface.hh"
David Bommes's avatar
David Bommes committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

//== FORWARDDECLARATIONS ======================================================

//== NAMESPACES ===============================================================

namespace COMISO {

//== CLASS DEFINITION =========================================================

	      

/** \class NProblemGmmInterface NProblemGmmInterface.hh <ACG/.../NPRoblemGmmInterface.hh>

    Brief Description.
  
    A more elaborate description follows.
*/
Jan Möbius's avatar
Jan Möbius committed
33
class COMISODLLEXPORT LinearConstraint : public NConstraintInterface
David Bommes's avatar
David Bommes committed
34
35
36
37
38
{
public:

  // use c-arrays as vectors for gmm
  typedef gmm::array1D_reference<double*> VectorPT;
Jan Möbius's avatar
Jan Möbius committed
39
  typedef NConstraintInterface::SVectorNC SVectorNC;
David Bommes's avatar
David Bommes committed
40
41
42
43
44

  // different types of constraints
//  enum ConstraintType {NC_EQUAL, NC_LESS_EQUAL, NC_GREATER_EQUAL};

  /// Default constructor
Jan Möbius's avatar
Jan Möbius committed
45
  LinearConstraint(const ConstraintType _type = NC_EQUAL);
David Bommes's avatar
David Bommes committed
46

47
  // linear equation of the form -> coeffs_^T *x  + b_=_type= 0
Jan Möbius's avatar
Jan Möbius committed
48
  LinearConstraint(const SVectorNC& _coeffs, const double _b, const ConstraintType _type = NC_EQUAL);
David Bommes's avatar
David Bommes committed
49
50

  /// Destructor
Jan Möbius's avatar
Jan Möbius committed
51
  ~LinearConstraint();
David Bommes's avatar
David Bommes committed
52

Jan Möbius's avatar
Jan Möbius committed
53
  virtual int n_unknowns();
David Bommes's avatar
David Bommes committed
54

Jan Möbius's avatar
Jan Möbius committed
55
56
  SVectorNC& coeffs();
  double&    b();
57

Jan Möbius's avatar
Jan Möbius committed
58
59
60
  virtual double eval_constraint ( const double* _x );
  
  virtual void eval_gradient( const double* _x, SVectorNC& _g      );
David Bommes's avatar
David Bommes committed
61

Jan Möbius's avatar
Jan Möbius committed
62
  virtual void eval_hessian    ( const double* _x, SMatrixNC& _h      );
David Bommes's avatar
David Bommes committed
63
64
65
66
67
68
69

  // inherited from base
//  virtual ConstraintType  constraint_type (                                      ) { return type_; }

private:

  // linear equation of the form -> coeffs_^T * x + b_
David Bommes's avatar
David Bommes committed
70
  SVectorNC coeffs_;
David Bommes's avatar
David Bommes committed
71
72
73
74
75
76
77
78
79
80
  double    b_;
};


//=============================================================================
} // namespace COMISO
//=============================================================================
#endif // ACG_LINEARCONSTRAINT_HH defined
//=============================================================================