Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpp-manipulation
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
Show more breadcrumbs
Guilhem Saurel
hpp-manipulation
Commits
93004ae1
Commit
93004ae1
authored
6 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve readability of CrossStateOptimization
parent
a0249cbd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/steering-method/cross-state-optimization.cc
+11
-7
11 additions, 7 deletions
src/steering-method/cross-state-optimization.cc
with
11 additions
and
7 deletions
src/steering-method/cross-state-optimization.cc
+
11
−
7
View file @
93004ae1
...
@@ -94,7 +94,11 @@ namespace hpp {
...
@@ -94,7 +94,11 @@ namespace hpp {
typedef
std
::
vector
<
state_with_depth
>
state_with_depths_t
;
typedef
std
::
vector
<
state_with_depth
>
state_with_depths_t
;
typedef
std
::
map
<
StatePtr_t
,
state_with_depths_t
>
StateMap_t
;
typedef
std
::
map
<
StatePtr_t
,
state_with_depths_t
>
StateMap_t
;
/// std::size_t is the index in state_with_depths_t at StateMap_t::iterator
/// std::size_t is the index in state_with_depths_t at StateMap_t::iterator
typedef
std
::
pair
<
StateMap_t
::
iterator
,
std
::
size_t
>
state_with_depth_ptr_t
;
struct
state_with_depth_ptr_t
{
StateMap_t
::
iterator
state
;
std
::
size_t
parentIdx
;
state_with_depth_ptr_t
(
const
StateMap_t
::
iterator
&
it
,
std
::
size_t
idx
)
:
state
(
it
),
parentIdx
(
idx
)
{}
};
typedef
std
::
queue
<
state_with_depth_ptr_t
>
Queue_t
;
typedef
std
::
queue
<
state_with_depth_ptr_t
>
Queue_t
;
typedef
std
::
set
<
EdgePtr_t
>
VisitedEdge_t
;
typedef
std
::
set
<
EdgePtr_t
>
VisitedEdge_t
;
std
::
size_t
maxDepth
;
std
::
size_t
maxDepth
;
...
@@ -104,8 +108,8 @@ namespace hpp {
...
@@ -104,8 +108,8 @@ namespace hpp {
const
state_with_depth
&
getParent
(
const
state_with_depth_ptr_t
&
_p
)
const
const
state_with_depth
&
getParent
(
const
state_with_depth_ptr_t
&
_p
)
const
{
{
const
state_with_depths_t
&
parents
=
_p
.
first
->
second
;
const
state_with_depths_t
&
parents
=
_p
.
state
->
second
;
return
parents
[
_p
.
second
];
return
parents
[
_p
.
parentIdx
];
}
}
state_with_depth_ptr_t
addInitState
()
state_with_depth_ptr_t
addInitState
()
...
@@ -119,8 +123,8 @@ namespace hpp {
...
@@ -119,8 +123,8 @@ namespace hpp {
const
state_with_depth_ptr_t
&
_p
,
const
state_with_depth_ptr_t
&
_p
,
const
EdgePtr_t
&
transition
)
const
EdgePtr_t
&
transition
)
{
{
const
state_with_depths_t
&
parents
=
_p
.
first
->
second
;
const
state_with_depths_t
&
parents
=
_p
.
state
->
second
;
const
state_with_depth
&
from
=
parents
[
_p
.
second
];
const
state_with_depth
&
from
=
parents
[
_p
.
parentIdx
];
// Insert state to if necessary
// Insert state to if necessary
StateMap_t
::
iterator
next
=
parent1
.
insert
(
StateMap_t
::
iterator
next
=
parent1
.
insert
(
...
@@ -129,7 +133,7 @@ namespace hpp {
...
@@ -129,7 +133,7 @@ namespace hpp {
)).
first
;
)).
first
;
next
->
second
.
push_back
(
next
->
second
.
push_back
(
state_with_depth
(
transition
,
from
.
l
+
1
,
_p
.
second
));
state_with_depth
(
transition
,
from
.
l
+
1
,
_p
.
parentIdx
));
return
state_with_depth_ptr_t
(
next
,
next
->
second
.
size
()
-
1
);
return
state_with_depth_ptr_t
(
next
,
next
->
second
.
size
()
-
1
);
}
}
...
@@ -147,7 +151,7 @@ namespace hpp {
...
@@ -147,7 +151,7 @@ namespace hpp {
bool
done
=
false
;
bool
done
=
false
;
const
Neighbors_t
&
neighbors
=
_state
.
first
->
first
->
neighbors
();
const
Neighbors_t
&
neighbors
=
_state
.
state
->
first
->
neighbors
();
for
(
Neighbors_t
::
const_iterator
_n
=
neighbors
.
begin
();
for
(
Neighbors_t
::
const_iterator
_n
=
neighbors
.
begin
();
_n
!=
neighbors
.
end
();
++
_n
)
{
_n
!=
neighbors
.
end
();
++
_n
)
{
EdgePtr_t
transition
=
_n
->
second
;
EdgePtr_t
transition
=
_n
->
second
;
...
...
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