Skip to content
Snippets Groups Projects
Commit 136dc7de authored by Andrei Herdt's avatar Andrei Herdt
Browse files

Change enum type names and clean up

parent 7fe6c1be
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,6 @@ QPProblem_s::QPProblem_s():
iout_(0),ifail_(0), iprint_(0),
lwar_(0), liwar_(0), eps_(0),
NbVariables_(0), NbConstraints_(0),NbEqConstraints_(0)
{
NbVariables_ = 0;
NbConstraints_ = 0;
......@@ -74,8 +73,8 @@ QPProblem_s::QPProblem_s():
liwar_ = n_;
eps_ = 1e-8;
last_solution_.resize(1,1);
last_solution_.empty();
lastSolution_.resize(1,1);
lastSolution_.empty();
istate_ = 0x0;
kx_ = 0x0;
......@@ -138,14 +137,14 @@ QPProblem_s::resize_all()
istate_ = new int [(NbVariables_+NbConstraints_+2)*10];
kx_ = new int [(NbVariables_+1)*10];
b_ =new double [(NbVariables_+1)*10];
b_ = new double [(NbVariables_+1)*10];
clamda_ = new double [(NbVariables_+NbConstraints_+2)*10];
}
void
QPProblem_s::clear( QPElement Type )
QPProblem_s::clear( qp_element_e Type )
{
switch(Type)
......@@ -189,10 +188,8 @@ void QPProblem_s::reset()
}
void
QPProblem_s::solve( Solver Solver, solution_t & Result, const Tests & tests )
QPProblem_s::solve( solver_e Solver, solution_t & Result, const tests_e & tests )
{
m_ = NbConstraints_+1;
......@@ -324,11 +321,11 @@ QPProblem_s::solve( Solver Solver, solution_t & Result, const Tests & tests )
last_solution_.resize(n_);
lastSolution_.resize(n_);
for(int i = 0; i < n_; i++)
{
Result.Solution_vec(i) = X_.Array_[i];
last_solution_(i)=Result.Solution_vec(i);
lastSolution_(i)=Result.Solution_vec(i);
Result.LBoundsLagr_vec(i) = 0;
Result.UBoundsLagr_vec(i) = 0;
}
......@@ -357,7 +354,7 @@ QPProblem_s::solve( Solver Solver, solution_t & Result, const Tests & tests )
void
QPProblem_s::add_term_to( QPElement Type, const MAL_MATRIX (&Mat, double),
QPProblem_s::add_term_to( qp_element_e Type, const MAL_MATRIX (&Mat, double),
unsigned int Row, unsigned int Col )
{
......@@ -431,7 +428,7 @@ QPProblem_s::add_term_to( QPElement Type, const MAL_MATRIX (&Mat, double),
void
QPProblem_s::add_term_to( QPElement Type, const MAL_VECTOR (&Vec, double),
QPProblem_s::add_term_to( qp_element_e Type, const MAL_VECTOR (&Vec, double),
unsigned int Row )
{
......@@ -499,7 +496,7 @@ QPProblem_s::dump_solver_parameters(std::ostream & aos)
void
QPProblem_s::dump( QPElement Type, std::ostream & aos)
QPProblem_s::dump( qp_element_e Type, std::ostream & aos)
{
unsigned int NbRows=0, NbCols=0;
......@@ -562,7 +559,7 @@ QPProblem_s::dump( QPElement Type, std::ostream & aos)
void
QPProblem_s::dump( QPElement Type, const char * FileName )
QPProblem_s::dump( qp_element_e Type, const char * FileName )
{
std::ofstream aof;
aof.open(FileName,std::ofstream::out);
......
......@@ -50,7 +50,7 @@ namespace PatternGeneratorJRL
//
public:
enum QPElement
enum qp_element_e
{
MATRIX_Q,
MATRIX_DU,
......@@ -60,13 +60,13 @@ namespace PatternGeneratorJRL
VECTOR_XU
};
enum Solver
enum solver_e
{
QLD,
LSSOL
};
enum Tests
enum tests_e
{
NONE,
ALL,
......@@ -95,19 +95,19 @@ namespace PatternGeneratorJRL
/// \brief Add a matrix to the final optimization problem in array form
///
/// \param[in] Mat Added matrix
/// \param[in] Type Target matrix type
/// \param[in] Mat Added matrix
/// \param[in] Row First row inside the target
/// \param[in] Col First column inside the target
void add_term_to( QPElement Type, const boost_ublas::matrix<double> & Mat,
void add_term_to( qp_element_e Type, const boost_ublas::matrix<double> & Mat,
unsigned int Row, unsigned int Col );
/// \brief Add a vector to the final optimization problem in array form
///
/// \param Mat Added vector
/// \param ype Target vector type
/// \param row First row inside the target
void add_term_to( QPElement Type, const boost_ublas::vector<double> & Vec,
/// \param[in] Type Target vector type
/// \param[in] Mat Added vector
/// \param[in] Row First row inside the target
void add_term_to( qp_element_e Type, const boost_ublas::vector<double> & Vec,
unsigned int Row );
/// \brief Dump current problem on disk.
......@@ -118,13 +118,13 @@ namespace PatternGeneratorJRL
///
/// \param Type
/// \param Filename
void dump( QPElement Type, const char * Filename);
void dump( qp_element_e Type, const char * Filename);
/// \}
/// \brief Initialize array
///
/// \param[in] type
void clear( QPElement Type );
void clear( qp_element_e Type );
/// \brief Set matrices to zero
void reset();
......@@ -134,7 +134,7 @@ namespace PatternGeneratorJRL
/// \param[in] Solver
/// \param[out] Result
/// \param[in] Tests
void solve( Solver Solver, solution_t & Result, const Tests & Tests=NONE );
void solve( solver_e Solver, solution_t & Result, const tests_e & Tests = NONE );
/// \name Accessors and mutators
/// \{
......@@ -172,7 +172,7 @@ namespace PatternGeneratorJRL
/// \brief Print_ on disk the parameters that are passed to the solver
void dump_solver_parameters( std::ostream & aos );
/// \brief Print_ array
void dump( QPElement Type, std::ostream & aos );
void dump( qp_element_e Type, std::ostream & aos );
/// \brief Print_ problem
void dump_problem( std::ostream & );
/// \}
......@@ -298,14 +298,13 @@ namespace PatternGeneratorJRL
/// \{
int *istate_;
int *kx_ ;
double *b_;
int inform_;
int iter_;
double obj_;
double *clamda_;
/// \}
/// \name ql-parameters
/// \{
int m_, me_, mmax_, n_, nmax_, mnn_;
......@@ -313,12 +312,13 @@ namespace PatternGeneratorJRL
array_s<int> iwar_;
int iout_, ifail_, iprint_, lwar_, liwar_;
double eps_;
/// \}
/// \brief Robot
RigidBodySystem * Robot_;
boost_ublas::vector<double> last_solution_;
/// \}
/// \brief Last solution
boost_ublas::vector<double> lastSolution_;
/// \brief Number of optimization parameters
unsigned int NbVariables_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment