Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
ebe3737c
Commit
ebe3737c
authored
Dec 16, 2013
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jan 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pred/successorIndex removed also from BatchDecomposition and BatchReassembly
parent
c3dfe7ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+2
-6
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+5
-9
No files found.
dream/simulation/BatchDecomposition.py
View file @
ebe3737c
...
...
@@ -162,14 +162,12 @@ class BatchDecomposition(CoreObject):
#give the entity to the successor that is waiting for the most time.
#plant does not do this in every occasion!
maxTimeWaiting
=
0
i
=
0
# loop through the object in the successor list
for
object
in
activeObject
.
next
:
if
(
object
.
canAccept
()):
# if the object can accept
timeWaiting
=
now
()
-
object
.
timeLastEntityLeft
# compare the time that it has been waiting
if
(
timeWaiting
>
maxTimeWaiting
or
maxTimeWaiting
==
0
):
# with the others'
maxTimeWaiting
=
timeWaiting
self
.
successorIndex
=
i
# and update the successorIndex to the index of this object
i
+=
1
self
.
receiver
=
object
# and update the successorIndex to the index of this object
#return true only to the predecessor from which the queue will take
receiverObject
=
activeObject
.
getReceiverObject
()
...
...
@@ -191,7 +189,6 @@ class BatchDecomposition(CoreObject):
maxTimeWaiting
=
0
# dummy timer to check which predecessor has been waiting the most
#loop through the predecessors to see which have to dispose and which is the one blocked for longer
i
=
0
# loop through all the predecessors
for
object
in
activeObject
.
previous
:
if
(
object
.
haveToDispose
(
activeObject
)):
# if they have something to dispose off
isRequested
=
True
# then the Queue is requested to handle the entity
...
...
@@ -202,7 +199,6 @@ class BatchDecomposition(CoreObject):
#if more than one predecessor have to dispose take the part from the one that is blocked longer
if
(
timeWaiting
>=
maxTimeWaiting
):
activeObject
.
predecessorIndex
=
i
activeObject
.
giver
=
object
maxTimeWaiting
=
timeWaiting
i
+=
1
# pick the predecessor waiting the more
return
self
.
canAccept
(
self
)
and
isRequested
# return true when the Queue is not fully occupied and a predecessor is requesting it
dream/simulation/BatchReassembly.py
View file @
ebe3737c
...
...
@@ -162,21 +162,19 @@ class BatchReassembly(CoreObject):
and
activeObjectQueue
[
0
].
type
==
"Batch"
# the control of the length of the queue is not needed
thecaller
=
callerObject
#give the entity to the
successo
r that is waiting for the most time.
#give the entity to the
receive
r that is waiting for the most time.
#plant does not do this in every occasion!
maxTimeWaiting
=
0
i
=
0
# loop through the object in the successor list
for
object
in
activeObject
.
next
:
if
(
object
.
canAccept
()):
# if the object can accept
timeWaiting
=
now
()
-
object
.
timeLastEntityLeft
# compare the time that it has been waiting
if
(
timeWaiting
>
maxTimeWaiting
or
maxTimeWaiting
==
0
):
# with the others'
maxTimeWaiting
=
timeWaiting
self
.
successorIndex
=
i
# and update the successorIndex to the index of this object
i
+=
1
self
.
receiver
=
object
# and update the successorIndex to the index of this object
#return true only to the predecessor from which the queue will take
receiverObject
=
activeObject
.
getReceiverObject
()
return
len
(
self
.
Res
.
activeQ
)
==
1
\
return
len
(
self
.
getActiveObjectueue
)
==
1
\
and
(
thecaller
is
receiverObject
)
\
and
activeObjectQueue
[
0
].
type
!=
"Batch"
# the control of the length of the queue is not needed
...
...
@@ -200,8 +198,7 @@ class BatchReassembly(CoreObject):
isRequested
=
False
# dummy boolean variable to check if any predecessor has something to hand in
maxTimeWaiting
=
0
# dummy timer to check which predecessor has been waiting the most
#loop through the predecessors to see which have to dispose and which is the one blocked for longer
i
=
0
# loop through all the predecessors
#loop through the predecessors to see which have to dispose and which is the one blocked for longer # loop through all the predecessors
for
object
in
activeObject
.
previous
:
if
(
object
.
haveToDispose
(
activeObject
)):
# if they have something to dispose off
isRequested
=
True
# then the Queue is requested to handle the entity
...
...
@@ -212,9 +209,8 @@ class BatchReassembly(CoreObject):
#if more than one predecessor have to dispose take the part from the one that is blocked longer
if
(
timeWaiting
>=
maxTimeWaiting
):
activeObject
.
predecessorIndex
=
i
activeObject
.
giver
=
object
maxTimeWaiting
=
timeWaiting
i
+=
1
# pick the predecessor waiting the more
return
isRequested
\
and
activeObject
.
Up
\
and
len
(
activeObjectQueue
<
self
.
numberOfSubBatches
)
\
...
...
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