Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jrl-walkgen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Guilhem Saurel
jrl-walkgen
Commits
ca3f6f40
Commit
ca3f6f40
authored
14 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Accessors and documentation"
This reverts commit
653b4b0a
.
parent
c44d805b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ZMPRefTrajectoryGeneration/qp-problem.cpp
+38
-29
38 additions, 29 deletions
src/ZMPRefTrajectoryGeneration/qp-problem.cpp
src/ZMPRefTrajectoryGeneration/qp-problem.hh
+14
-46
14 additions, 46 deletions
src/ZMPRefTrajectoryGeneration/qp-problem.hh
with
52 additions
and
75 deletions
src/ZMPRefTrajectoryGeneration/qp-problem.cpp
+
38
−
29
View file @
ca3f6f40
...
...
@@ -57,54 +57,63 @@ QPProblem_s::QPProblem_s():
QPProblem_s
::~
QPProblem_s
()
{
r
eleaseMemory
();
R
eleaseMemory
();
}
void
QPProblem_s
::
r
eleaseMemory
()
void
QPProblem_s
::
R
eleaseMemory
()
{
if
(
Q
!=
0
)
delete
[]
Q
;
if
(
D
!=
0
)
delete
[]
D
;
if
(
DS
!=
0
)
delete
[]
DS
;
if
(
DU
!=
0
)
delete
[]
DU
;
if
(
XL
!=
0
)
delete
[]
XL
;
if
(
XU
!=
0
)
delete
[]
XU
;
if
(
X
!=
0
)
delete
[]
X
;
if
(
iwar
!=
0
)
delete
[]
iwar
;
if
(
war
!=
0
)
delete
[]
war
;
if
(
U
!=
0
)
delete
[]
U
;
}
void
QPProblem_s
::
resizeAll
(
int
nb_v
ariables
,
int
nb_c
onstraints
)
QPProblem_s
::
resizeAll
(
int
NbV
ariables
,
int
NbC
onstraints
)
{
resize
(
Q
,
2
*
n
*
n
,
2
*
nb_v
ariables
*
nb_v
ariables
);
//Quadratic part of the objective function
resize
(
D
,
2
*
n
,
2
*
nb_v
ariables
);
// Linear part of the objective function
resize
(
Q
,
2
*
n
*
n
,
2
*
NbV
ariables
*
NbV
ariables
);
//Quadratic part of the objective function
resize
(
D
,
2
*
n
,
2
*
NbV
ariables
);
// Linear part of the objective function
resize
(
DS
,
2
*
m
,
2
*
nb_c
onstraints
);
resize
(
DU
,
2
*
m
*
n
,
2
*
nb_v
ariables
*
nb_c
onstraints
);
resize
(
DS
,
2
*
m
,
2
*
NbC
onstraints
);
resize
(
DU
,
2
*
m
*
n
,
2
*
NbV
ariables
*
NbC
onstraints
);
resize
(
XL
,
2
*
n
,
2
*
nb_v
ariables
);
// Lower bound on the solution.
initialize
(
XL
,
2
*
nb_v
ariables
,
-
1e8
);
resize
(
XU
,
2
*
n
,
2
*
nb_v
ariables
);
// Upper bound on the solution.
initialize
(
XU
,
2
*
nb_v
ariables
,
1e8
);
resize
(
XL
,
2
*
n
,
2
*
NbV
ariables
);
// Lower bound on the solution.
initialize
(
XL
,
2
*
NbV
ariables
,
-
1e8
);
resize
(
XU
,
2
*
n
,
2
*
NbV
ariables
);
// Upper bound on the solution.
initialize
(
XU
,
2
*
NbV
ariables
,
1e8
);
resize
(
X
,
2
*
n
,
2
*
nb_v
ariables
);
// Solution of the problem.
resize
(
U
,
2
*
mnn
,
2
*
(
nb_c
onstraints
+
2
*
nb_v
ariables
));
resize
(
X
,
2
*
n
,
2
*
NbV
ariables
);
// Solution of the problem.
resize
(
U
,
2
*
mnn
,
2
*
(
NbC
onstraints
+
2
*
NbV
ariables
));
resize
(
war
,
2
*
lwar
,
2
*
(
3
*
nb_v
ariables
*
nb_v
ariables
/
2
+
10
*
nb_v
ariables
+
2
*
(
nb_c
onstraints
+
1
)
+
20000
));
resize
(
iwar
,
2
*
liwar
,
2
*
nb_v
ariables
);
// The Cholesky decomposition is done internally.
resize
(
war
,
2
*
lwar
,
2
*
(
3
*
NbV
ariables
*
NbV
ariables
/
2
+
10
*
NbV
ariables
+
2
*
(
NbC
onstraints
+
1
)
+
20000
));
resize
(
iwar
,
2
*
liwar
,
2
*
NbV
ariables
);
// The Cholesky decomposition is done internally.
}
...
...
@@ -313,28 +322,28 @@ void QPProblem_s::addTerm( const MAL_VECTOR (&Vec, double), int type,
unsigned
int
row
)
{
double
*
array
;
double
*
a
A
rray
;
unsigned
int
max_rows
;
switch
(
type
)
{
case
VECTOR_D
:
array
=
D
;
a
A
rray
=
D
;
max_rows
=
n
;
break
;
case
VECTOR_XL
:
array
=
XL
;
a
A
rray
=
XL
;
max_rows
=
n
;
break
;
case
VECTOR_XU
:
array
=
XU
;
a
A
rray
=
XU
;
max_rows
=
n
;
break
;
case
VECTOR_DS
:
array
=
DS
;
a
A
rray
=
DS
;
max_rows
=
mmax
;
break
;
}
...
...
@@ -348,7 +357,7 @@ void QPProblem_s::addTerm( const MAL_VECTOR (&Vec, double), int type,
}
for
(
unsigned
int
i
=
0
;
i
<
Vec
.
size
();
i
++
)
array
[
row
+
i
]
+=
Vec
(
i
);
a
A
rray
[
row
+
i
]
+=
Vec
(
i
);
}
...
...
@@ -407,48 +416,48 @@ QPProblem_s::dump( int type, std::ostream & aos)
{
int
lnbrows
=
0
,
lnbcols
=
0
;
double
*
array
=
0
;
double
*
a
A
rray
=
0
;
std
::
string
Name
;
switch
(
type
)
{
case
MATRIX_Q
:
lnbrows
=
lnbcols
=
n
;
array
=
Q
;
a
A
rray
=
Q
;
Name
=
"Q"
;
break
;
case
MATRIX_DU
:
lnbrows
=
mmax
;
lnbcols
=
n
;
array
=
DU
;
a
A
rray
=
DU
;
Name
=
"DU"
;
break
;
case
VECTOR_D
:
lnbrows
=
n
;
lnbcols
=
1
;
array
=
D
;
a
A
rray
=
D
;
Name
=
"D"
;
break
;
case
VECTOR_XL
:
lnbrows
=
n
;
lnbcols
=
1
;
array
=
XL
;
a
A
rray
=
XL
;
Name
=
"XL"
;
break
;
case
VECTOR_XU
:
lnbrows
=
n
;
lnbcols
=
1
;
array
=
XU
;
a
A
rray
=
XU
;
Name
=
"XU"
;
break
;
case
VECTOR_DS
:
lnbrows
=
m
;
lnbcols
=
1
;
array
=
DS
;
a
A
rray
=
DS
;
Name
=
"DS"
;
break
;
}
...
...
@@ -458,7 +467,7 @@ QPProblem_s::dump( int type, std::ostream & aos)
for
(
int
i
=
0
;
i
<
lnbrows
;
i
++
)
{
for
(
int
j
=
0
;
j
<
lnbcols
;
j
++
)
aos
<<
array
[
i
+
j
*
lnbrows
]
<<
" "
;
aos
<<
a
A
rray
[
i
+
j
*
lnbrows
]
<<
" "
;
aos
<<
std
::
endl
;
}
aos
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
src/ZMPRefTrajectoryGeneration/qp-problem.hh
+
14
−
46
View file @
ca3f6f40
...
...
@@ -116,22 +116,8 @@ namespace PatternGeneratorJRL
~
QPProblem_s
();
/// \brief Set the number of optimization parameters.
///
/// \param nb_variables
inline
void
setNbVariables
(
int
nb_variables
)
{
m_NbVariables
=
n
=
nb_variables
;};
/// \brief Set the number of optimization parameters.
///
/// \param nb_variables
inline
void
setNbEqConstraints
(
int
nb_eq_constraints
)
{
m_NbEqConstraints
=
me
=
nb_eq_constraints
;};
/// \brief Set the number of optimization parameters.
///
/// \param nb_variables
inline
void
setNbConstraints
(
int
nb_constraints
)
{
m_NbVariables
=
n
=
nb_constraints
;};
inline
void
setNbVariables
(
int
NbVariables
)
{
m_NbVariables
=
NbVariables
;};
/// \brief Set the dimensions of the problem.
/// This method has an internal logic to
...
...
@@ -185,8 +171,6 @@ namespace PatternGeneratorJRL
void
addTerm
(
const
MAL_VECTOR
(
&
Vec
,
double
),
int
type
,
unsigned
int
row
);
/// \name Dumping functions
/// \{
/// \brief Print of disk the parameters that are passed to the solver
void
dumpSolverParameters
(
std
::
ostream
&
aos
);
...
...
@@ -200,35 +184,27 @@ namespace PatternGeneratorJRL
/// \param filename
void
dump
(
int
type
,
const
char
*
filename
);
void
dump
(
int
type
,
std
::
ostream
&
);
/// \}
/// \brief Initialize array
///
/// \param
[out]
array
/// \param
[in]
size
/// \param array
/// \param size
template
<
class
type
>
void
initialize
(
type
*
array
,
int
size
,
type
value
)
{
std
::
fill_n
(
array
,
size
,
value
);
}
/// \brief Initialize whole array
///
/// \param
[in]
type
void
clear
(
int
type
);
/// \param type
void
clear
(
const
int
type
);
/// \brief Initialize block of matrix-array
///
/// \param[in] type
/// \param[in] row
/// \param[in] col
/// \param[in] nb_rows
/// \param[in] nb_cols
/// \param type
void
clear
(
int
type
,
int
row
,
int
col
,
int
nb_rows
,
int
nb_cols
);
/// \brief Solve the problem
///
/// \param[in] solver
/// \param[out] result
void
solve
(
int
solver
,
solution_t
&
result
);
//
...
...
@@ -236,39 +212,31 @@ namespace PatternGeneratorJRL
//
protected
:
///
\brie
f
R
ele
s
e memory.
void
r
eleaseMemory
();
///
The method doing the real job o
f
r
ele
asing th
e memory.
void
R
eleaseMemory
();
///
\brief Allocat
e memory.
///
The method allocating th
e memory.
/// Called when setting the dimensions of the problem.
///
/// \param nb_variables
/// \param nb_constraints
void
resizeAll
(
int
nb_variables
,
int
nb_constraints
);
void
resizeAll
(
int
NbVariables
,
int
NbConstraints
);
//
//Private members
//
private
:
/// \name ql-parameters
/// \{
/// \brief QLD parameters
int
m
,
me
,
mmax
,
n
,
nmax
,
mnn
;
double
*
Q
,
*
D
,
*
DU
,
*
DS
,
*
XL
,
*
XU
,
*
X
,
*
U
,
*
war
;
double
*
Q
,
*
D
,
*
DU
,
*
DS
,
*
XL
,
*
XU
,
*
X
,
*
U
,
*
war
;
//For COM
int
*
iwar
;
int
iout
,
ifail
,
iprint
,
lwar
,
liwar
;
double
Eps
;
/// \}
/// \brief Number of optimization parameters
int
m_NbVariables
;
/// \brief
Total n
umber of
constraint
s
/// \brief
N
umber of
optimization parameter
s
int
m_NbConstraints
;
/// \brief Number of equality constraints
int
m_NbEqConstraints
;
/// \brief Reallocation margins
int
m_ReallocMarginVar
,
m_ReallocMarginConstr
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment