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
22151603
Commit
22151603
authored
Sep 22, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prints in console deactivated
parent
481a9db5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
46 deletions
+3
-46
dream/simulation/Allocation.py
dream/simulation/Allocation.py
+3
-42
dream/simulation/AllocationRoutine.py
dream/simulation/AllocationRoutine.py
+0
-1
dream/simulation/GUI/DemandPlanning.py
dream/simulation/GUI/DemandPlanning.py
+0
-3
No files found.
dream/simulation/Allocation.py
View file @
22151603
...
...
@@ -40,11 +40,6 @@ class Allocation():
for
x
in
G
.
RouteDict
[
MA
.
MAid
][
'route'
]:
requiredCapacity
[
x
]
=
G
.
RouteDict
[
MA
.
MAid
][
'route'
][
x
]
*
MA
.
qty
print
'-'
*
100
print
'MA'
,
MA
.
MAid
,
'week'
,
self
.
week
print
'Quantity to allocate='
,
MA
.
qty
print
'required'
,
requiredCapacity
print
'available'
,
G
.
CurrentCapacityDict
# read the remaining capacity for thegiven week and subtract the required from it
remainingCapacity
=
{}
for
bottleneck
in
G
.
CurrentCapacityDict
:
...
...
@@ -52,10 +47,6 @@ class Allocation():
# if we dropped below zero then the capacity is not sufficient
if
remainingCapacity
[
bottleneck
]
<
0
:
sufficient
=
False
#remainingCapacity = numpy.array(G.currentCapacity[self.week]) - numpy.array(requiredCapacity)
#remainingCapacity = remainingCapacity.tolist()
print
'remaining'
,
remainingCapacity
print
sufficient
# check if there is sufficient capacity to process the order
if
sufficient
:
...
...
@@ -64,8 +55,6 @@ class Allocation():
if
MA
.
qty
>=
G
.
minPackingSize
:
for
bottleneck
in
G
.
CurrentCapacityDict
:
G
.
CurrentCapacityDict
[
bottleneck
][
self
.
week
]
=
remainingCapacity
[
bottleneck
]
print
'allocation performed fully! remaining:'
print
G
.
CurrentCapacityDict
# if the capacity available is not sufficient, the max allocable qty is derived
else
:
...
...
@@ -78,26 +67,16 @@ class Allocation():
excessUnits
=
remainingCapacity
[
bottleneck
]
/
G
.
RouteDict
[
MA
.
MAid
][
'route'
][
bottleneck
]
if
math
.
ceil
(
math
.
fabs
(
excessUnits
))
>
excess
:
excess
=
math
.
ceil
(
math
.
fabs
(
excessUnits
))
print
'excess'
,
excess
# for i in range(len(remainingCapacity)):
# if requiredCapacity[i]>0 and remainingCapacity[i]<0:
# excessUnits[i] = remainingCapacity[i]/G.route[MA.MAid][i]
# excess = math.ceil(math.fabs(min(excessUnits)))
# update remaining capacity
assert
(
excess
<=
MA
.
qty
or
MA
.
qty
<
G
.
minPackingSize
)
allocableQty
=
MA
.
qty
-
excess
print
'MA quantity'
,
MA
.
qty
print
'allocableQty'
,
allocableQty
if
allocableQty
>=
G
.
minPackingSize
:
#rCap = numpy.array(G.currentCapacity[self.week]) - numpy.multiply(allocableQty,G.route[MA.MAid])
for
bottleneck
in
G
.
CurrentCapacityDict
:
G
.
CurrentCapacityDict
[
bottleneck
][
self
.
week
]
-=
allocableQty
*
G
.
RouteDict
[
MA
.
MAid
][
'route'
][
bottleneck
]
print
'allocation performed partially! remaining:'
print
G
.
CurrentCapacityDict
# update attributes/variables affected by allocation
if
allocableQty
>=
G
.
minPackingSize
:
...
...
@@ -115,13 +94,8 @@ class Allocation():
G
.
PPOSLateness
[
G
.
replication
]
+=
max
([
0
,
self
.
week
-
MA
.
originalWeek
])
*
allocableQty
G
.
PPOSEarliness
[
G
.
replication
]
+=
max
([
0
,
MA
.
originalWeek
-
self
.
week
])
*
allocableQty
print
'-'
*
100
def
alternativeRoutes
(
self
,
MA
):
sufficient
=
False
#flag that shows if we have sufficient capacity
print
'='
*
100
print
'MA'
,
MA
.
MAid
,
'week'
,
self
.
week
print
'Quantity to allocate='
,
MA
.
qty
# identify MAs with the same SP as the MA investigated
alternativeMADict
=
{}
#FIXME: the PPOS attribute can be used instead for the current MA
# loop through the MAinfo
...
...
@@ -135,8 +109,6 @@ class Allocation():
if
PPOS
==
MA
.
PPOSid
and
SP
==
MA
.
SPid
:
alternativeMADict
[
alernativeMA
]
=
G
.
RouteDict
[
alernativeMA
]
print
'alternativeRoutes'
,
alternativeMADict
print
'available'
,
G
.
CurrentCapacityDict
# calculate max number of units for each alternative MA
maxUnits
=
{}
for
alternativeMA
in
alternativeMADict
:
...
...
@@ -147,9 +119,7 @@ class Allocation():
MAunits
.
append
(
G
.
CurrentCapacityDict
[
routeElement
][
self
.
week
]
/
units
)
sufficient
=
True
maxUnits
[
alternativeMA
]
=
math
.
floor
(
min
(
MAunits
))
print
'print units that can be allocated in alternative routes:'
,
maxUnits
# choose MA with max number of units
if
maxUnits
and
sufficient
:
maxU
=
0
...
...
@@ -163,19 +133,12 @@ class Allocation():
# choose MA randomly among those with max number of units
chosenMAId
=
random
.
choice
(
maxID
)
print
'chose to allocate in MA with id ='
,
chosenMAId
allocableQty
=
min
([
maxU
,
MA
.
qty
])
print
'in this route we can allocate '
,
allocableQty
if
allocableQty
>=
G
.
minPackingSize
:
for
bottleneck
in
G
.
CurrentCapacityDict
:
G
.
CurrentCapacityDict
[
bottleneck
][
self
.
week
]
-=
allocableQty
*
G
.
RouteDict
[
chosenMAId
][
'route'
][
bottleneck
]
print
'allocation performed in the alternative route! remaining:'
print
G
.
CurrentCapacityDict
# update attributes/variables affected by allocation
MA
.
qty
-=
allocableQty
MA
.
minQty
=
max
([
0
,
MA
.
minQty
-
allocableQty
])
...
...
@@ -190,7 +153,5 @@ class Allocation():
G
.
AllocationPPOS
[
G
.
replication
].
append
([
MA
.
orderID
,
chosenMAId
,
allocableQty
,
self
.
week
+
1
])
G
.
PPOSLateness
[
G
.
replication
]
+=
max
([
0
,
self
.
week
-
MA
.
originalWeek
])
*
allocableQty
G
.
PPOSEarliness
[
G
.
replication
]
+=
max
([
0
,
MA
.
originalWeek
-
self
.
week
])
*
allocableQty
print
'='
*
100
\ No newline at end of file
dream/simulation/AllocationRoutine.py
View file @
22151603
...
...
@@ -140,7 +140,6 @@ class AllocationRoutine():
if
len
(
self
.
internalBuffer
):
if
self
.
itemType
==
1
:
G
.
ExcessFutureBuffer
[
G
.
replication
]
=
self
.
internalBuffer
print
'end allocation routine - excessBuffer'
,
[
i
.
orderID
for
i
in
G
.
ExcessFutureBuffer
[
G
.
replication
]],
[
i
.
qty
for
i
in
G
.
ExcessFutureBuffer
[
G
.
replication
]]
else
:
G
.
ExcessPPOSBuffer
[
G
.
replication
]
=
self
.
internalBuffer
...
...
dream/simulation/GUI/DemandPlanning.py
View file @
22151603
...
...
@@ -151,8 +151,6 @@ def writeOutput():
minExcessPPOS
=
sum
([
i
.
qty
for
i
in
G
.
ExcessPPOSminBuffer
[
k
]])
sheet1
.
write
(
2
,
3
,
excessPPOS
)
sheet1
.
write
(
2
,
4
,
minExcessPPOS
)
print
'excess future'
,
[
i
.
orderID
for
i
in
G
.
ExcessFutureBuffer
[
k
]],
[
i
.
qty
for
i
in
G
.
ExcessFutureBuffer
[
k
]]
print
'excess ppos'
,
[
i
.
orderID
for
i
in
G
.
ExcessPPOSBuffer
[
k
]],
[
i
.
qty
for
i
in
G
.
ExcessPPOSBuffer
[
k
]]
excessFuture
=
sum
([
i
.
qty
for
i
in
G
.
ExcessFutureBuffer
[
k
]])
minExcessFuture
=
sum
([
i
.
qty
for
i
in
G
.
ExcessFutureMinBuffer
[
k
]])
sheet1
.
write
(
1
,
6
,
'% Unconstrained Excess'
)
...
...
@@ -199,7 +197,6 @@ def writeOutput():
sheet1
.
write
(
4
,
6
,
excessFuture
*
100.0
/
totQty
)
sheet1
.
write
(
4
,
7
,
minExcessFuture
*
100.0
/
totQty
)
print
'allocation'
,
alloc
counterCols
=
[
5
for
i
in
range
(
len
(
profile
))]
# TODO the below crashes, got to check
for
i
in
range
(
len
(
alloc
)):
...
...
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