Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
old_macaon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
old_macaon
Commits
8353c4cc
Commit
8353c4cc
authored
Jun 26, 2019
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Improved BACK action appliable detection
parent
0ab11e48
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
transition_machine/include/Config.hpp
+1
-1
1 addition, 1 deletion
transition_machine/include/Config.hpp
transition_machine/src/ActionBank.cpp
+26
-5
26 additions, 5 deletions
transition_machine/src/ActionBank.cpp
with
27 additions
and
6 deletions
transition_machine/include/Config.hpp
+
1
−
1
View file @
8353c4cc
...
@@ -138,7 +138,7 @@ class Config
...
@@ -138,7 +138,7 @@ class Config
private
:
private
:
const
unsigned
int
HISTORY_SIZE
=
1
000
;
const
unsigned
int
HISTORY_SIZE
=
2
000
;
/// @brief The name of the current state of the TransitionMachine.
/// @brief The name of the current state of the TransitionMachine.
std
::
string
currentStateName
;
std
::
string
currentStateName
;
/// @brief For each state of the TransitionMachine, an history of the Action that have been applied to this Config.
/// @brief For each state of the TransitionMachine, an history of the Action that have been applied to this Config.
...
...
This diff is collapsed.
Click to expand it.
transition_machine/src/ActionBank.cpp
+
26
−
5
View file @
8353c4cc
...
@@ -564,16 +564,37 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
...
@@ -564,16 +564,37 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
};
};
auto
appliable
=
[
dist
](
Config
&
c
,
Action
::
BasicAction
)
auto
appliable
=
[
dist
](
Config
&
c
,
Action
::
BasicAction
)
{
{
std
::
string
classifierName
=
c
.
pastActions
.
top
().
first
;
if
(
c
.
pastActions
.
size
()
==
0
)
int
stateHistorySize
=
c
.
getStateHistory
(
classifierName
).
size
();
if
(
c
.
getCurrentStateHistory
().
size
()
>=
2
&&
(
c
.
getCurrentStateHistory
().
top
()
==
"BACK"
||
c
.
getCurrentStateHistory
().
getElem
(
1
)
==
"BACK"
))
return
false
;
return
false
;
const
std
::
string
&
classifierName
=
c
.
pastActions
.
top
().
first
;
if
(
c
.
hashHistory
.
contains
(
c
.
computeHash
()))
if
(
c
.
hashHistory
.
contains
(
c
.
computeHash
()))
return
false
;
return
false
;
if
(
stateHistorySize
<=
dist
)
unsigned
int
topIndex
=
0
;
static
auto
undoOneTime
=
[](
Config
&
c
,
const
std
::
string
&
classifierName
,
unsigned
int
&
topIndex
)
{
while
(
true
)
{
topIndex
++
;
if
(
topIndex
>=
c
.
pastActions
.
size
())
return
;
if
(
c
.
pastActions
.
getElem
(
topIndex
).
first
==
classifierName
)
return
;
}
};
undoOneTime
(
c
,
classifierName
,
topIndex
);
for
(
int
i
=
0
;
i
<
dist
-
1
;
i
++
)
undoOneTime
(
c
,
classifierName
,
topIndex
);
undoOneTime
(
c
,
classifierName
,
topIndex
);
if
(
topIndex
>=
c
.
pastActions
.
size
())
return
false
;
return
false
;
return
true
;
return
true
;
...
...
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