Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AMOEBA3
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
SMAC
Learning Group
AMOEBA3
Commits
383ca913
Commit
383ca913
authored
6 years ago
by
BrunoDatoMeneses
Browse files
Options
Downloads
Patches
Plain Diff
FIX: getPercepts() not calling all agents all the time anymore
parent
c79a489e
No related branches found
No related tags found
2 merge requests
!3
Merge masters
,
!2
Merge dev into develop
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AMOEBAonAMAK/src/kernel/AMOEBA.java
+41
-7
41 additions, 7 deletions
AMOEBAonAMAK/src/kernel/AMOEBA.java
with
41 additions
and
7 deletions
AMOEBAonAMAK/src/kernel/AMOEBA.java
+
41
−
7
View file @
383ca913
...
...
@@ -57,6 +57,8 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
private
int
cycleWithoutRender
=
0
;
private
ArrayList
<
Context
>
spatiallyAlteredContext
=
new
ArrayList
<>();
private
ArrayList
<
Context
>
toKillContexts
=
new
ArrayList
<>();
private
ArrayList
<
Context
>
lastModifiedContext
=
new
ArrayList
<>();
private
ArrayList
<
Context
>
alteredContexts
=
new
ArrayList
<>();
...
...
@@ -66,6 +68,8 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
private
HashSet
<
Context
>
neighborContexts
;
private
ReadWriteLock
neighborContextsLock
=
new
ReentrantReadWriteLock
();
private
ArrayList
<
Percept
>
percepts
;
/**
* Instantiates a new, empty, amoeba.
...
...
@@ -95,6 +99,9 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
protected
void
onInitialConfiguration
()
{
super
.
onInitialConfiguration
();
getEnvironment
().
setAmoeba
(
this
);
}
@Override
...
...
@@ -205,6 +212,7 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
neighborContexts
=
null
;
environment
.
resetNbActivatedAgent
();
spatiallyAlteredContext
.
clear
();
toKillContexts
.
clear
();
lastModifiedContext
.
clear
();
alteredContexts
.
clear
();
for
(
Context
ctxt
:
getContexts
())
{
...
...
@@ -492,13 +500,22 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
}
public
ArrayList
<
Percept
>
getPercepts
()
{
ArrayList
<
Percept
>
percepts
=
new
ArrayList
<>();
for
(
Agent
<?
extends
Amas
<
World
>,
World
>
agent
:
getAgents
())
{
if
((
agent
instanceof
Percept
))
{
percepts
.
add
((
Percept
)
agent
);
if
(
percepts
==
null
||
percepts
.
size
()==
0
)
{
ArrayList
<
Percept
>
pcts
=
new
ArrayList
<
Percept
>();
for
(
Agent
<?
extends
Amas
<
World
>,
World
>
agent
:
getAgents
())
{
if
((
agent
instanceof
Percept
))
{
pcts
.
add
((
Percept
)
agent
);
}
}
percepts
=
pcts
;
}
return
percepts
;
}
/**
...
...
@@ -582,12 +599,21 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
return
head
;
}
public
ArrayList
<
Context
>
getSpatiallyAlteredContext
()
{
public
ArrayList
<
Context
>
getSpatiallyAlteredContext
ForUnityUI
()
{
return
spatiallyAlteredContext
;
}
public
void
addSpatiallyAlteredContext
(
Context
ctxt
)
{
spatiallyAlteredContext
.
add
(
ctxt
);
public
void
addSpatiallyAlteredContextForUnityUI
(
Context
ctxt
)
{
if
(!
ctxt
.
isFlat
())
spatiallyAlteredContext
.
add
(
ctxt
);
}
public
ArrayList
<
Context
>
getToKillContextsForUnityUI
()
{
return
toKillContexts
;
}
public
void
addToKillContextForUnityUI
(
Context
ctxt
)
{
toKillContexts
.
add
(
ctxt
);
}
public
void
addLastmodifiedContext
(
Context
context
)
{
...
...
@@ -693,5 +719,13 @@ public class AMOEBA extends Amas<World> implements IAMOEBA {
return
message
;
}
public
void
setPercepts
()
{
percepts
=
new
ArrayList
<
Percept
>();
for
(
Agent
<?
extends
Amas
<
World
>,
World
>
agent
:
getAgents
())
{
if
((
agent
instanceof
Percept
))
{
percepts
.
add
((
Percept
)
agent
);
}
}
}
}
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