Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
CNNTrainLang
Commits
39987bfa
Commit
39987bfa
authored
Jul 09, 2019
by
Nicola Gatto
Browse files
Rename cocos check
parent
e3b5108d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnntrain/_cocos/Check
Ddpg
RequiresCriticNetwork.java
→
src/main/java/de/monticore/lang/monticar/cnntrain/_cocos/Check
ActorCritic
RequiresCriticNetwork.java
View file @
39987bfa
...
...
@@ -26,24 +26,23 @@ import de.monticore.lang.monticar.cnntrain._ast.ASTRLAlgorithmEntry;
import
de.monticore.lang.monticar.cnntrain.helper.ErrorCodes
;
import
de.se_rwth.commons.logging.Log
;
public
class
CheckDdpgRequiresCriticNetwork
implements
CNNTrainASTConfigurationCoCo
{
import
static
de
.
monticore
.
lang
.
monticar
.
cnntrain
.
_cocos
.
ASTConfigurationUtils
.
hasCriticEntry
;
import
static
de
.
monticore
.
lang
.
monticar
.
cnntrain
.
_cocos
.
ASTConfigurationUtils
.
isActorCriticAlgorithm
;
public
class
CheckActorCriticRequiresCriticNetwork
implements
CNNTrainASTConfigurationCoCo
{
@Override
public
void
check
(
ASTConfiguration
node
)
{
boolean
isDdpg
=
node
.
getEntriesList
().
stream
()
.
anyMatch
(
e
->
e
instanceof
ASTRLAlgorithmEntry
&&
((
ASTRLAlgorithmEntry
)
e
).
getValue
().
isPresentDdpg
());
boolean
hasCriticEntry
=
node
.
getEntriesList
().
stream
()
.
anyMatch
(
e
->
((
e
instanceof
ASTCriticNetworkEntry
)
&&
!((
ASTCriticNetworkEntry
)
e
).
getValue
().
getNameList
().
isEmpty
()));
boolean
isActorCritic
=
isActorCriticAlgorithm
(
node
);
boolean
hasCriticEntry
=
hasCriticEntry
(
node
);
if
(
is
Ddpg
&&
!
hasCriticEntry
)
{
if
(
is
ActorCritic
&&
!
hasCriticEntry
)
{
ASTRLAlgorithmEntry
algorithmEntry
=
node
.
getEntriesList
().
stream
()
.
filter
(
e
->
e
instanceof
ASTRLAlgorithmEntry
)
.
map
(
e
->
(
ASTRLAlgorithmEntry
)
e
)
.
findFirst
()
.
orElseThrow
(()
->
new
IllegalStateException
(
"ASTRLAlgorithmEntry entry must be available"
));
Log
.
error
(
"0"
+
ErrorCodes
.
REQUIRED_PARAMETER_MISSING
+
" DDPG learning algorithm requires critc"
+
Log
.
error
(
"0"
+
ErrorCodes
.
REQUIRED_PARAMETER_MISSING
+
" DDPG learning algorithm requires crit
i
c"
+
" network entry"
,
algorithmEntry
.
get_SourcePositionStart
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment