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
d4b71719
Commit
d4b71719
authored
Feb 04, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2 plugins added
parent
0240879b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
dream/plugins/AddDemandPlannerGenerator.py
dream/plugins/AddDemandPlannerGenerator.py
+29
-0
dream/plugins/ReadDemandPlannerExcelInput.py
dream/plugins/ReadDemandPlannerExcelInput.py
+30
-0
No files found.
dream/plugins/AddDemandPlannerGenerator.py
0 → 100644
View file @
d4b71719
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
datetime
from
dream.plugins
import
plugin
class
AddDemandPlannerGenerator
(
plugin
.
InputPreparationPlugin
):
""" Input preparation
adds an EventGenerator that will call the Demand Planning algorithm once
"""
def
preprocess
(
self
,
data
):
nodes
=
data
[
'graph'
][
'node'
]
nodes
[
'DPG'
]
=
{
"name"
:
"DemandPlannerGenerator"
,
"prioritizeIfCanFinish"
:
1
,
"interval"
:
1
,
"start"
:
0
,
"stop"
:
0.5
,
"_class"
:
"dream.simulation.EventGenerator.EventGenerator"
,
"method"
:
"dream.simulation.applications.DemandPlanning.executor_ACO.main"
}
#print nodes
return
data
\ No newline at end of file
dream/plugins/ReadDemandPlannerExcelInput.py
0 → 100644
View file @
d4b71719
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
StringIO
import
xlrd
from
dream.plugins
import
plugin
class
ReadDemandPlannerExcelInput
(
plugin
.
OutputPreparationPlugin
):
""" Example on how to read an excel spreadsheet
"""
def
preprocess
(
self
,
data
):
""" Example showing how to read an attached file
"""
# Attachement is encoded in data uri, ie data:application/excel;base64,***
data_uri_encoded_input_data
=
data
[
'input'
].
get
(
self
.
configuration_dict
[
'input_id'
],
{})
if
data_uri_encoded_input_data
:
mime_type
,
attachement_data
=
data_uri_encoded_input_data
[
len
(
'data:'
):].
split
(
';base64,'
,
1
)
attachement_data
=
attachement_data
.
decode
(
'base64'
)
workbook
=
xlrd
.
open_workbook
(
file_contents
=
attachement_data
)
print
"This spreadsheet contains sheets:"
,
workbook
.
sheet_names
()
#raise ValueError(workbook.sheet_names())
return
data
\ No newline at end of file
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