00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_QP_h)
00024 #define octave_QP_h 1
00025
00026 #include "dMatrix.h"
00027 #include "dColVector.h"
00028 #include "Bounds.h"
00029 #include "LinConst.h"
00030 #include "base-min.h"
00031
00032 class
00033 QP : public base_minimizer
00034 {
00035 public:
00036
00037 QP (void)
00038 : base_minimizer (), H (), c (), bnds (), lc () { }
00039
00040 QP (const ColumnVector& x, const Matrix& H_arg)
00041 : base_minimizer (x), H (H_arg), c (), bnds (), lc ()
00042 { make_h_symmetric (); }
00043
00044 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg)
00045 : base_minimizer (x), H (H_arg), c (c_arg), bnds (), lc ()
00046 { make_h_symmetric (); }
00047
00048 QP (const ColumnVector& x, const Matrix& H_arg, const Bounds& b)
00049 : base_minimizer (x), H (H_arg), c (), bnds (b), lc ()
00050 { make_h_symmetric (); }
00051
00052 QP (const ColumnVector& x, const Matrix& H_arg, const LinConst& l)
00053 : base_minimizer (x), H (H_arg), c (), bnds (), lc (l)
00054 { make_h_symmetric (); }
00055
00056 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg,
00057 const Bounds& b)
00058 : base_minimizer (x), H (H_arg), c (c_arg), bnds (b), lc ()
00059 { make_h_symmetric (); }
00060
00061 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg,
00062 const LinConst& l)
00063 : base_minimizer (x), H (H_arg), c (c_arg), bnds (), lc (l)
00064 { make_h_symmetric (); }
00065
00066 QP (const ColumnVector& x, const Matrix& H_arg, const Bounds& b,
00067 const LinConst& l)
00068 : base_minimizer (x), H (H_arg), c (), bnds (b), lc (l)
00069 { make_h_symmetric (); }
00070
00071 QP (const ColumnVector& x, const Matrix& H_arg, const ColumnVector& c_arg,
00072 const Bounds& b, const LinConst& l)
00073 : base_minimizer (x), H (H_arg), c (c_arg), bnds (b), lc (l)
00074 { make_h_symmetric (); }
00075
00076 QP (const QP& qp)
00077 : base_minimizer (qp), H (qp.H), c (qp.c), bnds (qp.bnds), lc (qp.lc) { }
00078
00079 QP& operator = (const QP& qp)
00080 {
00081 if (this != &qp)
00082 {
00083 base_minimizer::operator = (qp);
00084
00085 H = qp.H;
00086 c = qp.c;
00087 bnds = qp.bnds;
00088 lc = qp.lc;
00089 }
00090 return *this;
00091 }
00092
00093 virtual ~QP (void) { }
00094
00095 Matrix hessian (void) const { return H; }
00096
00097 ColumnVector linear_obj_coeff (void) const { return c; }
00098
00099 Bounds bounds (void) const { return bnds; }
00100
00101 LinConst linear_constraints (void) const { return lc; }
00102
00103 protected:
00104
00105 Matrix H;
00106 ColumnVector c;
00107 Bounds bnds;
00108 LinConst lc;
00109
00110 private:
00111
00112 Matrix make_h_symmetric (void) { return 0.5 * (H + H.transpose ()); }
00113 };
00114
00115 #endif
00116
00117
00118
00119
00120
00121