comparison liboctave/QP.h @ 1861:620a65533630

[project @ 1996-02-04 10:17:34 by jwe]
author jwe
date Sun, 04 Feb 1996 10:26:22 +0000
parents 8600f4f34aa9
children b6c48195b552
comparison
equal deleted inserted replaced
1860:821870c30840 1861:620a65533630
1 // QP.h -*- C++ -*- 1 // QP.h -*- C++ -*-
2 /* 2 /*
3 3
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton 4 Copyright (C) 1996 John W. Eaton
5 5
6 This file is part of Octave. 6 This file is part of Octave.
7 7
8 Octave is free software; you can redistribute it and/or modify it 8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
28 #include "dColVector.h" 28 #include "dColVector.h"
29 #include "Bounds.h" 29 #include "Bounds.h"
30 #include "LinConst.h" 30 #include "LinConst.h"
31 #include "base-min.h" 31 #include "base-min.h"
32 32
33 class QP : public base_minimizer 33 class
34 QP : public base_minimizer
34 { 35 {
35 public: 36 public:
36 37
37 QP (void) : base_minimizer () { } 38 QP (void)
39 : base_minimizer (), H (), c (), bnds (), lc () { }
38 40
39 QP (const ColumnVector& x, const Matrix& H_arg) 41 QP (const ColumnVector& x, const Matrix& H_arg)
40 : base_minimizer (x), H (H_arg) 42 : base_minimizer (x), H (H_arg), c (), bnds (), lc ()
41 { make_h_symmetric (); } 43 { make_h_symmetric (); }
42 44
43 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg) 45 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg)
44 : base_minimizer (x), H (H_arg), c (c_arg) 46 : base_minimizer (x), H (H_arg), c (c_arg), bnds (), lc ()
45 { make_h_symmetric (); } 47 { make_h_symmetric (); }
46 48
47 QP (const ColumnVector& x, const Matrix& H_arg, const Bounds& b) 49 QP (const ColumnVector& x, const Matrix& H_arg, const Bounds& b)
48 : base_minimizer (x), H (H_arg), bnds (b) 50 : base_minimizer (x), H (H_arg), c (), bnds (b), lc ()
49 { make_h_symmetric (); } 51 { make_h_symmetric (); }
50 52
51 QP (const ColumnVector& x, const Matrix& H_arg, const LinConst& l) 53 QP (const ColumnVector& x, const Matrix& H_arg, const LinConst& l)
52 : base_minimizer (x), H (H_arg), lc (l) 54 : base_minimizer (x), H (H_arg), lc (l), bnds (), lc ()
53 { make_h_symmetric (); } 55 { make_h_symmetric (); }
54 56
55 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg, 57 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg,
56 const Bounds& b) 58 const Bounds& b)
57 : base_minimizer (x), H (H_arg), c (c_arg), bnds (b) 59 : base_minimizer (x), H (H_arg), c (c_arg), bnds (b), lc ()
58 { make_h_symmetric (); } 60 { make_h_symmetric (); }
59 61
60 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg, 62 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg,
61 const LinConst& l) 63 const LinConst& l)
62 : base_minimizer (x), H (H_arg), c (c_arg), lc (l) 64 : base_minimizer (x), H (H_arg), c (c_arg), bnds (), lc (l)
63 { make_h_symmetric (); } 65 { make_h_symmetric (); }
64 66
65 QP (const ColumnVector& x, const Matrix& H_arg, const Bounds& b, 67 QP (const ColumnVector& x, const Matrix& H_arg, const Bounds& b,
66 const LinConst& l) 68 const LinConst& l)
67 : base_minimizer (x), H (H_arg), bnds (b), lc (l) 69 : base_minimizer (x), H (H_arg), c (), bnds (b), lc (l)
68 { make_h_symmetric (); } 70 { make_h_symmetric (); }
69 71
70 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg, 72 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg,
71 const Bounds& b, const LinConst& l) 73 const Bounds& b, const LinConst& l)
72 : base_minimizer (x), H (H_arg), c (c_arg), bnds (b), lc (l) 74 : base_minimizer (x), H (H_arg), c (c_arg), bnds (b), lc (l)
73 { make_h_symmetric (); } 75 { make_h_symmetric (); }
74 76
77 QP (const QP& qp)
78 : base_minimizer (qp), H (qp.H), c (qp.c), bnds (qp.bnds), lc (qp.lc) { }
79
80 QP& operator = (const QP& qp)
81 {
82 if (this != &qp)
83 {
84 base_minimizer::operator = (qp);
85
86 H = qp.H;
87 c = qp.c;
88 bnds = qp.bnds;
89 lc = qp.lc;
90 }
91 return *this;
92 }
93
94 ~QP (void) { }
95
96 Matrix hessian (void) const { return H; }
97
98 ColumnVector linear_obj_coeff (void) const { return c; }
99
100 Bounds bounds (void) const { return bnds; }
101
102 LinConst linear_constraints (void) const { return lc; }
103
75 virtual ~QP (void) { } 104 virtual ~QP (void) { }
76 105
77 protected: 106 protected:
78 107
79 ColumnVector x;
80 Matrix H; 108 Matrix H;
81 ColumnVector c; 109 ColumnVector c;
82 Bounds bnds; 110 Bounds bnds;
83 LinConst lc; 111 LinConst lc;
84 112
85 private: 113 private:
86 114
87 Matrix make_h_symmetric (void) { return 0.5 * (H + H.transpose ()); } 115 Matrix make_h_symmetric (void) { return 0.5 * (H + H.transpose ()); }
88 }; 116 };
89 117
90 #endif 118 #endif