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
d8c8e265
Commit
d8c8e265
authored
Feb 17, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'demandPlanningGlobalAttrs'
parents
ca09828e
ca0c2bd3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
56 deletions
+40
-56
dream/plugins/AddDemandPlannerGenerator.py
dream/plugins/AddDemandPlannerGenerator.py
+2
-1
dream/simulation/Examples/DemandPlanningAllInOneEmpty.json
dream/simulation/Examples/DemandPlanningAllInOneEmpty.json
+17
-21
dream/simulation/applications/DemandPlanning/ImportInput.py
dream/simulation/applications/DemandPlanning/ImportInput.py
+19
-32
dream/simulation/applications/DemandPlanning/executor_ACO.py
dream/simulation/applications/DemandPlanning/executor_ACO.py
+2
-2
No files found.
dream/plugins/AddDemandPlannerGenerator.py
View file @
d8c8e265
...
...
@@ -16,6 +16,7 @@ class AddDemandPlannerGenerator(plugin.InputPreparationPlugin):
nodes
=
data
[
'graph'
][
'node'
]
data_uri_encoded_input_data
=
data
[
'input'
].
get
(
self
.
configuration_dict
[
'input_id'
],
{})
algorithmAttributes
=
copy
(
data
[
'general'
])
nodes
[
'DPG'
]
=
{
"name"
:
"DemandPlannerGenerator"
,
...
...
@@ -25,7 +26,7 @@ class AddDemandPlannerGenerator(plugin.InputPreparationPlugin):
"stop"
:
0.5
,
"_class"
:
"dream.simulation.EventGenerator.EventGenerator"
,
"method"
:
"dream.simulation.applications.DemandPlanning.executor_ACO.main"
,
"argumentDict"
:
{
'input'
:
data_uri_encoded_input_data
}
"argumentDict"
:
{
'input'
:
data_uri_encoded_input_data
,
'algorithmAttributes'
:
algorithmAttributes
}
}
#print nodes
return
data
...
...
dream/simulation/Examples/DemandPlanningAllInOneEmpty.json
View file @
d8c8e265
...
...
@@ -2,26 +2,26 @@
"application_configuration"
:
{
"general"
:
{
"properties"
:
{
"
M
axEarliness"
:
{
"
m
axEarliness"
:
{
"default"
:
2
,
"description"
:
"Maximum Earliness"
,
"name"
:
"Maximum Earliness"
,
"type"
:
"number"
},
"
M
axLateness"
:
{
"
m
axLateness"
:
{
"default"
:
2
,
"description"
:
"Maximum Lateness"
,
"name"
:
"Maximum Lateness"
,
"type"
:
"number"
},
"
M
inDelta"
:
{
"default"
:
0
,
"
m
inDelta"
:
{
"default"
:
1
,
"description"
:
"Min Delta Target Utilisation"
,
"name"
:
"Min Delta Target Utilisation"
,
"type"
:
"number"
},
"ACO"
:
{
"default"
:
2
,
"default"
:
0
,
"description"
:
"ACO"
,
"name"
:
"ACO"
,
"type"
:
"number"
...
...
@@ -32,7 +32,7 @@
"name"
:
"Population size"
,
"type"
:
"number"
},
"ACO
numberOfGenerations"
:
{
"ACOnumberOfGenerations"
:
{
"default"
:
8
,
"description"
:
"ACO Number of generations"
,
"name"
:
"ACO Number of generations"
,
...
...
@@ -50,13 +50,13 @@
"name"
:
"Minimum Utilisation"
,
"type"
:
"number"
},
"
MinDeltaTarger
Utilisation"
:
{
"
minDeltaTarget
Utilisation"
:
{
"default"
:
0
,
"description"
:
"Minimum Delta Target Utilisation"
,
"name"
:
"Minimum Delta Target Utilisation"
,
"type"
:
"number"
},
"
MinTarger
Utilisation"
:
{
"
minTarget
Utilisation"
:
{
"default"
:
2
,
"description"
:
"Minimum Delta Utilisation"
,
"name"
:
"Minimum Delta Utilisation"
,
...
...
@@ -74,7 +74,7 @@
"name"
:
"GA population Size"
,
"type"
:
"number"
},
"GA
numberOfGenerations"
:
{
"GAnumberOfGenerations"
:
{
"default"
:
8
,
"description"
:
"GA Number of Generations"
,
"name"
:
"GA Number of Generations"
,
...
...
@@ -91,7 +91,13 @@
"description"
:
"Mutation Probability"
,
"name"
:
"Mutation Probability"
,
"type"
:
"number"
}
},
"processTimeout"
:
{
"default"
:
300
,
"description"
:
"Number of seconds before the calculation process is interrupted"
,
"title"
:
"ProcessTimeout"
,
"type"
:
"number"
}
}
},
"input"
:
{
...
...
@@ -160,17 +166,7 @@
},
"class_definition"
:
{},
"constraints"
:
{},
"general"
:
{
"TargetPPOS"
:
null
,
"TargetPPOSqty"
:
null
,
"TargetPPOSweek"
:
null
,
"ke_url"
:
""
,
"maxEarliness"
:
null
,
"maxLateness"
:
null
,
"minPackingSize"
:
null
,
"numberOfReplications"
:
1
,
"planningHorizon"
:
null
},
"general"
:
{},
"graph"
:
{
"edge"
:
{},
"node"
:
{}
...
...
dream/simulation/applications/DemandPlanning/ImportInput.py
View file @
d8c8e265
...
...
@@ -43,49 +43,36 @@ def my_split(s, seps):
res
+=
seq
.
split
(
sep
)
return
res
def
ImportInput
(
input
):
def
ImportInput
(
input
,
algorithmAttributes
):
# general simulation input
mime_type
,
attachement_data
=
input
[
len
(
'data:'
):].
split
(
';base64,'
,
1
)
attachement_data
=
attachement_data
.
decode
(
'base64'
)
wbin
=
xlrd
.
open_workbook
(
file_contents
=
attachement_data
)
sh
=
wbin
.
sheet_by_name
(
'Scalar_Var'
)
G
.
maxEarliness
=
withoutFormat
(
3
,
1
,
sh
,
1
)
G
.
maxLateness
=
withoutFormat
(
4
,
1
,
sh
,
1
)
G
.
maxEarliness
=
algorithmAttributes
.
get
(
'maxEarliness'
,
None
)
G
.
maxLateness
=
algorithmAttributes
.
get
(
'maxLateness'
,
None
)
# utilisation calculation
if
withoutFormat
(
9
,
1
,
sh
,
1
)
!=
''
:
G
.
minDeltaUt
=
withoutFormat
(
9
,
1
,
sh
,
1
)
G
.
minDeltaUt
=
algorithmAttributes
.
get
(
'minDelta'
,
None
)
# ACO parameters
if
withoutFormat
(
12
,
1
,
sh
,
1
)
!=
''
:
G
.
ACO
=
withoutFormat
(
12
,
1
,
sh
,
1
)
if
withoutFormat
(
13
,
1
,
sh
,
1
)
!=
''
:
G
.
popSize
=
withoutFormat
(
13
,
1
,
sh
,
1
)
if
withoutFormat
(
14
,
1
,
sh
,
1
)
!=
''
:
G
.
noGen
=
withoutFormat
(
14
,
1
,
sh
,
1
)
G
.
ACO
=
algorithmAttributes
.
get
(
'ACO'
,
None
)
G
.
popSize
=
algorithmAttributes
.
get
(
'ACOpopulationSize'
,
None
)
G
.
noGen
=
algorithmAttributes
.
get
(
'ACOnumberOfGenerations'
,
None
)
# optimisation weights for forecast IP method
if
withoutFormat
(
18
,
1
,
sh
,
1
)
!=
''
:
G
.
weightFactor
[
0
]
=
withoutFormat
(
18
,
1
,
sh
,
1
)
if
withoutFormat
(
19
,
1
,
sh
,
1
)
!=
''
:
G
.
weightFactor
[
1
]
=
withoutFormat
(
19
,
1
,
sh
,
1
)
if
withoutFormat
(
20
,
1
,
sh
,
1
)
!=
''
:
G
.
weightFactor
[
2
]
=
withoutFormat
(
20
,
1
,
sh
,
1
)
if
withoutFormat
(
21
,
1
,
sh
,
1
)
!=
''
:
G
.
weightFactor
[
3
]
=
withoutFormat
(
21
,
1
,
sh
,
1
)
G
.
weightFactor
[
0
]
=
algorithmAttributes
.
get
(
'maxAssignedQty'
,
None
)
G
.
weightFactor
[
1
]
=
algorithmAttributes
.
get
(
'minUtilisation'
,
None
)
G
.
weightFactor
[
2
]
=
algorithmAttributes
.
get
(
'minDeltaTargetUtilisation'
,
None
)
G
.
weightFactor
[
3
]
=
algorithmAttributes
.
get
(
'minTargetUtilisation'
,
None
)
# GA parameters
if
withoutFormat
(
23
,
1
,
sh
,
1
)
!=
''
:
G
.
GA
=
withoutFormat
(
23
,
1
,
sh
,
1
)
if
withoutFormat
(
24
,
1
,
sh
,
1
)
!=
''
:
G
.
popSizeGA
=
withoutFormat
(
24
,
1
,
sh
,
1
)
if
withoutFormat
(
25
,
1
,
sh
,
1
)
!=
''
:
G
.
noGenGA
=
withoutFormat
(
25
,
1
,
sh
,
1
)
if
withoutFormat
(
26
,
1
,
sh
,
1
)
!=
''
:
G
.
probXover
=
withoutFormat
(
26
,
1
,
sh
,
1
)
if
withoutFormat
(
27
,
1
,
sh
,
1
)
!=
''
:
G
.
probMutation
=
withoutFormat
(
27
,
1
,
sh
,
1
)
G
.
GA
=
algorithmAttributes
.
get
(
'GA'
,
None
)
G
.
popSizeGA
=
algorithmAttributes
.
get
(
'GApopulationSize'
,
None
)
G
.
noGenGA
=
algorithmAttributes
.
get
(
'GAnumberOfGenerations'
,
None
)
G
.
probXover
=
algorithmAttributes
.
get
(
'XOver'
,
None
)
G
.
probMutation
=
algorithmAttributes
.
get
(
'mutationProbability'
,
None
)
# Import capacity information...capacity = {Resource: {week {'originalCapacity':, 'remainingCapacity', 'minUtilisation'}
sh
=
wbin
.
sheet_by_name
(
'BN_Capa'
)
...
...
dream/simulation/applications/DemandPlanning/executor_ACO.py
View file @
d8c8e265
...
...
@@ -27,8 +27,8 @@ from AllocManagement_Hybrid import AllocManagement_Hybrid2
from
ImportInput
import
ImportInput
from
outputResults
import
outputResults
def
main
(
input
):
def
main
(
input
,
algorithmAttributes
):
assert
input
,
'no input is provided, the algorithm cannot run'
ImportInput
(
input
)
ImportInput
(
input
,
algorithmAttributes
)
AllocManagement_Hybrid2
()
outputResults
()
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