def pickSubs(self, subjects, maxWork, maxLottery): totWork = 0 totLott = 0 studentSubs = [] for s in subjects: totWork += s.getWork() totLott += s.getLottery() if totLott <= maxLottery and totWork <= maxWork: studentSubs.append(s) return studentSubs 我正在嘗試使用比較器根據不同因素為學生決定最佳選擇。我的問題是,如果總工作量和彩票值在maxWork,maxLottery下,我想附加所有可能的對象,但我不附加所有可能的組合。我只是追加直到達到最大約束值如何獲得所有可能的組合?
添加回答
舉報
0/150
提交
取消
