Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
c72bf07b
Commit
c72bf07b
authored
Jun 03, 2022
by
Julian Zobel
Browse files
Bugfix in movement model
parent
f83796c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/common/DefaultHost.java
View file @
c72bf07b
...
...
@@ -207,7 +207,7 @@ public class DefaultHost implements SimHost {
@Override
public
String
toString
()
{
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"Host {"
);
sb
.
append
(
"Host
"
+
this
.
getId
().
value
()
+
"
{"
);
sb
.
append
(
"GroupID="
);
if
(
this
.
properties
!=
null
)
sb
.
append
(
this
.
properties
.
getGroupID
());
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/SocialGroupMovementModel.java
View file @
c72bf07b
...
...
@@ -132,13 +132,6 @@ public class SocialGroupMovementModel extends ModularMovementModel {
groupAttractionAssignment
.
updateTargetAttractionPoint
(
ms
,
assignment
);
}
}
// //attractionAssigment.addComponent(ms);
// if(placeNodesAtAP) {
// IAttractionPoint assignment = attractionAssigment.getAssignment(ms);
// ms.updateCurrentLocation(this.addOffset(new PositionVector(assignment),
// (assignment.hasRadius() ? Math.max(assignment.getRadius(), 25.0) : 25.0)));
// attractionAssigment.updateTargetAttractionPoint(ms, assignment);
// }
}
setTimeBetweenMoveOperations
(
timeBetweenMoveOperation
);
...
...
@@ -209,16 +202,9 @@ public class SocialGroupMovementModel extends ModularMovementModel {
}
else
{
throw
new
UnsupportedOperationException
(
"SimLocationActuator "
+
host
+
" is neither in a group nor a single node"
);
}
// TODO maybe remodel the group movement to do a whole group?
}
}
// TODO Move each group
Event
.
scheduleWithDelay
(
timeBetweenMoveOperation
,
this
,
null
,
EVENT_MOVE
);
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/groups/groupforming/AbstractGroupForming.java
View file @
c72bf07b
...
...
@@ -137,8 +137,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
for
(
SimLocationActuator
host
:
movementModel
.
getAllLocationActuators
())
{
stayDuration
.
put
(
host
.
getHost
().
getId
(),
new
Tuple
<
Long
,
Long
>(
0L
,
Time
.
getCurrentTime
()));
}
}
if
(!
enableGroups
)
{
return
;
...
...
@@ -187,9 +186,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
if
(
maxGroupSize
==
minGroupSize
)
return
minGroupSize
;
else
{
// int groupsize = (int) Math.max(1, rand.nextGaussian() * 0.93 + 2.76);
int
groupsize
=
rand
.
nextInt
(
maxGroupSize
-
minGroupSize
+
1
)
+
minGroupSize
;
//System.out.println("[AbstractGroupForming] Group Size: " + groupsize + " ("+minGroupSize+"/"+maxGroupSize+")");
return
groupsize
;
}
//return rand.nextInt(maxGroupSize - minGroupSize) + minGroupSize;
...
...
@@ -214,8 +211,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
if
(
targetDestination
.
hasRadius
())
{
destination
=
movementModel
.
addOffset
(
destination
,
targetDestination
.
getRadius
()
/
3
);
}
group
.
setDestination
(
destination
);
setGroupMeetingPoint
(
group
);
...
...
@@ -229,7 +225,7 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
groupCon
.
removeLeftGroupAtTimeEntry
(
member
);
}
}
groupCon
.
addGroup
(
group
);
// Inform analyzer of new group
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/groups/groupforming/DefaultGroupForming.java
View file @
c72bf07b
...
...
@@ -26,6 +26,7 @@ import java.util.LinkedList;
import
de.tud.kom.p2psim.api.topology.movement.SimLocationActuator
;
import
de.tud.kom.p2psim.api.topology.movement.local.LocalMovementStrategy
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.ISocialGroupMovementAnalyzer
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.AttractionPoint
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.BasicAttractionPoint
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction.hostcount.HostAtAttractionPointCounter
;
import
de.tud.kom.p2psim.impl.topology.movement.modularosm.groups.SocialMovementGroup
;
...
...
@@ -179,8 +180,9 @@ public class DefaultGroupForming extends AbstractGroupForming {
if
(
either
.
hasLeft
())
{
// Do nothing
}
else
if
(
leader
.
getCurrentTargetAttractionPoint
()
instanceof
BasicAttractionPoint
)
{
// do nothing, only intermediate AP
else
if
(
leader
.
getCurrentTargetAttractionPoint
()
instanceof
BasicAttractionPoint
&&
!(
leader
.
getCurrentTargetAttractionPoint
()
instanceof
AttractionPoint
)
)
{
// do nothing, only intermediate AP
transition
.
reachedAttractionPoint
(
leader
,
leader
.
getCurrentTargetAttractionPoint
());
}
else
{
transition
.
reachedAttractionPoint
(
leader
,
leader
.
getCurrentTargetAttractionPoint
());
...
...
Write
Preview
Markdown
is supported
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