-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstraint.py
More file actions
27 lines (22 loc) · 749 Bytes
/
constraint.py
File metadata and controls
27 lines (22 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import calculate
from config import *
def capacity():
"""capacity constraint satisfier.
return: capacity binary (1: fulfilled; 0: not fulfilled)
"""
CapacityBinary = np.zeros(len(calculate.route()))
for a in range(len(calculate.route())):
if calculate.DemandPerRoute()[a] <= config.capacity_vector[a]:
CapacityBinary[a] = 1
else:
CapacityBinary[a] = 0
return CapacityBinary
print("capacity constraint for each route (1: Fulfilled; 0: Not Fulfilled)\n", capacity())
def demand(delivered, request):
"""customer's demand constraint satisfier."""
DemandBinary = 0
if delivered >= request:
DemandBinary = 1
else:
DemandBinary = 0
return DemandBinary