添加互斥的客户

main
chaopower 2024-02-23 16:45:58 +08:00
parent 70f00df07f
commit 6ba6b137dd
2 changed files with 23 additions and 1 deletions

Binary file not shown.

View File

@ -41,6 +41,7 @@ class AutoLayout:
# 文库 # 文库
self.chip_classification = defaultdict(set) self.chip_classification = defaultdict(set)
self.rule = self.read_rule() self.rule = self.read_rule()
self.rule_exclusive_customer = self.read_rule_exclusive_customer()
# 不平衡文库 # 不平衡文库
self.chip_speciallib_size = dict() self.chip_speciallib_size = dict()
@ -162,6 +163,15 @@ class AutoLayout:
res = pd.concat([df, newdf]) res = pd.concat([df, newdf])
return res.reset_index() return res.reset_index()
@staticmethod
def read_rule_exclusive_customer():
df = pd.read_excel(os.path.join(basedir, 'rule', 'exclusive_customer.xlsx'))
newdf = pd.DataFrame()
newdf['customer1'] = df['customer2']
newdf['customer2'] = df['customer1']
res = pd.concat([df, newdf])
return res.reset_index()
@staticmethod @staticmethod
def read_cols(): def read_cols():
df = pd.read_excel(os.path.join(basedir, 'rule', 'columns.xlsx')) df = pd.read_excel(os.path.join(basedir, 'rule', 'columns.xlsx'))
@ -230,12 +240,19 @@ class AutoLayout:
return True return True
return False return False
def use_rule_exclusive_customer(self, chipname, customer):
may_classfic = set(self.rule_exclusive_customer[self.rule_exclusive_customer['customer1'] == customer]['customer2'])
if self.chip_customer[chipname].intersection(may_classfic):
return True
return False
def judge_data(self, chipname, library_data): def judge_data(self, chipname, library_data):
""" """
约束条件 约束条件
""" """
size = library_data['size'] size = library_data['size']
classification = library_data['classification'] classification = library_data['classification']
customer = library_data['customer']
is_balance_lib = library_data['is_balance_lib'] is_balance_lib = library_data['is_balance_lib']
# 芯片大小不能超过设定限制 # 芯片大小不能超过设定限制
@ -257,6 +274,11 @@ class AutoLayout:
if self.use_rule(chipname, classification): if self.use_rule(chipname, classification):
exclusive_classific = False exclusive_classific = False
# 互斥的用户
exclusive_customer = True
if self.use_rule_exclusive_customer(chipname, customer):
exclusive_customer = False
# 不平衡文库大于250G 不能添加 # 不平衡文库大于250G 不能添加
splibrary = True splibrary = True
if is_balance_lib == '' and self.chip_speciallib_size[chipname] + size > 250: if is_balance_lib == '' and self.chip_speciallib_size[chipname] + size > 250:
@ -282,7 +304,7 @@ class AutoLayout:
if is_not_balance_list: if is_not_balance_list:
base_balance = False base_balance = False
if sizelimit and notrepeatbarcode and exclusive_classific and splibrary and base_balance and spmethylibrary: if sizelimit and notrepeatbarcode and exclusive_classific and exclusive_customer and splibrary and base_balance and spmethylibrary:
return True return True
return False return False