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
34c1c8e6
Commit
34c1c8e6
authored
Feb 24, 2014
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PartJobShop: very simple order in GUI have now successfull simulation run
All the display of results needs to be reviewed
parent
e53c6727
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
408 additions
and
279 deletions
+408
-279
dream/simulation/Examples/JobShopWithParts.json
dream/simulation/Examples/JobShopWithParts.json
+287
-254
dream/simulation/GUI/PartJobShop.py
dream/simulation/GUI/PartJobShop.py
+121
-25
No files found.
dream/simulation/Examples/JobShopWithParts.json
View file @
34c1c8e6
{
"nodes"
:
{
"E1"
:
{
"_class"
:
"Dream.ExitJobShop"
,
"element_id"
:
"DreamNode_1"
"edges"
:
{
"con_10"
:
[
"QStart"
,
"CAD2"
,
{}
],
"con_15"
:
[
"CAD1"
,
"Decomposition"
,
{}
],
"con_20"
:
[
"Decomposition"
,
"QCAM"
,
{}
],
"con_25"
:
[
"QCAM"
,
"CAM1"
,
{}
],
"con_30"
:
[
"QCAM"
,
"CAM2"
,
{}
],
"con_35"
:
[
"CAD2"
,
"Decomposition"
,
{}
],
"con_5"
:
[
"QStart"
,
"CAD1"
,
{}
]
},
"QStart"
:
{
"_class"
:
"Dream.QueueManagedJob"
,
"element_id"
:
"DreamNode_2"
,
"name"
:
"QStart"
,
"capacity"
:
"1"
,
"isDummy"
:
"0"
,
"schedulingRule"
:
"FIFO"
"general"
:
{
"confidenceLevel"
:
"0.95"
,
"currentDate"
:
""
,
"maxSimTime"
:
"-1"
,
"numberOfAntsPerGenerations"
:
"20"
,
"numberOfGenerations"
:
"10"
,
"numberOfReplications"
:
"1"
,
"numberOfSolutions"
:
"4"
,
"processTimeout"
:
"2000"
},
"CAD1"
:
{
"_class"
:
"Dream.MachineJobShop"
,
"element_id"
:
"DreamNode_3"
,
"name"
:
"CAD1"
,
"processingTime"
:
{
"mean"
:
"0.9"
,
"distributionType"
:
"Fixed"
,
"stdev"
:
"0.1"
,
"min"
:
"0.1"
,
"max"
:
"1"
},
"failures"
:
{
"failureDistribution"
:
"No"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"repairman"
:
"None"
}
"nodes"
:
{
"CAD1"
:
{
"_class"
:
"Dream.MachineManagedJob"
,
"element_id"
:
"DreamNode_1"
,
"failures"
:
{
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"failureDistribution"
:
"No"
,
"repairman"
:
"None"
},
"name"
:
"CAD1"
,
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"max"
:
"1"
,
"mean"
:
"0.9"
,
"min"
:
"0.1"
,
"stdev"
:
"0.1"
}
},
"CAD2"
:
{
"_class"
:
"Dream.MachineManagedJob"
,
"element_id"
:
"DreamNode_2"
,
"failures"
:
{
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"failureDistribution"
:
"No"
,
"repairman"
:
"None"
},
"name"
:
"CAD2"
,
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"max"
:
"1"
,
"mean"
:
"0.9"
,
"min"
:
"0.1"
,
"stdev"
:
"0.1"
}
},
"CAM1"
:
{
"_class"
:
"Dream.MachineManagedJob"
,
"element_id"
:
"DreamNode_3"
,
"failures"
:
{
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"failureDistribution"
:
"No"
,
"repairman"
:
"None"
},
"name"
:
"CAM1"
,
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"max"
:
"1"
,
"mean"
:
"0.9"
,
"min"
:
"0.1"
,
"stdev"
:
"0.1"
}
},
"CAM2"
:
{
"_class"
:
"Dream.MachineManagedJob"
,
"element_id"
:
"DreamNode_4"
,
"failures"
:
{
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"failureDistribution"
:
"No"
,
"repairman"
:
"None"
},
"name"
:
"CAM2"
,
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"max"
:
"1"
,
"mean"
:
"0.9"
,
"min"
:
"0.1"
,
"stdev"
:
"0.1"
}
},
"Decomposition"
:
{
"_class"
:
"Dream.OrderDecomposition"
,
"element_id"
:
"DreamNode_5"
,
"name"
:
"Decomposition"
},
"E1"
:
{
"_class"
:
"Dream.ExitJobShop"
,
"element_id"
:
"DreamNode_6"
},
"PM1"
:
{
"_class"
:
"Dream.Operator"
,
"element_id"
:
"DreamNode_7"
,
"name"
:
"PM1"
},
"PM2"
:
{
"_class"
:
"Dream.Operator"
,
"element_id"
:
"DreamNode_8"
,
"name"
:
"PM2"
},
"QCAM"
:
{
"_class"
:
"Dream.ConditionalBuffer"
,
"capacity"
:
"1"
,
"element_id"
:
"DreamNode_9"
,
"isDummy"
:
"0"
,
"name"
:
"QCAM"
,
"schedulingRule"
:
"FIFO"
},
"QStart"
:
{
"_class"
:
"Dream.QueueManagedJob"
,
"capacity"
:
"1"
,
"element_id"
:
"DreamNode_10"
,
"isDummy"
:
"0"
,
"name"
:
"QStart"
,
"schedulingRule"
:
"FIFO"
}
},
"CAD2"
:
{
"_class"
:
"Dream.MachineJobShop"
,
"element_id"
:
"DreamNode_4"
,
"name"
:
"CAD2"
,
"processingTime"
:
{
"mean"
:
"0.9"
,
"distributionType"
:
"Fixed"
,
"stdev"
:
"0.1"
,
"min"
:
"0.1"
,
"max"
:
"1"
},
"failures"
:
{
"failureDistribution"
:
"No"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"repairman"
:
"None"
}
"preference"
:
{
"coordinates"
:
{
"CAD1"
:
{
"left"
:
0.141694796524387
,
"top"
:
0.49363124284218185
},
"CAD2"
:
{
"left"
:
0.30341115093502347
,
"top"
:
0.4960899425191736
},
"CAM1"
:
{
"left"
:
0.600132859916806
,
"top"
:
0.4709355535161045
},
"CAM2"
:
{
"left"
:
0.6843357695194952
,
"top"
:
0.7073489839960767
},
"Decomposition"
:
{
"left"
:
0.27829062765763835
,
"top"
:
0.781109974305828
},
"E1"
:
{
"left"
:
0.864763881619618
,
"top"
:
0.37504626611342784
},
"PM1"
:
{
"left"
:
0.001216264249816622
,
"top"
:
0.021371774115389482
},
"PM2"
:
{
"left"
:
0.002151852134290946
,
"top"
:
0.2275242854939252
},
"QCAM"
:
{
"left"
:
0.501475106078238
,
"top"
:
0.8170448157387837
},
"QStart"
:
{
"left"
:
0.13565460363009282
,
"top"
:
0.16642106881541613
}
},
"zoom_level"
:
0.99999
},
"Dream-OrderDecomposition_1"
:
{
"_class"
:
"Dream.OrderDecomposition"
,
"element_id"
:
"DreamNode_5"
},
"QCAM"
:
{
"_class"
:
"Dream.QueueManagedJob"
,
"element_id"
:
"DreamNode_6"
,
"name"
:
"Dream-QueueManagedJob_1"
,
"capacity"
:
"1"
,
"isDummy"
:
"0"
,
"schedulingRule"
:
"FIFO"
},
"CAM1"
:
{
"_class"
:
"Dream.MachineJobShop"
,
"element_id"
:
"DreamNode_7"
,
"name"
:
"CAM1"
,
"processingTime"
:
{
"mean"
:
"0.9"
,
"distributionType"
:
"Fixed"
,
"stdev"
:
"0.1"
,
"min"
:
"0.1"
,
"max"
:
"1"
},
"failures"
:
{
"failureDistribution"
:
"No"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"repairman"
:
"None"
}
},
"CAM2"
:
{
"_class"
:
"Dream.MachineJobShop"
,
"element_id"
:
"DreamNode_8"
,
"name"
:
"CAM2"
,
"processingTime"
:
{
"mean"
:
"0.9"
,
"distributionType"
:
"Fixed"
,
"stdev"
:
"0.1"
,
"min"
:
"0.1"
,
"max"
:
"1"
},
"failures"
:
{
"failureDistribution"
:
"No"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"repairman"
:
"None"
}
}
},
"edges"
:
{
"con_5"
:
[
"CAD1"
,
"Dream-OrderDecomposition_1"
,
{}
],
"con_10"
:
[
"CAD2"
,
"Dream-OrderDecomposition_1"
,
{}
],
"con_15"
:
[
"QStart"
,
"CAD1"
,
{}
],
"con_20"
:
[
"QStart"
,
"CAD2"
,
{}
],
"con_25"
:
[
"Dream-OrderDecomposition_1"
,
"QCAM"
,
{}
],
"con_30"
:
[
"QCAM"
,
"CAM1"
,
{}
],
"con_35"
:
[
"QCAM"
,
"CAM2"
,
{}
]
},
"preference"
:
{
"coordinates"
:
{
"E1"
:
{
"top"
:
0.37504626611342784
,
"left"
:
0.864763881619618
},
"QStart"
:
{
"left"
:
0.13565460363009282
,
"top"
:
0.16642106881541613
},
"CAD1"
:
{
"top"
:
0.49363124284218185
,
"left"
:
0.141694796524387
},
"CAD2"
:
{
"top"
:
0.4960899425191736
,
"left"
:
0.30341115093502347
},
"Dream-OrderDecomposition_1"
:
{
"top"
:
0.781109974305828
,
"left"
:
0.27829062765763835
},
"QCAM"
:
{
"top"
:
0.8881579756271594
,
"left"
:
0.4730332343902185
},
"CAM1"
:
{
"top"
:
0.4709355535161045
,
"left"
:
0.600132859916806
},
"CAM2"
:
{
"top"
:
0.7073489839960767
,
"left"
:
0.6843357695194952
}
},
"zoom_level"
:
0.99999
},
"general"
:
{
"numberOfReplications"
:
"1"
,
"maxSimTime"
:
"-1"
,
"confidenceLevel"
:
"0.95"
,
"processTimeout"
:
"2000"
,
"currentDate"
:
""
,
"numberOfGenerations"
:
"10"
,
"numberOfAntsPerGenerations"
:
"20"
,
"numberOfSolutions"
:
"4"
},
"wip_spreadsheet"
:
[
[
"Jobs"
,
"ID"
,
"Order Date"
,
"Due Date"
,
"Priority"
,
"Material"
,
"Sequence"
,
"Processing Times"
],
[
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
]
],
"wip_part_spreadsheet"
:
[
[
"Order ID"
,
"Due Date"
,
"Priority"
,
"Project Manager"
,
"Parts"
,
"Part Type"
,
"Sequence"
,
"Processing Times"
,
"Electrodes Needed"
],
[
"Order 1"
,
"2014/03/15"
,
"1"
,
"PM1"
,
"Mould1 Design"
,
"Design"
,
"CAD"
,
"6"
,
null
],
[
null
,
null
,
null
,
null
,
"Part1"
,
"Basic"
,
"CAM"
,
"3"
,
null
"shift_spreadsheet"
:
[
[
"Day"
,
"Machines"
,
"Start"
,
"End"
],
[
null
,
null
,
null
,
null
]
],
[
null
,
null
,
null
,
null
,
"Part2"
,
"Basic"
,
"CAM"
,
"2"
,
null
"wip_part_spreadsheet"
:
[
[
"Order ID"
,
"Due Date"
,
"Priority"
,
"Project Manager"
,
"Parts"
,
"Part Type"
,
"Sequence"
,
"Processing Times"
,
"Electrodes Needed"
],
[
"Order 1"
,
"2014/03/15"
,
"1"
,
"PM1"
,
"Mould1 Design"
,
"Design"
,
"CAD"
,
"6"
,
null
],
[
null
,
null
,
null
,
null
,
"Part1"
,
"Basic"
,
"CAM"
,
"3"
,
null
],
[
null
,
null
,
null
,
null
,
"Part2"
,
"Basic"
,
"CAM"
,
"2"
,
null
],
[
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
]
],
[
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
"wip_spreadsheet"
:
[
[
"Jobs"
,
"ID"
,
"Order Date"
,
"Due Date"
,
"Priority"
,
"Material"
,
"Sequence"
,
"Processing Times"
],
[
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
]
]
]
}
\ No newline at end of file
dream/simulation/GUI/PartJobShop.py
View file @
34c1c8e6
...
...
@@ -8,15 +8,17 @@ from datetime import datetime
from
dream.simulation.GUI
import
ACO
from
dream.simulation.GUI.Default
import
schema
MACHINE_TYPE_SET
=
set
([
"Dream.MachineManagedJob"
])
class
Simulation
(
ACO
.
Simulation
):
def
getConfigurationDict
(
self
):
conf
=
ACO
.
Simulation
.
getConfigurationDict
(
self
)
conf
[
"Dream-Machine
JobShop
"
]
=
{
conf
[
"Dream-Machine
ManagedJob
"
]
=
{
"property_list"
:
[
schema
[
"processingTime"
],
schema
[
"failures"
]
],
"_class"
:
'Dream.Machine
JobShop
'
,
"_class"
:
'Dream.Machine
ManagedJob
'
,
"name"
:
'Machine'
}
conf
[
"Dream-QueueManagedJob"
]
=
{
...
...
@@ -41,6 +43,10 @@ class Simulation(ACO.Simulation):
"_class"
:
'Dream.ExitJobShop'
,
"name"
:
'Exit'
}
conf
[
"Dream-Operator"
]
=
{
"_class"
:
'Dream.Operator'
,
"name"
:
'Operator'
}
conf
[
"Dream-OrderDecomposition"
]
=
{
"_class"
:
'Dream.OrderDecomposition'
,
"name"
:
'Decompo'
...
...
@@ -58,10 +64,44 @@ class Simulation(ACO.Simulation):
conf
.
pop
(
'Dream-Exit'
)
return
conf
def
getMachineNameSet
(
self
,
step_name
):
"""
Give list of machines given a particular step name. For example
if step_name is "CAM", it will return ["CAM1", "CAM2"]
"""
machine_name_set
=
set
()
for
machine_name
in
self
.
data
[
"nodes"
].
keys
():
if
machine_name
.
startswith
(
step_name
):
machine_name_set
.
add
(
machine_name
)
print
"getMachineNameSet, %r : %r"
%
(
step_name
,
machine_name_set
)
return
machine_name_set
def
getNotMachineNodePredecessorList
(
self
,
step_name
):
"""
Give the list of all predecessors that are not of type machine
For example, for step_name "CAM", it may return "QCAM"
"""
predecessor_list
=
[]
machine_name_set
=
self
.
getMachineNameSet
(
step_name
)
for
edge
in
self
.
data
[
"edges"
].
values
():
print
"getNotMachineNodePredecessorList, edge[1]: %r"
%
edge
[
1
]
if
edge
[
1
]
in
machine_name_set
:
predecessor_step
=
edge
[
0
]
if
predecessor_step
in
predecessor_list
:
continue
if
not
self
.
data
[
"nodes"
][
predecessor_step
][
"_class"
]
in
MACHINE_TYPE_SET
:
predecessor_list
=
[
predecessor_step
]
+
predecessor_list
predecessor_list
=
[
x
for
x
in
self
.
getNotMachineNodePredecessorList
(
predecessor_step
)
\
if
x
not
in
predecessor_list
]
+
predecessor_list
print
"getNotMachineNodePredecessorList, %r : %r"
%
(
step_name
,
predecessor_list
)
# XXX We have to returned an ordered list
return
predecessor_list
def
_preprocess
(
self
,
in_data
):
""" Set the WIP in queue from spreadsheet data.
"""
data
=
copy
(
in_data
)
self
.
data
=
data
now
=
datetime
.
now
()
if
data
[
'general'
][
'currentDate'
]:
...
...
@@ -71,40 +111,96 @@ class Simulation(ACO.Simulation):
# Data is presented as follow, with first line the order, then only parts of this order
# Order ID | Due Date | Priority | Project Manager | Parts | Part Type | Sequence | Processing Time | Electrodes needed
# Order 1 | 2013/02/15 | 1 | PM1 | P1 | type1 | Mach1-Mach2 | 3-5 |
wip_dict
=
{}
# | | | | P2 | type2 | Mach2-Mach3 | 4-7 |
wip_list
=
[]
print
"wip part data : %r"
%
(
data
[
'wip_part_spreadsheet'
],)
for
value_list
in
data
[
'wip_part_spreadsheet'
]:
i
=
0
wip_part_spreadsheet_length
=
len
(
data
[
'wip_part_spreadsheet'
])
while
i
<
wip_part_spreadsheet_length
:
value_list
=
data
[
'wip_part_spreadsheet'
][
i
]
print
"first value_list: %r"
%
(
value_list
,)
if
value_list
[
0
]
==
'Order ID'
or
not
value_list
[
4
]:
i
+=
1
continue
print
"still there after first continue"
order_dict
=
{}
wip_list
.
append
(
order_dict
)
order_id
,
due_date
,
priority
,
project_manager
,
part
,
part_type
,
\
sequence_list
,
processing_time_list
,
electrode_needed
=
value_list
due_date
=
(
datetime
.
strptime
(
due_date
,
'%Y/%m/%d'
)
-
now
).
days
sequence_list
=
sequence_list
.
split
(
'-'
)
processing_time_list
=
processing_time_list
.
split
(
'-'
)
wip_dict
.
setdefault
(
sequence_list
[
0
],
[]).
append
(
{
"_class"
:
"Dream.Job"
,
"id"
:
value_list
[
1
],
"name"
:
value_list
[
0
],
"dueDate"
:
dueDate
,
"route"
:
[
{
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"mean"
:
processing_time_list
[
i
],
},
"stationIdsList"
:
sequence_list
[
i
].
split
(
','
),
"stepNumber"
:
i
}
for
i
in
xrange
(
len
(
sequence_list
))]
}
)
for
node_id
in
data
[
'nodes'
].
keys
():
if
node_id
in
wip_dict
:
data
[
'nodes'
][
node_id
][
'wip'
]
=
wip_dict
[
node_id
]
order_dict
[
"_class"
]
=
"Dream.Order"
order_dict
[
"id"
]
=
order_id
order_dict
[
"manager"
]
=
project_manager
order_dict
[
"name"
]
=
order_id
# XXX can we do better than this ?
order_dict
[
"route"
]
=
[
{
"stationIdsList"
:
[
"QStart"
],
"stepNumber"
:
"0"
},
{
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"mean"
:
"1"
},
"setupTime"
:
{
"setupDistribution"
:
"Fixed"
,
"setupMean"
:
"0.5"
},
"stationIdsList"
:
[
"CAD1"
,
"CAD2"
],
"stepNumber"
:
"1"
}
]
i
+=
1
component_list
=
[]
if
i
<
wip_part_spreadsheet_length
:
while
data
[
'wip_part_spreadsheet'
][
i
][
0
]
==
None
:
value_list
=
data
[
'wip_part_spreadsheet'
][
i
]
if
value_list
[
4
]
==
None
:
break
order_id
,
due_date
,
priority
,
project_manager
,
part
,
part_type
,
\
sequence_list
,
processing_time_list
,
electrode_needed
=
value_list
sequence_list
=
sequence_list
.
split
(
'-'
)
processing_time_list
=
processing_time_list
.
split
(
'-'
)
component_dict
=
{}
component_dict
[
"_class"
]
=
"Dream.OrderComponent"
component_dict
[
"componentType"
]
=
part_type
component_dict
[
"id"
]
=
"%i"
%
i
component_dict
[
"name"
]
=
part
component_list
.
append
(
component_dict
)
route_list
=
[]
route_counter
=
0
for
j
,
sequence_step
in
enumerate
(
sequence_list
):
for
predecessor_step
in
self
.
getNotMachineNodePredecessorList
(
sequence_step
):
route
=
{
"stationIdsList"
:
[
predecessor_step
],
"stepNumber"
:
"%i"
%
route_counter
}
route_list
.
append
(
route
)
route_counter
+=
1
route
=
{
"stationIdsList"
:
list
(
self
.
getMachineNameSet
(
sequence_step
)),
"stepNumber"
:
"%i"
%
route_counter
,
"processingTime"
:
{
"distributionType"
:
"Fixed"
,
"mean"
:
"%i"
%
int
(
processing_time_list
[
j
])},
"setupTime"
:
{
"setupDistribution"
:
"Fixed"
,
"setupMean"
:
"0.5"
},
# XXX hardcoded value
}
route_list
.
append
(
route
)
route_counter
+=
1
component_dict
[
"route"
]
=
route_list
i
+=
1
order_dict
[
"componentsList"
]
=
component_list
data
[
"nodes"
][
"QStart"
][
"wip"
]
=
wip_list
del
(
data
[
'wip_part_spreadsheet'
])
from
pprint
import
pprint
print
pprint
(
data
)
return
data
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