我正在尝试使用Python中的线性回归来选择足球幻想联盟中的一支球队。然而,我不知道如何增加一个3人一队的限制
我一直在使用http://www.philipkalinda.com/ds9.htmlpost,但当我尝试使用他每队3名球员的约束时,它会导致最大递归错误。我曾尝试使用sys.setrecursionlimit(10000),但它会杀死内核
team_dict= {}
for team in set(pdata.team_code):
team_dict[str(team)]=dict()
team_dict[str(team)]['avail'] = 3
team_dict[str(team)]['total'] = ""
for rownum, row in pdata.iterrows():
for i, player in enumerate(decision_variables):
if rownum == i:
if row['team_code'] == team:
formula = 1*player
team_dict[str(team)]['total'] += formula
prob += (team_dict[str(team)]['total'] <= str(team_dict[str(team)]['avail']))
RecursionError:比较中超出了最大递归深度
目前没有回答
相关问题 更多 >
编程相关推荐