cisst-saw
Loading...
Searching...
No Matches
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
37private:
38
51
53 nmrLSqLinSolutionDynamic lsiSolution;
54
56 size_t NumVars;
57
58 // TODO: change name to NumSlacks
60 size_t Slacks;
62 size_t CIndex;
64 size_t AIndex;
66 size_t EIndex;
68 size_t SlackIndex;
69
70public:
71
79
83
87
91 nmrConstraintOptimizer(const size_t n);
92
94
99
101
103 void ResetIndices(void);
104
106
108 void Allocate(void);
109
111
113 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);
114
116
122 void ReserveSpace(const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks);
123
125
139 void SetRefs(const size_t CRows, const size_t ARows, const size_t ERows, const size_t NumSlacks,
145
147
150 size_t GetNumVars(void) const;
151
153
156 size_t GetSlackIndex(void) const;
157
159
162 size_t GetSlacks(void) const;
163
165
168 size_t GetObjectiveRows(void) const;
169
171
174 size_t GetObjectiveIndex(void) const;
175
177
180 size_t GetIneqConstraintRows(void) const;
181
183
186 size_t GetIneqConstraintIndex(void) const;
187
189
192 size_t GetEqConstraintRows(void) const;
193
195
198 size_t GetEqConstraintIndex(void) const;
199
201
204 const vctDoubleMat & GetObjectiveMatrix(void) const;
205
207
210 const vctDoubleVec & GetObjectiveVector(void) const;
211
213
217
219
223
225
229
231
235
237
241 const std::string GetStatusString(STATUS status) const;
242
243};
244
245#endif // _nmrConstraintOptimizer_h
size_t GetSlacks(void) const
Gets the number of slacks.
~nmrConstraintOptimizer()
Definition nmrConstraintOptimizer.h:86
const vctDoubleMat & GetObjectiveMatrix(void) const
Gets the objective matrix.
const vctDoubleVec & GetEqConstraintVector(void) const
Gets the equality constraint vector.
nmrConstraintOptimizer(const size_t n)
const std::string GetStatusString(STATUS status) const
Helper function for converting status enum to a string message.
void SetRefs(const size_t CRows, const size_t ARows, const size_t ERows, const size_t NumSlacks, vctDynamicMatrixRef< double > &CData, vctDynamicMatrixRef< double > &CSlacks, vctDynamicVectorRef< double > &dData, vctDynamicMatrixRef< double > &AData, vctDynamicMatrixRef< double > &ASlacks, vctDynamicVectorRef< double > &bData, vctDynamicVectorRef< double > &bSlacks, vctDynamicMatrixRef< double > &EData, vctDynamicVectorRef< double > &fData)
Returns references to spaces in the tableau.
void ReserveSpace(const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks)
Reserves space in the tableau.
void Allocate(void)
Allocate memory indicated by indices.
void ResetIndices(void)
Clear all indices.
const vctDoubleVec & GetObjectiveVector(void) const
Gets the objective vector.
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)
Allocate memory indicated by input.
const vctDoubleVec & GetIneqConstraintVector(void) const
Gets the inequality constraint vector.
size_t GetObjectiveIndex(void) const
Gets the objective index.
const vctDoubleMat & GetIneqConstraintMatrix(void) const
Gets the inequality constraint matrix.
size_t GetEqConstraintIndex(void) const
Gets the equality constraint index.
size_t GetIneqConstraintIndex(void) const
Gets the inequality constraint index.
const vctDoubleMat & GetEqConstraintMatrix(void) const
Gets the equality constraint matrix.
STATUS Solve(vctDoubleVec &dq)
Calls the solver and stores the result in dq.
size_t GetObjectiveRows(void) const
Gets the number of rows for the objective expression.
STATUS
Definition nmrConstraintOptimizer.h:78
@ NMR_OK
Definition nmrConstraintOptimizer.h:78
@ NMR_INEQ_CONTRADICTION
Definition nmrConstraintOptimizer.h:78
@ NMR_EQ_CONTRADICTION
Definition nmrConstraintOptimizer.h:78
@ NMR_EMPTY
Definition nmrConstraintOptimizer.h:78
@ NMR_MALFORMED
Definition nmrConstraintOptimizer.h:78
@ NMR_BOTH_CONTRADICTION
Definition nmrConstraintOptimizer.h:78
size_t GetEqConstraintRows(void) const
Gets the number of rows for the equality constraint.
size_t GetSlackIndex(void) const
Gets the current slack index.
size_t GetNumVars(void) const
Returns the number of variables.
nmrConstraintOptimizer()
Definition nmrConstraintOptimizer.h:82
size_t GetIneqConstraintRows(void) const
Gets the number of rows for the inequality constraint.
Definition nmrLSqLin.h:114
Dynamic matrix referencing existing memory.
Definition vctDynamicMatrixRef.h:75
Dynamic vector referencing existing memory.
Definition vctDynamicVectorRef.h:78
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Rules of exporting.
Declaration of nmrLSqLin.
Typedef for dynamic matrices.
vctDynamicMatrix< double > vctDoubleMat
Definition vctDynamicMatrixTypes.h:35
Typedef for dynamic vectors.
vctDynamicVector< double > vctDoubleVec
Definition vctDynamicVectorTypes.h:37