cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nmrConstraintOptimizer.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5  Author(s): Paul Wilkening
6  Created on: 2014
7 
8  (C) Copyright 2014-2015 Johns Hopkins University (JHU), All Rights Reserved.
9 
10  --- begin cisst license - do not edit ---
11 
12  This software is provided "as is" under an open source license, with
13  no warranty. The complete license can be found in license.txt and
14  http://www.cisst.org/cisst/license.txt.
15 
16  --- end cisst license ---
17  */
18 
19 #ifndef _nmrConstraintOptimizer_h
20 #define _nmrConstraintOptimizer_h
21 
25 
26 // Always include last!
28 
32 
35 {
36 
37 private:
38 
40  vctDoubleMat C;
42  vctDoubleVec d;
44  vctDoubleMat A;
46  vctDoubleVec b;
48  vctDoubleMat E;
50  vctDoubleVec f;
51 
53  nmrLSqLinSolutionDynamic lsiSolution;
54 
56  size_t NumVars;
57 
59  size_t Slacks;
61  size_t CIndex;
63  size_t AIndex;
65  size_t EIndex;
67  size_t SlackIndex;
68 
69 public:
70 
77  enum STATUS {NMR_OK, NMR_EQ_CONTRADICTION, NMR_INEQ_CONTRADICTION, NMR_BOTH_CONTRADICTION, NMR_MALFORMED, NMR_EMPTY};
78 
82 
86 
90  nmrConstraintOptimizer(const size_t n);
91 
93 
97  STATUS Solve(vctDoubleVec & dq);
98 
100 
102  void ResetIndices(void);
103 
105 
107  void Allocate(void);
108 
110 
112  void Allocate(const size_t CRows, const size_t CCols, const size_t ARows, const size_t ACols, const size_t ERows, const size_t ECols);
113 
115 
121  void ReserveSpace(const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks);
122 
124 
139  void SetRefs(const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks, const vctDoubleVec & limits,
143 
145 
148  size_t GetNumVars(void) const;
149 
151 
154  size_t GetSlackIndex(void) const;
155 
157 
160  size_t GetSlacks(void) const;
161 
163 
166  size_t GetObjectiveRows(void) const;
167 
169 
172  size_t GetObjectiveIndex(void) const;
173 
175 
178  size_t GetIneqConstraintRows(void) const;
179 
181 
184  size_t GetIneqConstraintIndex(void) const;
185 
187 
190  size_t GetEqConstraintRows(void) const;
191 
193 
196  size_t GetEqConstraintIndex(void) const;
197 
199 
202  const vctDoubleMat & GetObjectiveMatrix(void) const;
203 
205 
208  const vctDoubleVec & GetObjectiveVector(void) const;
209 
211 
214  const vctDoubleMat & GetIneqConstraintMatrix(void) const;
215 
217 
220  const vctDoubleVec & GetIneqConstraintVector(void) const;
221 
223 
226  const vctDoubleMat & GetEqConstraintMatrix(void) const;
227 
229 
232  const vctDoubleVec & GetEqConstraintVector(void) const;
233 
235 
239  const std::string GetStatusString(STATUS status) const;
240 
241 };
242 
243 #endif // _nmrConstraintOptimizer_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
~nmrConstraintOptimizer()
Definition: nmrConstraintOptimizer.h:85
Typedef for dynamic vectors.
nmrConstraintOptimizer()
Definition: nmrConstraintOptimizer.h:81
nmrConstraintOptimizer: A class that makes using the constraint control algorithm more efficient ...
Definition: nmrConstraintOptimizer.h:34
Definition: nmrLSqLin.h:115
Typedef for dynamic matrices.
Declaration of nmrLSqLin.
STATUS
Definition: nmrConstraintOptimizer.h:77
Rules of exporting.