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
2704d564
Commit
2704d564
authored
Jul 24, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Sep 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operators allocation routine, to be updated and moved to other directory
parent
45e5539d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
dream/simulation/opAss_LPmethod.py
dream/simulation/opAss_LPmethod.py
+93
-0
No files found.
dream/simulation/opAss_LPmethod.py
0 → 100644
View file @
2704d564
'''
Created on 2 Jul 2014
@author: Anna
'''
from
pulp
import
*
def
opAss_LP
(
stationList
,
PBlist
,
PBskills
):
'''
classdocs
'''
machines
=
stationList
.
keys
()
# define LP problem
prob
=
LpProblem
(
"PBassignment"
,
LpMaximize
)
# declare variables...binary assignment variables (operator i to machine j)
PB_ass
=
LpVariable
.
dicts
(
'PB'
,
[(
i
,
j
)
for
i
in
PBlist
for
j
in
machines
]
,
0
,
1
,
LpBinary
)
# objective...assignment of PBs to stations with higher WIP...sum of WIP associated with stations where PB is assigned
obj1
=
[
stationList
[
st
][
'WIP'
]
*
PB_ass
[(
oper
,
st
)]
for
oper
in
PBlist
for
st
in
machines
]
prob
+=
lpSum
(
obj1
)
# constraint 1: # operators assigned to a station <= 1
for
machine
in
machines
:
prob
+=
lpSum
([
PB_ass
[(
oper
,
machine
)]
for
oper
in
PBlist
])
<=
1
# constraint 2: # machines assigned to an oeprator <= 1
for
operator
in
PBlist
:
prob
+=
lpSum
([
PB_ass
[(
operator
,
machine
)]
for
machine
in
machines
])
<=
1
# constraint 3: assign operator that are capable of running a machine
skills
=
{}
for
mach
in
machines
:
for
oper
in
PBlist
:
if
stationList
[
mach
][
'stationID'
]
in
PBskills
[
oper
]:
skills
[(
mach
,
oper
)]
=
1
else
:
skills
[(
mach
,
oper
)]
=
0
prob
+=
lpSum
([
skills
[(
mach
,
oper
)]
-
PB_ass
[(
oper
,
mach
)]])
>=
0
# write the problem data to an .lp file.
prob
.
writeLP
(
"PBassignment.lp"
)
prob
.
solve
()
solution
=
{}
for
mach
in
machines
:
for
oper
in
PBlist
:
if
PB_ass
[(
oper
,
mach
)].
varValue
>
0.00001
:
print
'PB'
,
oper
,
'assigned to machine'
,
mach
solution
[
str
(
oper
)]
=
str
(
mach
)
return
solution
def
main
():
# dict with stations to be operated during a shift (only active stations...ID can be the same for 2 machines as it identifies the type of process
# WIP can be derived from the buffer upstream the station...when 2 machines operate at a step the WIP will be divided between the two machines
stations
=
{}
stations
[
'M1'
]
=
{
'stationID'
:
1
,
'WIP'
:
1
}
stations
[
'M2'
]
=
{
'stationID'
:
2
,
'WIP'
:
1
}
# stations['M3'] = {'stationID':3, 'WIP':1}
# stations['M4'] = {'stationID':4, 'WIP':1}
# stations['M5'] = {'stationID':5, 'WIP':1}
# stations['M6'] = {'stationID':6, 'WIP':1}
# dict with stations' IDs on which an operator can work
PBskills
=
{}
PBskills
[
'PB1'
]
=
[
1
,
2
]
#, 3]
PBskills
[
'PB2'
]
=
[
1
,
2
]
#, 3]
# PBskills['PB3'] = [4, 5]
# PBskills['PB4'] = [2, 4]
# PBskills['PB5'] = [1, 2]
# PBskills['PB6'] = [2, 3, 4]
# PBskills['PB7'] = [5, 6]
# PBskills['PB8'] = [5]
# PBskills['PB9'] = [6]
# list of available PB's
# PBlist = ['PB2', 'PB4', 'PB5', 'PB7']
PBlist
=
[
'PB1'
,
'PB2'
]
opAss_LP
(
stations
,
PBlist
,
PBskills
)
if
__name__
==
'__main__'
:
main
()
\ 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