Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_data():
I,d = multidict({0:80, 1:270, 2:250, 3:160, 4:180}) # demand
J,M,f = multidict({0:[500,1000], 1:[500,1000], 2:[500,1000]}) # capacity, fixed costs
c = {(0,0):4, (0,1):6, (0,2):9, # transportation costs
(1,0):5, (1,1):4, (1,2):7,
(2,0):6, (2,1):3, (2,2):4,
(3,0):8, (3,1):5, (3,2):3,
(4,0):10, (4,1):8, (4,2):4,
}
return I,J,d,M,f,c
def make_data():
I,d = multidict({1:80, 2:270, 3:250, 4:160, 5:180}) # demand
J,M,f = multidict({1:[500,1000], 2:[500,1000], 3:[500,1000]}) # capacity, fixed costs
c = {(1,1):4, (1,2):6, (1,3):9, # transportation costs
(2,1):5, (2,2):4, (2,3):7,
(3,1):6, (3,2):3, (3,3):4,
(4,1):8, (4,2):5, (4,3):3,
(5,1):10, (5,2):8, (5,3):4,
}
return I,J,d,M,f,c
def make_data():
I,d = multidict({1:80, 2:270, 3:250, 4:160, 5:180}) # demand
J,M,f = multidict({1:[500,1000], 2:[500,1000], 3:[500,1000]}) # capacity, fixed costs
c = {(1,1):4, (1,2):6, (1,3):9, # transportation costs
(2,1):5, (2,2):4, (2,3):7,
(3,1):6, (3,2):3, (3,3):4,
(4,1):8, (4,2):5, (4,3):3,
(5,1):10, (5,2):8, (5,3):4,
}
return I,J,d,M,f,c
def example():
J,v = multidict({1:16, 2:19, 3:23, 4:28})
a = {(1,1):2, (1,2):3, (1,3):4, (1,4):5,
(2,1):3000, (2,2):3500, (2,3):5100, (2,4):7200,
}
I,b = multidict({1:7, 2:10000})
return I,J,v,a,b
K: set of resources
P: set of items
f[t,p]: set-up costs
g[t,p]: set-up times
c[t,p]: variable costs
d[t,p]: demand values
h[t,p]: holding costs
a[t,k,p]: amount of resource k for producing product p in period. t
M[t,k]: resource upper bounds
UB[t,p]: upper bound of production time of product p in period t
phi[(i,j)] : units of i required to produce a unit of j (j parent of i)
"""
T = 5
K = [1]
P = [1,2,3,4,5,6,7,8,9,10]
_, f, g, c, d, h, UB = multidict({
(1,1): [10, 1, 2, 0, 0.5, 24],
(1,2): [10, 1, 2, 0, 0.5, 24],
(1,3): [10, 1, 2, 0, 0.5, 24],
(1,4): [10, 1, 2, 0, 0.5, 24],
(1,5): [10, 1, 2, 0, 0.5, 24],
(1,6): [10, 1, 2, 0, 0.5, 24],
(1,7): [10, 1, 2, 0, 0.5, 24],
(1,8): [10, 1, 2, 0, 0.5, 24],
(1,9): [10, 1, 2, 0, 0.5, 24],
(1,10):[10, 1, 2, 0, 0.5, 24],
(2,1): [10, 1, 2, 0, 0.5, 24],
(2,2): [10, 1, 2, 0, 0.5, 24],
(2,3): [10, 1, 2, 0, 0.5, 24],
(2,4): [10, 1, 2, 0, 0.5, 24],
(2,5): [10, 1, 2, 0, 0.5, 24],
(2,6): [10, 1, 2, 0, 0.5, 24],
def make_data():
I,d = multidict({1:80, 2:270, 3:250, 4:160, 5:180}) # demand
J,M,f = multidict({1:[500,1000], 2:[500,1000], 3:[500,1000]}) # capacity, fixed costs
c = {(1,1):4, (1,2):6, (1,3):9, # transportation costs
(2,1):5, (2,2):4, (2,3):7,
(3,1):6, (3,2):3, (3,3):4,
(4,1):8, (4,2):5, (4,3):3,
(5,1):10, (5,2):8, (5,3):4,
}
return I,J,d,M,f,c
def make_1r():
J, p = multidict({ # jobs, processing times
1 : 1,
2 : 3,
3 : 2,
4 : 2,
})
P = [(1,2), (1,3), (2,4)]
R = [1]
T = 6
c = {}
for j in J:
for t in range(1,T-p[j]+2):
c[j,t] = 1*(t-1+p[j])
a = {
(1,1,0):2,
(2,1,0):2, (2,1,1):1, (2,1,2):1,
(3,1,0):1, (3,1,1):1,
def example(n):
"""
Data generator for the one machine scheduling problem.
"""
J,p,r,d,w = multidict({
1:[1,4,0,3],
2:[4,0,0,1],
3:[2,2,0,2],
4:[3,4,0,3],
5:[1,1,0,1],
6:[4,5,0,2],
})
return J,p,r,d,w